repo stringclasses 1
value | pull_number int64 20 3.81k | instance_id stringlengths 18 20 | issue_numbers listlengths 1 2 | base_commit stringlengths 40 40 | patch stringlengths 214 153k | test_patch stringlengths 288 262k | problem_statement stringlengths 22 7.42k | hints_text stringlengths 0 66.9k | created_at stringlengths 20 20 | version stringclasses 21
values | environment_setup_commit stringclasses 21
values |
|---|---|---|---|---|---|---|---|---|---|---|---|
hyperium/hyper | 1,674 | hyperium__hyper-1674 | [
"1517"
] | 8bfe3c220c450d6a3d049fab4d7a591fa2ea0d82 | diff --git a/src/client/connect/dns.rs b/src/client/connect/dns.rs
--- a/src/client/connect/dns.rs
+++ b/src/client/connect/dns.rs
@@ -1,45 +1,183 @@
-use std::io;
+use std::{fmt, io, vec};
use std::net::{
- Ipv4Addr, Ipv6Addr,
+ IpAddr, Ipv4Addr, Ipv6Addr,
SocketAddr, ToSocketAddrs,
SocketAddrV4, Sock... | diff --git a/src/client/connect/dns.rs b/src/client/connect/dns.rs
--- a/src/client/connect/dns.rs
+++ b/src/client/connect/dns.rs
@@ -77,6 +215,30 @@ impl Iterator for IpAddrs {
}
}
+// Make this Future unnameable outside of this crate.
+pub(super) mod sealed {
+ use super::*;
+ // Blocking task to be ex... | Substitute DNS Resolver
This relates to #1174.
It would be great if we could substitute a resolver instead of using `to_socket_addrs` and `getaddrinfo`. It seems there was already a good amount of discussion around this in #1174, but I'm not sure what the conclusion was.
It seems like there are three options:
... | The `ClientProto` stuff is long gone, nothing to worry about there :)
I've seen others ask to replace the resolve in `HttpConnector` also, and it would be nice to be do so. The *only* thing that has held me back is that it would be another trait to need to stabilize. I don't have a good design for one, and haven't s... | 2018-10-17T23:07:16Z | 0.12 | a1609fbb332fccffbeb85d16f1cc0bf98c6ede21 |
hyperium/hyper | 1,662 | hyperium__hyper-1662 | [
"1661"
] | 0cfa7231b2483715e3bd886a059e2792c090e635 | diff --git a/src/client/connect/mod.rs b/src/client/connect/mod.rs
--- a/src/client/connect/mod.rs
+++ b/src/client/connect/mod.rs
@@ -8,7 +8,7 @@
use std::error::Error as StdError;
use std::mem;
-use bytes::{BufMut, BytesMut};
+use bytes::{BufMut, Bytes, BytesMut};
use futures::Future;
use http::{uri, Uri};
use... | diff --git a/src/client/connect/mod.rs b/src/client/connect/mod.rs
--- a/src/client/connect/mod.rs
+++ b/src/client/connect/mod.rs
@@ -305,6 +312,30 @@ mod tests {
assert_eq!(dst.host(), "seanmonstar.com", "error doesn't modify dst");
assert_eq!(dst.port(), None, "error doesn't modify dst");
+ ... | Calling Destination::set_host with an IPv6 string errors
| 2018-09-27T22:16:59Z | 0.12 | a1609fbb332fccffbeb85d16f1cc0bf98c6ede21 | |
hyperium/hyper | 1,643 | hyperium__hyper-1643 | [
"1642"
] | 168c7d2155952ba09f781c331fd67593b820af20 | diff --git a/src/proto/h2/client.rs b/src/proto/h2/client.rs
--- a/src/proto/h2/client.rs
+++ b/src/proto/h2/client.rs
@@ -108,7 +108,7 @@ where
}
let (head, body) = req.into_parts();
let mut req = ::http::Request::from_parts(head, (... | diff --git a/src/proto/h2/mod.rs b/src/proto/h2/mod.rs
--- a/src/proto/h2/mod.rs
+++ b/src/proto/h2/mod.rs
@@ -15,15 +15,17 @@ mod server;
pub(crate) use self::client::Client;
pub(crate) use self::server::Server;
-fn strip_connection_headers(headers: &mut HeaderMap) {
+fn strip_connection_headers(headers: &mut Head... | TE "trailers" header incorrectly stripped from HTTP/2 requests
According to the HTTP/2 spec (https://http2.github.io/http2-spec/#rfc.section.8.1.2.2), connection-specific headers are not supposed to be in HTTP/2 messages, but a TE header is allowed for request messages as long as it only contains the value "trailers". ... | Yep, looks like hyper is being too eager here. | 2018-08-25T07:58:17Z | 0.12 | a1609fbb332fccffbeb85d16f1cc0bf98c6ede21 |
hyperium/hyper | 1,641 | hyperium__hyper-1641 | [
"1639"
] | 1448e4067b10da6fe4584921314afc1f5f4e3c8d | diff --git a/src/client/mod.rs b/src/client/mod.rs
--- a/src/client/mod.rs
+++ b/src/client/mod.rs
@@ -753,8 +753,7 @@ pub struct Builder {
keep_alive_timeout: Option<Duration>,
h1_writev: bool,
h1_title_case_headers: bool,
- //TODO: make use of max_idle config
- max_idle: usize,
+ max_idle_per_... | diff --git a/src/client/pool.rs b/src/client/pool.rs
--- a/src/client/pool.rs
+++ b/src/client/pool.rs
@@ -773,7 +790,16 @@ mod tests {
}
fn pool_no_timer<T>() -> Pool<T> {
- let pool = Pool::new(true, Some(Duration::from_millis(100)), &Exec::Default);
+ pool_max_idle_no_timer(::std::usize::MA... | Enable max idle Client Pool option
There is currently a `max_idle` option for the `Client` connection pool, that claims it is the maximum number of idle connections that will be kept per host, but it's a lie. That config is currently ignored.
It should be plugged into the pool so that each time a connection is ready... | 2018-08-21T23:06:58Z | 0.12 | a1609fbb332fccffbeb85d16f1cc0bf98c6ede21 | |
hyperium/hyper | 1,596 | hyperium__hyper-1596 | [
"1595"
] | 396e6022e02bdbcabced5235528cb61bee29e3b7 | diff --git a/examples/client_json.rs b/examples/client_json.rs
--- a/examples/client_json.rs
+++ b/examples/client_json.rs
@@ -11,14 +11,32 @@ use hyper::rt::{self, Future, Stream};
fn main() {
let url = "http://jsonplaceholder.typicode.com/users".parse().unwrap();
+ let fut = fetch_json(url)
+ // use... | diff --git a/examples/web_api.rs b/examples/web_api.rs
--- a/examples/web_api.rs
+++ b/examples/web_api.rs
@@ -27,32 +28,65 @@ fn response_examples(req: Request<Body>, client: &Client<HttpConnector>)
},
(&Method::GET, "/test.html") => {
// Run a web query against the web api below
+
+ ... | JSON server example
Would it be nice to have example for server responding with json? I think it's common use case (especially useful when API frequently change)
It can be like this: (what I came up with)
```rust
use futures::{future, Future};
use hyper::{self, Method, StatusCode, Request, Response, Body, Ser... | Perhaps this could be added to the web_api example that already exists? That probably could use some cleanup, and some comments explaining what each part does... But it otherwise seems like a good fit for this. | 2018-07-06T15:47:17Z | 0.12 | a1609fbb332fccffbeb85d16f1cc0bf98c6ede21 |
hyperium/hyper | 1,594 | hyperium__hyper-1594 | [
"1402"
] | ced949cb6b798f25c2ffbdb3ebda6858c18393a7 | diff --git a/examples/hello.rs b/examples/hello.rs
--- a/examples/hello.rs
+++ b/examples/hello.rs
@@ -10,7 +10,6 @@ static PHRASE: &'static [u8] = b"Hello World!";
fn main() {
pretty_env_logger::init();
-
let addr = ([127, 0, 0, 1], 3000).into();
// new_service is run for each connection, creating ... | diff --git a/src/client/connect/mod.rs b/src/client/connect/mod.rs
--- a/src/client/connect/mod.rs
+++ b/src/client/connect/mod.rs
@@ -268,6 +278,61 @@ impl Connected {
self
}
*/
+
+ // Don't public expose that `Connected` is `Clone`, unsure if we want to
+ // keep that contract...
+ pub(sup... | Get socket parameters in Client or Server
When a `Client` makes a request, it may connect to one of many hosts associated with the URL.
I would like to have a way to access the IP address associated with the remote host. This is accessible from tokio via `NetSocket::peer_addr()`.
Logically, one should also be abl... | I agree there are cases where this is desirable, but there are also reasons it doesn't exist yet. These are properties specific to TCP, whereas hyper (and HTTP even) don't require the underlying transport to be TCP (Unix domain sockets don't have a concept of addresses, for example).
It'd probably need some sort of ... | 2018-07-05T18:54:23Z | 0.12 | a1609fbb332fccffbeb85d16f1cc0bf98c6ede21 |
hyperium/hyper | 1,572 | hyperium__hyper-1572 | [
"1564"
] | e4ebf4482372497f0cd5fa63d6492bd1c51d7b21 | diff --git a/src/client/connect.rs b/src/client/connect.rs
--- a/src/client/connect.rs
+++ b/src/client/connect.rs
@@ -6,9 +6,11 @@
//! establishes connections over TCP.
//! - The [`Connect`](Connect) trait and related types to build custom connectors.
use std::error::Error as StdError;
+use std::mem;
+use bytes... | diff --git a/src/client/connect.rs b/src/client/connect.rs
--- a/src/client/connect.rs
+++ b/src/client/connect.rs
@@ -121,6 +261,121 @@ impl Connected {
*/
}
+#[cfg(test)]
+mod tests {
+ use super::Destination;
+
+ #[test]
+ fn test_destination_set_scheme() {
+ let mut dst = Destination {
+ ... | Can't create or modify hyper::client::connect::Destination
I'm trying to write a connector that takes a destination, modifies it and passes it to the next connector. It seems this is currently not possible because there's no way to get a mutable reference to the internal state and only hyper can create new `Destination... | I definitely get the use case! I'd like to find a way to support it, but I'd also like to list why the constructor was so far private:
- The `Destination` type *may* gain more fields, such as in #1485 to support ALPN.
- I worried that if a `Destination` gained more fields in new release, and a connector didn't know... | 2018-06-18T21:21:52Z | 0.12 | a1609fbb332fccffbeb85d16f1cc0bf98c6ede21 |
hyperium/hyper | 1,563 | hyperium__hyper-1563 | [
"1395"
] | 1c3fbfd6bf6b627f75ef694e69c8074745276e9b | diff --git a/Cargo.toml b/Cargo.toml
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -29,7 +29,7 @@ iovec = "0.1"
log = "0.4"
net2 = { version = "0.2.32", optional = true }
time = "0.1"
-tokio = { version = "0.1.5", optional = true }
+tokio = { version = "0.1.7", optional = true }
tokio-executor = { version = "0.1.0", optiona... | diff --git a/src/proto/h1/conn.rs b/src/proto/h1/conn.rs
--- a/src/proto/h1/conn.rs
+++ b/src/proto/h1/conn.rs
@@ -612,6 +598,10 @@ where I: AsyncRead + AsyncWrite,
}
}
+ pub(super) fn on_upgrade(&mut self) -> ::upgrade::OnUpgrade {
+ self.state.prepare_upgrade()
+ }
+
// Used in h1::d... | Client Protocol Upgrades
(For handling server protocol upgrades, see #1323)
HTTP/1 allows starting a different protocol with an HTTP/1 request, and the desired protocol in an `Upgrade` header. We should support this.
Edit: removed bad API proposal.
| This looks great!
The channel based approach we discussed also seems to be equally ergonomic and a looks much simpler to implement without adding another type parameter to virtually all types in `proto`. Is there any reason you prefer this over that?
Well, shoot. The reason I liked this was for the end user API, but... | 2018-06-11T23:35:42Z | 0.12 | a1609fbb332fccffbeb85d16f1cc0bf98c6ede21 |
hyperium/hyper | 1,556 | hyperium__hyper-1556 | [
"1547"
] | f20afba57d6fabb04085968342e5fd62b45bc8df | diff --git a/src/headers.rs b/src/headers.rs
--- a/src/headers.rs
+++ b/src/headers.rs
@@ -78,6 +78,13 @@ pub fn content_length_value(len: u64) -> HeaderValue {
}
}
+pub fn set_content_length_if_missing(headers: &mut HeaderMap, len: u64) {
+ headers
+ .entry(CONTENT_LENGTH)
+ .unwrap()
+ ... | diff --git a/tests/integration.rs b/tests/integration.rs
--- a/tests/integration.rs
+++ b/tests/integration.rs
@@ -166,6 +166,29 @@ t! {
;
}
+t! {
+ post_outgoing_length,
+ client:
+ request:
+ method: "POST",
+ uri: "/hello",
+ body: "hello, world!",
+ ... | HTTP2 outgoing messages should set content-length if payload knows it
For instance, a server replying with `Response::new(Body::from("Hello, World!"))` over HTTP2 should set the `content-length: 13` header.
## Steps to fix
- In `proto::h2::server`, before calling `SendResponse::send_response`, check `body.content... | 2018-06-08T21:21:11Z | 0.12 | a1609fbb332fccffbeb85d16f1cc0bf98c6ede21 | |
hyperium/hyper | 1,554 | hyperium__hyper-1554 | [
"1545"
] | 396fe80e76840dea9373ca448b20cf7a9babd2f8 | diff --git a/src/body/body.rs b/src/body/body.rs
--- a/src/body/body.rs
+++ b/src/body/body.rs
@@ -35,6 +35,7 @@ pub struct Body {
enum Kind {
Once(Option<Chunk>),
Chan {
+ content_length: Option<u64>,
abort_rx: oneshot::Receiver<()>,
rx: mpsc::Receiver<Result<Chunk, ::Error>>,
... | diff --git a/tests/client.rs b/tests/client.rs
--- a/tests/client.rs
+++ b/tests/client.rs
@@ -1424,6 +1424,63 @@ mod conn {
res.join(rx).map(|r| r.0).wait().unwrap();
}
+ #[test]
+ fn incoming_content_length() {
+ use hyper::body::Payload;
+
+ let server = TcpListener::bind("127.0.0... | Incoming HTTP1 bodies should know content_length and is_end_stream
For instance, if a server receives the follow request:
```
POST /foo HTTP/1.1
content-length: 15
```
The `Body` in the `Request` should know these things, neither of which are currently true:
- `Body::content_length()` should be `Some(15)`.
... | 2018-06-08T03:56:07Z | 0.12 | a1609fbb332fccffbeb85d16f1cc0bf98c6ede21 | |
hyperium/hyper | 1,503 | hyperium__hyper-1503 | [
"1486"
] | 18f4dd240631df55064696de865b6d818cb76ba7 | diff --git a/Cargo.toml b/Cargo.toml
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -45,6 +45,7 @@ num_cpus = "1.0"
pretty_env_logger = "0.2.0"
spmc = "0.2"
url = "1.0"
+tokio-mockstream = "1.1.0"
[features]
default = [
diff --git a/src/error.rs b/src/error.rs
--- a/src/error.rs
+++ b/src/error.rs
@@ -69,6 +69,7 @@ pub(cr... | diff --git /dev/null b/src/server/rewind.rs
new file mode 100644
--- /dev/null
+++ b/src/server/rewind.rs
@@ -0,0 +1,208 @@
+use bytes::{Buf, BufMut, Bytes, IntoBuf};
+use futures::{Async, Poll};
+use std::io::{self, Read, Write};
+use std::cmp;
+use tokio_io::{AsyncRead, AsyncWrite};
+
+#[derive(Debug)]
+pub struct Re... | Try parsing HTTP2 on server connections if HTTP1 parsing fails
This would be a next step to allowing the server to have HTTP2 support on by default.
| I'd like to take this one on.
@estk cool!
I haven't personally thought out an exact implementation yet... One way could be for `server::conn::Connection` to be able to inspect a returned error, and if it's a parse error, try to take the IO and read buffer back out and use them to try the `h2::server::handshake`...
E... | 2018-04-27T23:34:32Z | 0.12 | a1609fbb332fccffbeb85d16f1cc0bf98c6ede21 |
hyperium/hyper | 1,502 | hyperium__hyper-1502 | [
"1484"
] | 5e3b43af09fda86df59486edbeb9e68c6801a503 | diff --git a/Cargo.toml b/Cargo.toml
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -24,7 +24,6 @@ include = [
bytes = "0.4.4"
futures = "0.1.21"
futures-cpupool = { version = "0.1.6", optional = true }
-futures-timer = "0.1.0"
http = "0.1.5"
httparse = "1.0"
h2 = "0.1.5"
diff --git a/Cargo.toml b/Cargo.toml
--- a/Cargo.to... | diff --git a/.travis.yml b/.travis.yml
--- a/.travis.yml
+++ b/.travis.yml
@@ -18,7 +18,7 @@ cache:
script:
- ./.travis/readme.py
- cargo build $FEATURES
- - 'if [ "$BUILD_ONLY" != "1" ]; then RUST_LOG=hyper cargo test $FEATURES; fi'
+ - 'if [ "$BUILD_ONLY" != "1" ]; then RUST_LOG=hyper cargo test $FEATURES --... | Replace futures-timer usage with tokio-timer
| I'll happily take this one!
@srijs I try to port it last night, but tokio-timer require work with `Runtime`, so in many test cases, `res.join(...).wait()` not work well. Good luck!
Oh, interesting! If tokio's `current_thread` executor could be updated to use a timer as well, we could probably change all `wait`s to use ... | 2018-04-27T23:17:09Z | 0.12 | a1609fbb332fccffbeb85d16f1cc0bf98c6ede21 |
hyperium/hyper | 1,497 | hyperium__hyper-1497 | [
"1492"
] | 988dc7c637bc54e97a325a95d1e10d39d5fc8b2d | diff --git a/src/client/conn.rs b/src/client/conn.rs
--- a/src/client/conn.rs
+++ b/src/client/conn.rs
@@ -67,6 +67,7 @@ where
pub struct Builder {
exec: Exec,
h1_writev: bool,
+ h1_title_case_headers: bool,
http2: bool,
}
diff --git a/src/client/conn.rs b/src/client/conn.rs
--- a/src/client/conn.... | diff --git a/src/proto/h1/role.rs b/src/proto/h1/role.rs
--- a/src/proto/h1/role.rs
+++ b/src/proto/h1/role.rs
@@ -857,6 +901,21 @@ mod tests {
Client::decoder(&head, method).unwrap_err();
}
+ #[test]
+ fn test_client_request_encode_title_case() {
+ use http::header::HeaderValue;
+ u... | Headers are lower-cased when sent and no option to disable this feature.
I am trying to use Hyper with a stubborn web service that does not like requests with headers that do not have the first letter of each word capitalized (`Content-Length` for example). I tried out some other HTTP client libraries for Rust (like `t... | I expected this problem to appear eventually. Clearly, the best thing to happen is for that server software to be fixed. But, I realized that there is likely other janky server software out there that also relies on title case, just rotting with no fix to ever come...
Possibly a solution could be for hyper to add an... | 2018-04-23T21:21:54Z | 0.12 | a1609fbb332fccffbeb85d16f1cc0bf98c6ede21 |
hyperium/hyper | 1,490 | hyperium__hyper-1490 | [
"1461"
] | 71a15c25f583dcb8dacc21904cf44c658cf429b8 | diff --git a/Cargo.toml b/Cargo.toml
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -34,7 +34,6 @@ net2 = "0.2.32"
time = "0.1"
tokio = "0.1.5"
tokio-executor = "0.1.0"
-tokio-service = "0.1"
tokio-io = "0.1"
want = "0.0.3"
diff --git a/benches/end_to_end.rs b/benches/end_to_end.rs
--- a/benches/end_to_end.rs
+++ b/benche... | diff --git a/benches/end_to_end.rs b/benches/end_to_end.rs
--- a/benches/end_to_end.rs
+++ b/benches/end_to_end.rs
@@ -71,20 +71,20 @@ fn post_one_at_a_time(b: &mut test::Bencher) {
static PHRASE: &'static [u8] = include_bytes!("../CHANGELOG.md"); //b"Hello, World!";
fn spawn_hello(rt: &mut Runtime) -> SocketAddr {... | Update Service trait from tokio-service to tower
| Hi, I want to have a try, any mentoring instructions for this change?
This wouldn't be too much work in hyper directly, but it does require [tower](https://github.com/tower-rs/tower) to publish a version to crates.io. I'd probably expect it to do so only after futures 0.2, since it needs to update to the new futures. | 2018-04-17T23:34:09Z | 0.12 | a1609fbb332fccffbeb85d16f1cc0bf98c6ede21 |
hyperium/hyper | 1,488 | hyperium__hyper-1488 | [
"1263"
] | 35c38cba6e13e1d2122f46bd0e02eafcebf776f7 | diff --git a/benches/end_to_end.rs b/benches/end_to_end.rs
--- a/benches/end_to_end.rs
+++ b/benches/end_to_end.rs
@@ -13,7 +13,8 @@ use tokio::runtime::Runtime;
use tokio::net::TcpListener;
use hyper::{Body, Method, Request, Response};
-use hyper::server::Http;
+use hyper::client::HttpConnector;
+use hyper::server... | diff --git a/benches/end_to_end.rs b/benches/end_to_end.rs
--- a/benches/end_to_end.rs
+++ b/benches/end_to_end.rs
@@ -21,8 +22,10 @@ fn get_one_at_a_time(b: &mut test::Bencher) {
let mut rt = Runtime::new().unwrap();
let addr = spawn_hello(&mut rt);
- let client = hyper::Client::configure()
- .bu... | Http::bind does not scale to uses where a Handle is needed
So, I have a [`ReverseProxy` type that requires a `Client`](https://docs.rs/hyper-reverse-proxy/0.2.1/hyper_reverse_proxy/struct.ReverseProxy.html#method.new) in order to be constructed. But in order to do that I need to [do the manual set up of the Tokio event... | Same here, exposing a handle is not enough: I'm running two HTTP servers on the same event loop (one http handling let's encrypt, and redirecting other requests to https), plus a pleingres database connection, and an SSH server.
I would be able to spawn the pleingres and SSH server using just the current handle, but... | 2018-04-16T19:04:36Z | 0.12 | a1609fbb332fccffbeb85d16f1cc0bf98c6ede21 |
hyperium/hyper | 1,480 | hyperium__hyper-1480 | [
"1338"
] | 33874f9a7577eb20374c6d8943ce665feb9619e0 | diff --git a/examples/client.rs b/examples/client.rs
--- a/examples/client.rs
+++ b/examples/client.rs
@@ -40,8 +40,9 @@ fn main() {
println!("Response: {}", res.status());
println!("Headers: {:#?}", res.headers());
- res.into_parts().1.into_stream().for_each(|chunk| {
- ... | diff --git a/benches/server.rs b/benches/server.rs
--- a/benches/server.rs
+++ b/benches/server.rs
@@ -78,7 +78,7 @@ fn throughput_fixedsize_large_payload(b: &mut test::Bencher) {
fn throughput_fixedsize_many_chunks(b: &mut test::Bencher) {
bench_server!(b, ("content-length", "1000000"), || {
static S: &... | From-trait based error conversion for request bodies
Picking up that particular thread from #1328, I was wondering whether it might be worth it to implement a From/Into-based error coercion for request bodies.
This would be different from #1129 in so far as I believe that it should be possible to ship it as a non-br... | That seems fine to me. I think I tried it out a few months ago, and ran into issues propagating the generics everywhere, but maybe I did it wrong! | 2018-04-06T21:13:43Z | 0.12 | a1609fbb332fccffbeb85d16f1cc0bf98c6ede21 |
hyperium/hyper | 1,470 | hyperium__hyper-1470 | [
"1448"
] | 5db85316a10d0b7bdd36524d85a746a23bd10190 | diff --git a/Cargo.toml b/Cargo.toml
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -22,20 +22,17 @@ include = [
[dependencies]
bytes = "0.4.4"
-futures = "0.1.17"
-futures-cpupool = "0.1.6"
-futures-timer = "0.1.0"
+futures = "0.2.0-beta"
+futures-timer = { git = "https://github.com/alexcrichton/futures-timer.git" }
http =... | diff --git a/benches/end_to_end.rs b/benches/end_to_end.rs
--- a/benches/end_to_end.rs
+++ b/benches/end_to_end.rs
@@ -22,19 +23,20 @@ fn get_one_at_a_time(b: &mut test::Bencher) {
let addr = spawn_hello(&mut rt);
let client = hyper::Client::configure()
- .build_with_executor(&rt.handle(), rt.executo... | Update to futures 0.2
It's not released yet, but this is just tracking that it needs to happen and is part of 0.12.
| I'm super excited for this and would be interested in helping out! futures-0.2 is nearly code-complete, so we could probably get started soon. Do you have a branch you'd like PRs submitted to?
There's a 0.12.x branch now on the repo where I've been trying to add new breaking changes to.
Now that tokio 0.1 has landed in... | 2018-03-20T09:55:12Z | 0.12 | a1609fbb332fccffbeb85d16f1cc0bf98c6ede21 |
hyperium/hyper | 1,459 | hyperium__hyper-1459 | [
"1323"
] | eb15c660c106a2be08afd07e6cdfce162272d6cc | diff --git a/src/proto/h1/conn.rs b/src/proto/h1/conn.rs
--- a/src/proto/h1/conn.rs
+++ b/src/proto/h1/conn.rs
@@ -500,6 +500,8 @@ where I: AsyncRead + AsyncWrite,
Ok(encoder) => {
if !encoder.is_eof() {
Writing::Body(encoder)
+ } else if encoder.is_last... | diff --git a/tests/server.rs b/tests/server.rs
--- a/tests/server.rs
+++ b/tests/server.rs
@@ -1,5 +1,6 @@
#![deny(warnings)]
extern crate hyper;
+#[macro_use]
extern crate futures;
extern crate spmc;
extern crate pretty_env_logger;
diff --git a/tests/server.rs b/tests/server.rs
--- a/tests/server.rs
+++ b/tests/s... | Server Protocol Upgrades
Add support for servers to receive requests that wish to upgrade to a different protocol, such as websockets. A proposed API follows:
## Proposal
- `Response`
- `pub fn upgrade(proto: header::Upgrade) -> (Response, server::Upgrade)`
This sets the `StatusCode::SwitchingProtoc... | This is a great idea, but what about handling CONNECT method at the server side (like in a HTTP proxy server)? I think the upgrade function should only provide the underlying I/O object, and it is the user's responsibility to return a proper HTTP response.
@lqf96 I would definitely like to also offer a way of handling ... | 2018-03-08T21:45:47Z | 0.11 | eb15c660c106a2be08afd07e6cdfce162272d6cc |
hyperium/hyper | 1,454 | hyperium__hyper-1454 | [
"1449"
] | 0786ea1f871de9e007295238f20512825720853e | diff --git a/benches/end_to_end.rs b/benches/end_to_end.rs
--- a/benches/end_to_end.rs
+++ b/benches/end_to_end.rs
@@ -8,14 +8,13 @@ extern crate tokio_core;
use std::net::SocketAddr;
-use futures::{future, Future, Stream};
+use futures::{Future, Stream};
use tokio_core::reactor::{Core, Handle};
use tokio_core::... | diff --git a/benches/end_to_end.rs b/benches/end_to_end.rs
--- a/benches/end_to_end.rs
+++ b/benches/end_to_end.rs
@@ -42,13 +41,15 @@ fn get_one_at_a_time(b: &mut test::Bencher) {
#[bench]
fn post_one_at_a_time(b: &mut test::Bencher) {
+ extern crate pretty_env_logger;
+ let _ = pretty_env_logger::try_init()... | A lower level Connection API for the Client
The `Client` is a higher level API that, among other things, provides a connection pool. Similar to how the server has higher and lower level APIs (`Server` vs `Serve`/`Connection`), the client should gain a lower level connection based API. This would allow finer grained con... | This would be great!
The API I've been prototyping has a similar look to the [h2 client](https://docs.rs/h2/0.1.*/h2/client/index.html), where you provide an already connected `io`, and get back a sender (`SendRequest`?) and `Connection` pair. You probably want to just spawn the `Connection` into an executor, and then ... | 2018-03-01T01:43:41Z | 0.11 | eb15c660c106a2be08afd07e6cdfce162272d6cc |
hyperium/hyper | 1,434 | hyperium__hyper-1434 | [
"1433"
] | 8fb84d29a1c0ff848ff1c921f4c5bb7493939b97 | diff --git /dev/null b/src/client/cancel.rs
new file mode 100644
--- /dev/null
+++ b/src/client/cancel.rs
@@ -0,0 +1,148 @@
+use std::sync::Arc;
+use std::sync::atomic::{AtomicBool, Ordering};
+
+use futures::{Async, Future, Poll};
+use futures::task::{self, Task};
+
+use common::Never;
+
+use self::lock::Lock;
+
+#[de... | diff --git a/src/proto/h1/dispatch.rs b/src/proto/h1/dispatch.rs
--- a/src/proto/h1/dispatch.rs
+++ b/src/proto/h1/dispatch.rs
@@ -435,8 +431,6 @@ where
#[cfg(test)]
mod tests {
- use futures::Sink;
-
use super::*;
use mock::AsyncIo;
use proto::ClientTransaction;
diff --git a/src/proto/h1/dispatch... | Connection pool returns connections which are not ready
I am running a high number of concurrent requests (~1000) to the AWS Kinesis service and I am getting an error log from the hyper connection pool:
```
root@doit-1800981089-sz6zt:~/kinesis-hyper-bug# cargo build --release && RUST_LOG=error RUST_BACKTRACE=full .... | 2018-02-03T00:03:56Z | 0.11 | eb15c660c106a2be08afd07e6cdfce162272d6cc | |
hyperium/hyper | 1,390 | hyperium__hyper-1390 | [
"1365"
] | cecef9d402b76af12e6415519deb2b604f77b195 | diff --git a/src/proto/conn.rs b/src/proto/conn.rs
--- a/src/proto/conn.rs
+++ b/src/proto/conn.rs
@@ -453,6 +453,14 @@ where I: AsyncRead + AsyncWrite,
pub fn close_write(&mut self) {
self.state.close_write();
}
+
+ pub fn disable_keep_alive(&mut self) {
+ if self.state.is_idle() {
+ ... | diff --git a/src/proto/conn.rs b/src/proto/conn.rs
--- a/src/proto/conn.rs
+++ b/src/proto/conn.rs
@@ -869,7 +881,7 @@ mod tests {
other => panic!("unexpected frame: {:?}", other)
}
- // client
+ // client
let io = AsyncIo::new_buf(vec![], 1);
... | Make graceful shutdown work at request rather than connection granularity
The graceful shutdown logic currently waits until all `Service`s have dropped (i.e. all connections have closed). However, with keep-alive this is overconservative - what we'd really like is to wait until pending requests have finished.
This c... | @seanmonstar pointed out that a simple way of doing this is to add a method to disable keep-alive on Connections. Then, `Service::drop`-based tracking will be accurate. | 2017-11-29T07:06:16Z | 0.11 | eb15c660c106a2be08afd07e6cdfce162272d6cc |
hyperium/hyper | 1,387 | hyperium__hyper-1387 | [
"1383"
] | e4864a2bea59b40fb07e6d18329f75817803a3f3 | diff --git a/src/client/pool.rs b/src/client/pool.rs
--- a/src/client/pool.rs
+++ b/src/client/pool.rs
@@ -200,10 +200,13 @@ impl<T: Clone> KeepAlive for Pooled<T> {
};
if pool.is_enabled() {
pool.put(self.key.clone(), self.entry.clone());
+ } else {
+ ... | diff --git a/tests/client.rs b/tests/client.rs
--- a/tests/client.rs
+++ b/tests/client.rs
@@ -654,6 +654,46 @@ mod dispatch_impl {
}
+ #[test]
+ fn no_keep_alive_closes_connection() {
+ // https://github.com/hyperium/hyper/issues/1383
+ let _ = pretty_env_logger::init();
+
+ let ser... | All client connections are leaked when keep_alive(false)
```rust
extern crate hyper;
extern crate tokio_core;
extern crate tokio_io;
extern crate futures;
extern crate env_logger;
use tokio_core::reactor::{Core, Timeout};
use tokio_core::net::TcpStream;
use tokio_io::{AsyncRead, AsyncWrite};
use hyper::{Clie... | 2017-11-28T05:44:01Z | 0.11 | eb15c660c106a2be08afd07e6cdfce162272d6cc | |
hyperium/hyper | 1,362 | hyperium__hyper-1362 | [
"1353"
] | 8153cfaebf65779c279dc089767dece508d3359c | diff --git a/.travis.yml b/.travis.yml
--- a/.travis.yml
+++ b/.travis.yml
@@ -8,6 +8,8 @@ matrix:
env: FEATURES="--features nightly"
- rust: beta
- rust: stable
+ - rust: stable
+ env: HYPER_NO_PROTO=1
- rust: stable
env: FEATURES="--features compat"
... | diff --git a/src/proto/conn.rs b/src/proto/conn.rs
--- a/src/proto/conn.rs
+++ b/src/proto/conn.rs
@@ -727,7 +769,7 @@ mod tests {
use futures::future;
use tokio_proto::streaming::pipeline::Frame;
- use proto::{self, MessageHead, ServerTransaction};
+ use proto::{self, ClientTransaction, MessageHead, ... | Not reading the entire response body leaks the connection on the client side
This program continually creates new connections without ever closing old ones:
```rust
extern crate hyper;
extern crate tokio_core;
extern crate tokio_io;
extern crate futures;
extern crate env_logger;
use tokio_core::reactor::{Cor... | 2017-10-27T06:25:54Z | 0.11 | eb15c660c106a2be08afd07e6cdfce162272d6cc | |
hyperium/hyper | 1,325 | hyperium__hyper-1325 | [
"1315"
] | 971864c424495e9dd4cafe6c7fb4c7504a01e03d | diff --git a/Cargo.toml b/Cargo.toml
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -28,6 +28,7 @@ language-tags = "0.2"
log = "0.3"
mime = "0.3.2"
percent-encoding = "1.0"
+relay = "0.1"
time = "0.1"
tokio-core = "0.1.6"
tokio-proto = "0.1"
diff --git a/src/client/pool.rs b/src/client/pool.rs
--- a/src/client/pool.rs
+++ ... | diff --git a/src/client/pool.rs b/src/client/pool.rs
--- a/src/client/pool.rs
+++ b/src/client/pool.rs
@@ -364,4 +408,30 @@ mod tests {
})).map(|(entry, _)| entry);
assert_eq!(*checkout.wait().unwrap(), *pooled1);
}
+
+ #[test]
+ fn test_pool_checkout_drop_cleans_up_parked() {
+ futu... | Memory leak when using client.clone() for server (proxy)
I'm writing a reverse proxy and use the HTTP client to connect to any upstream server. Code is in https://github.com/klausi/rustnish/blob/goal-06/src/lib.rs#L150 . The server is leaking memory so I must be doing something wrong.
Steps to reproduce:
1. Make ... | The `Client` contains a pool of connections internally. Are the requests to different hosts? The pool is lazy about ejecting expired connections, so that could be part of it...
The requests are always to the same host, http://localhost/ in this example. I will try to find out what happens on a cloned client and what ex... | 2017-09-18T20:30:32Z | 0.11 | eb15c660c106a2be08afd07e6cdfce162272d6cc |
hyperium/hyper | 1,259 | hyperium__hyper-1259 | [
"1257"
] | 5f47d72347231c60a953c228abec75b077e99f8d | diff --git a/src/http/conn.rs b/src/http/conn.rs
--- a/src/http/conn.rs
+++ b/src/http/conn.rs
@@ -7,10 +7,10 @@ use futures::task::Task;
use tokio_io::{AsyncRead, AsyncWrite};
use tokio_proto::streaming::pipeline::{Frame, Transport};
-use header::{ContentLength, TransferEncoding};
use http::{self, Http1Transactio... | diff --git a/src/http/h1/parse.rs b/src/http/h1/parse.rs
--- a/src/http/h1/parse.rs
+++ b/src/http/h1/parse.rs
@@ -421,63 +444,83 @@ mod tests {
fn test_decoder_request() {
use super::Decoder;
+ let method = &mut None;
let mut head = MessageHead::<::http::RequestLine>::default();
... | Response without a body receives `Transfer-Encoding: chunked`
I want a server to make a `304 Not Modified` response like this:
```rust
Response::new()
.with_status(StatusCode::NotModified)
.with_header(ETag(etag))
.with_header(LastModified(last_modified))
```
My problem is *hyper* ... | It's a bug in hyper. I've been working on this week actually, to better handle when message shouldn't have bodies. Besides 304, also 204, and also when the request verb would not allow a response body, like `HEAD` or `CONNECT`. | 2017-07-13T19:19:31Z | 0.11 | eb15c660c106a2be08afd07e6cdfce162272d6cc |
hyperium/hyper | 1,182 | hyperium__hyper-1182 | [
"650"
] | 97abb81b3cc271a6dd258da86559bc25ab77c652 | diff --git a/src/header/common/mod.rs b/src/header/common/mod.rs
--- a/src/header/common/mod.rs
+++ b/src/header/common/mod.rs
@@ -57,6 +57,7 @@ pub use self::transfer_encoding::TransferEncoding;
pub use self::upgrade::{Upgrade, Protocol, ProtocolName};
pub use self::user_agent::UserAgent;
pub use self::vary::Vary;
... | diff --git /dev/null b/src/header/common/link.rs
new file mode 100644
--- /dev/null
+++ b/src/header/common/link.rs
@@ -0,0 +1,1110 @@
+use std::fmt;
+use std::borrow::Cow;
+use std::str::FromStr;
+use std::ascii::AsciiExt;
+
+use mime::Mime;
+use language_tags::LanguageTag;
+
+use header::parsing;
+use header::{Header... | Link header
Currently, as far as I know there's no facility to parse and generate Link headers,
It would be very useful if we had one, many APIs (including github) uses it to navigate.
Do we plan to add support for it?
http://www.w3.org/wiki/LinkHeader
http://www.rfc-editor.org/rfc/rfc5988.txt
| Sounds fine to me.
It seems like this header is more complicated than others, just by judging it's ABNF:
``` ABNF
Link = "Link" ":" #link-value
link-value = "<" URI-Reference ">" *( ";" link-param )
link-param = ( ( "rel" "=" relation-types )
| ( "anchor" "=" <"> URI-Reference <"> )
... | 2017-05-18T22:47:39Z | 0.10 | 97abb81b3cc271a6dd258da86559bc25ab77c652 |
hyperium/hyper | 1,178 | hyperium__hyper-1178 | [
"1176"
] | 33eb8f95a3537cfd02aa4956a69dedd0c840a604 | diff --git a/src/uri.rs b/src/uri.rs
--- a/src/uri.rs
+++ b/src/uri.rs
@@ -213,9 +213,8 @@ fn parse_scheme(s: &str) -> Option<usize> {
fn parse_authority(s: &str) -> usize {
let i = s.find("://").map(|p| p + 3).unwrap_or(0);
- s[i..].find('/')
- .or_else(|| s[i..].find('?'))
- .or_else(|| s[i..... | diff --git a/src/uri.rs b/src/uri.rs
--- a/src/uri.rs
+++ b/src/uri.rs
@@ -537,6 +536,28 @@ test_parse! {
port = None,
}
+test_parse! {
+ test_uri_parse_absolute_form_with_empty_path_and_fragment_with_slash,
+ "http://127.0.0.1#foo/bar",
+ scheme = Some("http"),
+ authority = Some("127.0.0.1"),
+ ... | hyper::Uri doesn't parse Uris with empty path well
Problem:
Latest master
hyper::Uri thinks `https://google.com#ab/cd` has a host `google.com#ab`, while it should have a host `google.com`.
hyper::Uri is okay with `https://google.com/#ab/cd`.
| 2017-05-17T11:42:58Z | 0.11 | eb15c660c106a2be08afd07e6cdfce162272d6cc | |
hyperium/hyper | 1,162 | hyperium__hyper-1162 | [
"1155"
] | df1095dfe79e199128bd605777dd0f3e58487e46 | diff --git a/src/client/mod.rs b/src/client/mod.rs
--- a/src/client/mod.rs
+++ b/src/client/mod.rs
@@ -22,19 +22,19 @@ pub use tokio_service::Service;
use header::{Headers, Host};
use http::{self, TokioBody};
+use http::response;
+use http::request;
use method::Method;
use self::pool::{Pool, Pooled};
use uri::{s... | diff --git a/tests/server.rs b/tests/server.rs
--- a/tests/server.rs
+++ b/tests/server.rs
@@ -503,7 +503,7 @@ fn test_server_disable_keep_alive() {
.status(hyper::Ok)
.header(hyper::header::ContentLength(quux.len() as u64))
.body(quux);
-
+
let _ = req.write_all(b"\
GET /qu... | Unite Request and Response types
Currently, `client::Request` is a different type from `server::Request`, and `client::Response` is different from `server::Response`.
We want to unite them into the same type. That dramatically improves generic middleware that could apply on both a server and a client, and makes thin... | 2017-05-01T18:43:59Z | 0.11 | eb15c660c106a2be08afd07e6cdfce162272d6cc | |
hyperium/hyper | 1,152 | hyperium__hyper-1152 | [
"1145"
] | c3466bedf8bd634c9c1aba25a3790bf8ae5e89d7 | diff --git a/src/header/common/cookie.rs b/src/header/common/cookie.rs
--- a/src/header/common/cookie.rs
+++ b/src/header/common/cookie.rs
@@ -1,7 +1,10 @@
-use header::{Header, Raw};
-use std::fmt::{self, Display};
+use std::borrow::Cow;
+use std::fmt;
use std::str::from_utf8;
+use header::{Header, Raw};
+use heade... | diff --git a/src/header/common/cookie.rs b/src/header/common/cookie.rs
--- a/src/header/common/cookie.rs
+++ b/src/header/common/cookie.rs
@@ -59,16 +120,110 @@ impl Header for Cookie {
}
}
+impl PartialEq for Cookie {
+ fn eq(&self, other: &Cookie) -> bool {
+ if self.0.len() == other.0.len() {
+ ... | Cookie Header should be Map-like
We only ever receive headers like this: `Cookie: foo=bar; session=sean; hello=world`, and having that be a vector of `["foo=bar", "session=sean", "hello=world"]` doesn't really help anyone.
Instead, anyone needing to accept cookies would only be looking for a certain name anyways, so... | For implementation, something like the `VecMap` inside `Headers` would probably be best, since it performs faster and with less memory than a `HashMap` when the number of items is small. I can't imagine the `Cookie` header, in the common case, having that many key-value pairs.
So, it could look like:
```rust
pub... | 2017-04-26T20:25:54Z | 0.11 | eb15c660c106a2be08afd07e6cdfce162272d6cc |
hyperium/hyper | 1,147 | hyperium__hyper-1147 | [
"1065"
] | 1cd8ea36f33486c352b53cbbf92bba889077e85a | diff --git a/src/header/common/origin.rs b/src/header/common/origin.rs
--- a/src/header/common/origin.rs
+++ b/src/header/common/origin.rs
@@ -31,20 +31,39 @@ use header::parsing::from_one_raw_str;
/// );
/// ```
-#[derive(Clone, Debug)]
-pub struct Origin {
- /// The scheme, such as http or https
- scheme: C... | diff --git a/src/header/common/origin.rs b/src/header/common/origin.rs
--- a/src/header/common/origin.rs
+++ b/src/header/common/origin.rs
@@ -104,26 +129,24 @@ impl FromStr for Origin {
s => Cow::Owned(s.to_owned())
};
- Ok(Origin{
+ Ok(Origin(OriginOrNull::Origin {
... | Support Opaque origin headers, serializing it to `null`
Support Opaque origins:
> An internal value, with no serialization it can be recreated from (it is serialized as "null" per ASCII serialization of an origin), for which the only meaningful operation is testing for equality.
https://html.spec.whatwg.org/multi... | Sorry, in what context? The url? The `Origin` header?
The origin header.
I see. So it can either be `null`, or the full origin. It seems like any way to make this work with hyper's `Origin` header would require a breaking change. Since that's the case, my thinking is something like this, for inclusion in v0.11:
```r... | 2017-04-20T20:27:31Z | 0.11 | eb15c660c106a2be08afd07e6cdfce162272d6cc |
hyperium/hyper | 1,136 | hyperium__hyper-1136 | [
"1124"
] | 574ded90dd5bf52b2ea10420fe34379636b094bd | diff --git a/src/header/common/origin.rs b/src/header/common/origin.rs
--- a/src/header/common/origin.rs
+++ b/src/header/common/origin.rs
@@ -84,6 +84,9 @@ impl Header for Origin {
}
}
+static HTTP : &'static str = "http";
+static HTTPS : &'static str = "https";
+
impl FromStr for Origin {
type Err = ::E... | diff --git a/src/header/common/origin.rs b/src/header/common/origin.rs
--- a/src/header/common/origin.rs
+++ b/src/header/common/origin.rs
@@ -121,14 +128,26 @@ impl PartialEq for Origin {
mod tests {
use super::Origin;
use header::Header;
+ use std::borrow::Cow;
+
+ macro_rules! assert_borrowed{
+ ... | Reduce to_owned of scheme in Origin header
Now that the `scheme` propertry is a `Cow<'static, str>`, and the scheme is pretty much always only ever "http" or "https", we should compare for those and then store a `Cow::Borrowed("http")` etc, instead of calling `scheme.to_owned()`.
| 2017-04-13T22:20:32Z | 0.11 | eb15c660c106a2be08afd07e6cdfce162272d6cc | |
hyperium/hyper | 1,135 | hyperium__hyper-1135 | [
"1134"
] | f05a58a1b2288d30a601b0466bc08a38c5a76054 | diff --git a/src/http/conn.rs b/src/http/conn.rs
--- a/src/http/conn.rs
+++ b/src/http/conn.rs
@@ -610,6 +610,9 @@ impl<B, K: KeepAlive> State<B, K> {
}
fn busy(&mut self) {
+ if let KA::Disabled = self.keep_alive.status() {
+ return;
+ }
self.keep_alive.busy();
}
| diff --git a/tests/server.rs b/tests/server.rs
--- a/tests/server.rs
+++ b/tests/server.rs
@@ -146,10 +146,16 @@ fn connect(addr: &SocketAddr) -> TcpStream {
}
fn serve() -> Serve {
- serve_with_timeout(None)
+ serve_with_options(Default::default())
}
-fn serve_with_timeout(dur: Option<Duration>) -> Serve ... | Connection Keepalive
Hi, I'm currently using the hyper master branch. I have written a Service and want that the connection is dropped after each request. I thought that using "Http::keep_alive(false)" should close the connection? But that does not work. Is this a bug or do I use the wrong functionality?
| 2017-04-13T00:05:44Z | 0.11 | eb15c660c106a2be08afd07e6cdfce162272d6cc | |
hyperium/hyper | 1,116 | hyperium__hyper-1116 | [
"1111"
] | 6e55fbe75d0ac98b162b4f44f746df76d71a778a | diff --git a/src/http/io.rs b/src/http/io.rs
--- a/src/http/io.rs
+++ b/src/http/io.rs
@@ -55,31 +55,33 @@ impl<T: AsyncRead + AsyncWrite> Buffered<T> {
}
pub fn parse<S: Http1Transaction>(&mut self) -> ::Result<Option<MessageHead<S::Incoming>>> {
- self.reserve_read_buf();
- match self.read_f... | diff --git a/src/http/conn.rs b/src/http/conn.rs
--- a/src/http/conn.rs
+++ b/src/http/conn.rs
@@ -745,7 +745,6 @@ mod tests {
let mut conn = Conn::<_, http::Chunk, ServerTransaction>::new(io, Default::default());
conn.state.idle();
- assert!(conn.poll().unwrap().is_not_ready());
mat... | Example tokio client hangs when HTTP Response code is in its own packet
Steps to reproduce:
- Run nc -l -p 8081
- Run hyper/examples/client.rs http://localhost:8081/
- In the nc terminal, paste:
```
HTTP/1.1 200 OK
Hello World
```
- Press ^C
- This works fine.
Now repeat, but:
- Run nc -l -p 8081
- Run ... | 2017-04-05T22:23:25Z | 0.11 | eb15c660c106a2be08afd07e6cdfce162272d6cc | |
hyperium/hyper | 1,115 | hyperium__hyper-1115 | [
"1112"
] | 66ad619d6ece49a2325bf22f85fdecc9e3eda3c4 | diff --git a/src/uri.rs b/src/uri.rs
--- a/src/uri.rs
+++ b/src/uri.rs
@@ -3,6 +3,7 @@ use std::fmt::{Display, self};
use std::str::{self, FromStr};
use http::ByteStr;
+use bytes::{BufMut, BytesMut};
/// The Request-URI of a Request's StartLine.
///
diff --git a/src/uri.rs b/src/uri.rs
--- a/src/uri.rs
+++ b/sr... | diff --git a/src/http/h1/parse.rs b/src/http/h1/parse.rs
--- a/src/http/h1/parse.rs
+++ b/src/http/h1/parse.rs
@@ -344,7 +344,7 @@ mod tests {
let (req, len) = parse::<http::ServerTransaction, _>(&mut raw).unwrap().unwrap();
assert_eq!(len, expected_len);
assert_eq!(req.subject.0, ::Method::G... | Send invalid request line when there's no trailing slash in url
If url is requested without trailing slash like "http://www.google.com", '404 not found' is returned because Request line doesn't have Request URI like "GET HTTP/1.1".
It is ok if url is requested like "http://www.google.com/"
| 2017-04-05T21:26:06Z | 0.11 | eb15c660c106a2be08afd07e6cdfce162272d6cc | |
hyperium/hyper | 1,110 | hyperium__hyper-1110 | [
"1108"
] | d63b7de44f813696f8ec595d2f8f901526c1720e | diff --git a/src/http/io.rs b/src/http/io.rs
--- a/src/http/io.rs
+++ b/src/http/io.rs
@@ -134,15 +134,16 @@ impl<T: Write> Write for Buffered<T> {
fn flush(&mut self) -> io::Result<()> {
if self.write_buf.remaining() == 0 {
- Ok(())
+ self.io.flush()
} else {
... | diff --git a/src/http/conn.rs b/src/http/conn.rs
--- a/src/http/conn.rs
+++ b/src/http/conn.rs
@@ -827,6 +827,7 @@ mod tests {
assert!(conn.state.writing.is_queued());
assert!(conn.poll_complete().unwrap().is_ready());
assert!(!conn.state.writing.is_queued());
+ assert!... | Client doesn't appear to flush when waiting to read a response
I was implementing a custom I/O stream to send requests over and I saw that the request was never actually written when it was waiting for a response. Turns out I was accidentally enabling buffering on the abstraction I was using and so none of the data was... | Interesting! As `conn.poll_complete()` is called, we take that to mean to flush `Conn`s `write_buf` into the `io`, but then we don't actually call `io.flush()`. I assume that's the missing piece?
I think so yeah, that'd make sense. This came up w/ a custom `AsyncRead + AsyncWrite` implementation so a call to `io.flush(... | 2017-04-03T17:08:03Z | 0.11 | eb15c660c106a2be08afd07e6cdfce162272d6cc |
hyperium/hyper | 1,100 | hyperium__hyper-1100 | [
"1089"
] | e81184e53c5c59a6262201e212a04a772f089079 | diff --git a/examples/client.rs b/examples/client.rs
--- a/examples/client.rs
+++ b/examples/client.rs
@@ -24,8 +24,8 @@ fn main() {
}
};
- let url = hyper::Url::parse(&url).unwrap();
- if url.scheme() != "http" {
+ let url = url.parse::<hyper::Uri>().unwrap();
+ if url.scheme() != Some("htt... | diff --git a/benches/end_to_end.rs b/benches/end_to_end.rs
--- a/benches/end_to_end.rs
+++ b/benches/end_to_end.rs
@@ -28,7 +28,7 @@ fn get_one_at_a_time(b: &mut test::Bencher) {
let client = hyper::Client::new(&handle);
- let url: hyper::Url = format!("http://{}/get", addr).parse().unwrap();
+ let url: ... | Remove Url depedency
Now that `hyper::Uri` has sufficient parsing capability, and can represent any URI for the server or client, does it make sense to still also use the `Url` type? When looking at the rustdocs generated, it certainly looks confusing that there is both `Url` and `Uri` at the crate root. And issues lik... | At least for me in how I've worked with libs in the past it's pretty rare for me to have a parsed `Url` on hand. Typically I manage it via a string and then just pass it to a library (there's also typically very little manipulation of the URL as well).
I could go either way, but in some sense reducing the suite of p... | 2017-03-21T18:03:13Z | 0.11 | eb15c660c106a2be08afd07e6cdfce162272d6cc |
hyperium/hyper | 1,074 | hyperium__hyper-1074 | [
"1073"
] | dc97dd77f45486d9cb9a22a1859809c5af5579e2 | diff --git a/src/http/conn.rs b/src/http/conn.rs
--- a/src/http/conn.rs
+++ b/src/http/conn.rs
@@ -4,6 +4,7 @@ use std::marker::PhantomData;
use std::time::Instant;
use futures::{Poll, Async, AsyncSink, Stream, Sink, StartSend};
+use futures::task::Task;
use tokio::io::Io;
use tokio_proto::streaming::pipeline::{F... | diff --git a/src/http/conn.rs b/src/http/conn.rs
--- a/src/http/conn.rs
+++ b/src/http/conn.rs
@@ -605,14 +639,14 @@ impl<'a, T: fmt::Debug + 'a, B: AsRef<[u8]> + 'a> fmt::Debug for DebugFrame<'a,
#[cfg(test)]
mod tests {
- use futures::{Async, Stream, Sink};
+ use futures::{Async, Future, Stream, Sink};
... | Infinite loop if body sender is dropped
Originally [reported here](https://github.com/tokio-rs/tokio-core/issues/177#issuecomment-281574226) it looks like this code:
```rust
extern crate env_logger;
extern crate futures;
extern crate hyper;
use hyper::{Body, Error};
use hyper::server::{Request, Response};
us... | I've been looking in to trying to park and unpark a little less, but one thing here strikes me as odd: if the Sender hasn't sent anything, why would tokio try to flush again, especially if the previous flush already said it was complete?
IIRC "flush" in this case basically just happens pretty commonly, but @carllerche ... | 2017-02-23T00:36:01Z | 0.11 | eb15c660c106a2be08afd07e6cdfce162272d6cc |
hyperium/hyper | 1,054 | hyperium__hyper-1054 | [
"1041"
] | 04f169034a4bf34927a65408cf418dcfacfe15f0 | diff --git a/src/client/request.rs b/src/client/request.rs
--- a/src/client/request.rs
+++ b/src/client/request.rs
@@ -7,6 +7,7 @@ use http::{Body, RequestHead};
use method::Method;
use uri::Uri;
use version::HttpVersion;
+use std::str::FromStr;
/// A client request to a remote server.
pub struct Request {
diff ... | diff --git a/src/http/conn.rs b/src/http/conn.rs
--- a/src/http/conn.rs
+++ b/src/http/conn.rs
@@ -577,6 +577,8 @@ mod tests {
use super::{Conn, Writing};
use ::uri::Uri;
+ use std::str::FromStr;
+
#[test]
fn test_conn_init_read() {
let good_message = b"GET / HTTP/1.1\r\n\r\n".to_vec()... | Make Uri use MemSlice internally
| New version with internal enum.
There would also need to be a change in `http/h1/parse`, instead of using `req.path.unwrap().parse()`. Instead, we want to create a `Uri` using the related `MemSlice`. It could look like this:
```rust
let path = slice.slice(path_start..path_end);
// path was found to be utf8 by http... | 2017-02-09T19:49:24Z | 0.11 | eb15c660c106a2be08afd07e6cdfce162272d6cc |
hyperium/hyper | 1,038 | hyperium__hyper-1038 | [
"1026"
] | 5c890321ee2da727a814c18d4ee2df5eddd6720e | diff --git a/src/header/common/content_length.rs b/src/header/common/content_length.rs
--- a/src/header/common/content_length.rs
+++ b/src/header/common/content_length.rs
@@ -40,6 +40,7 @@ impl Header for ContentLength {
static NAME: &'static str = "Content-Length";
NAME
}
+
fn parse_header(... | diff --git a/src/header/common/retry_after.rs b/src/header/common/retry_after.rs
--- a/src/header/common/retry_after.rs
+++ b/src/header/common/retry_after.rs
@@ -141,9 +141,7 @@ impl Header for RetryAfter {
#[cfg(test)]
mod tests {
- extern crate httparse;
-
- use header::{Header, Headers};
+ use header::... | Raw is now using Memslice
Fixes #1024.
I still need to find where I made a mistake to fix the tests. (And add some tests as well)
| 2017-01-27T19:09:33Z | 0.11 | eb15c660c106a2be08afd07e6cdfce162272d6cc | |
hyperium/hyper | 1,014 | hyperium__hyper-1014 | [
"1000"
] | b64665635ff3a5dc7f47a2ed847d7a98e1f1eb67 | diff --git a/examples/server.rs b/examples/server.rs
--- a/examples/server.rs
+++ b/examples/server.rs
@@ -23,12 +23,12 @@ impl Service for Echo {
fn call(&self, req: Request) -> Self::Future {
::futures::finished(match (req.method(), req.path()) {
- (&Get, Some("/")) | (&Get, Some("/echo")) ... | diff --git a/src/http/conn.rs b/src/http/conn.rs
--- a/src/http/conn.rs
+++ b/src/http/conn.rs
@@ -574,6 +574,7 @@ mod tests {
use mock::AsyncIo;
use super::{Conn, Writing};
+ use ::uri::Uri;
#[test]
fn test_conn_init_read() {
diff --git a/src/http/conn.rs b/src/http/conn.rs
--- a/src/http/co... | Redesign the Uri type
There are a couple of things that a redesign could help with:
- Making it an opaque struct instead of an enum means fiddling with internals is no longer a breaking change
- It'd be best if we could create less copies when parsing out a URI
- To future-proof for when hyper supports HTTP2
We... | 2017-01-18T00:48:46Z | 0.11 | eb15c660c106a2be08afd07e6cdfce162272d6cc | |
hyperium/hyper | 994 | hyperium__hyper-994 | [
"993"
] | bef05bf2075cc0569213f8cad4cd1bf22cc4e736 | diff --git a/examples/hello.rs b/examples/hello.rs
--- a/examples/hello.rs
+++ b/examples/hello.rs
@@ -17,7 +17,7 @@ impl Service for Hello {
type Response = Response;
type Error = hyper::Error;
type Future = ::futures::Finished<Response, hyper::Error>;
- fn call(&mut self, _req: Request) -> Self::Fut... | diff --git a/src/client/connect.rs b/src/client/connect.rs
--- a/src/client/connect.rs
+++ b/src/client/connect.rs
@@ -344,7 +344,7 @@ mod tests {
fn test_non_http_url() {
let mut core = Core::new().unwrap();
let url = Url::parse("file:///home/sean/foo.txt").unwrap();
- let mut connector =... | tokio branch does not compile after tokio_service mutability change
i am gonna try to write a PR to fix this! here's the error for posterity.
```
error[E0053]: method `call` has an incompatible type for trait
--> src/client/connect.rs:81:5
|
81 | fn call(&mut self, url: Url) -> Self::Future {
| ... | 2017-01-10T00:05:57Z | 0.10 | 97abb81b3cc271a6dd258da86559bc25ab77c652 | |
hyperium/hyper | 971 | hyperium__hyper-971 | [
"969"
] | 17a7e2b0514d3cf8f0f072b7ebc972223a338dad | diff --git /dev/null b/src/body.rs
new file mode 100644
--- /dev/null
+++ b/src/body.rs
@@ -0,0 +1,81 @@
+//! The Hyper Body, which is a wrapper around the tokio_proto Body.
+//! This is used as the Body for a Server Request, Server Response,
+//! and also for a Client Request and Client Response.
+//! It is based on a... | diff --git a/src/client/request.rs b/src/client/request.rs
--- a/src/client/request.rs
+++ b/src/client/request.rs
@@ -73,38 +73,6 @@ pub fn split(req: Request) -> (RequestHead, Option<Body>) {
(req.head, req.body)
}
-pub trait IntoBody {
- fn into(self) -> Body;
-}
-
-impl IntoBody for Body {
- fn into(s... | [Tokio Branch] hyper::server::response::{ Body and IntoBody } are private, propose to expose publically
Currently, you can call `response.set_body()` with anything that implements `hyper::server::response::IntoBody`, and right now that is just `Body` itself, `Vec<u8>` and `&'static [u8]`.
In my application, I have m... | In general things are private because I'm being much more conservative with what is made public, so internal optimizations can be made without breaking people.
In this particular case, I didn't really like the idea of a `IntoBody` trait, but instead wanted `Into<Body>`. The `IntoBody` trait currently exists because ... | 2016-12-14T02:03:34Z | 0.10 | 97abb81b3cc271a6dd258da86559bc25ab77c652 |
hyperium/hyper | 920 | hyperium__hyper-920 | [
"882"
] | 588ef9d25242f6154294c0c9cc5966d886c0a0f3 | diff --git a/src/header/common/referrer_policy.rs b/src/header/common/referrer_policy.rs
--- a/src/header/common/referrer_policy.rs
+++ b/src/header/common/referrer_policy.rs
@@ -54,19 +54,23 @@ impl Header for ReferrerPolicy {
fn parse_header(raw: &Raw) -> ::Result<ReferrerPolicy> {
use self::ReferrerP... | diff --git a/src/header/common/referrer_policy.rs b/src/header/common/referrer_policy.rs
--- a/src/header/common/referrer_policy.rs
+++ b/src/header/common/referrer_policy.rs
@@ -90,3 +94,10 @@ fn test_parse_header() {
let e: ::Result<ReferrerPolicy> = Header::parse_header(&"foobar".into());
assert!(e.is_err(... | Referrer-Policy header should support multiple values
In order to support fallback policies when a subset of the full policies is supported (such as when a new policy is introduced in the specification), hyper's Referrer-Policy header should store the most recent value that is successfully parsed from the list of poten... | 2016-10-06T20:21:50Z | 0.10 | 97abb81b3cc271a6dd258da86559bc25ab77c652 | |
hyperium/hyper | 910 | hyperium__hyper-910 | [
"883"
] | 8b3c1206846cb96be780923952eafe0dde7850bf | diff --git a/src/header/common/mod.rs b/src/header/common/mod.rs
--- a/src/header/common/mod.rs
+++ b/src/header/common/mod.rs
@@ -58,6 +58,7 @@ pub use self::transfer_encoding::TransferEncoding;
pub use self::upgrade::{Upgrade, Protocol, ProtocolName};
pub use self::user_agent::UserAgent;
pub use self::vary::Vary;
... | diff --git /dev/null b/src/header/common/warning.rs
new file mode 100644
--- /dev/null
+++ b/src/header/common/warning.rs
@@ -0,0 +1,174 @@
+use std::fmt;
+use std::str::{FromStr};
+use header::{Header, HttpDate, Raw};
+use header::parsing::from_one_raw_str;
+
+/// `Warning` header, defined in [RFC7234](https://tools.i... | add Warning header
I would like to use the `Warning` header to warn users of deprecated API routes as proposed in this SO answer: http://stackoverflow.com/a/29623798.
Spec: https://tools.ietf.org/html/rfc7234#section-5.5
| 2016-09-05T17:55:06Z | 0.10 | 97abb81b3cc271a6dd258da86559bc25ab77c652 | |
hyperium/hyper | 899 | hyperium__hyper-899 | [
"896"
] | a228486a85d88eb10b03509228bd11937ad57261 | diff --git a/doc/guide/server.md b/doc/guide/server.md
--- a/doc/guide/server.md
+++ b/doc/guide/server.md
@@ -165,7 +165,7 @@ impl Handler<Http> for Text {
fn on_request(&mut self, req: Request<Http>) -> Next {
use hyper::RequestUri;
let path = match *req.uri() {
- RequestUri::Absolut... | diff --git a/.travis.yml b/.travis.yml
--- a/.travis.yml
+++ b/.travis.yml
@@ -22,7 +22,7 @@ script:
- ./.travis/readme.py
- cargo build --verbose $FEATURES
- cargo test --verbose $FEATURES
- - 'for f in ./doc/**/*.md; do rustdoc -L ./target/debug -L ./target/debug/deps --test $f; done'
+ - 'for f in ./doc/... | Add `path()` method to `server::Request`
``` rust
fn path(&self) -> Option<&str>
```
It'd need to check for a query string in the `AbsolutePath` variant.
| 2016-08-23T02:47:00Z | 0.10 | 97abb81b3cc271a6dd258da86559bc25ab77c652 | |
hyperium/hyper | 898 | hyperium__hyper-898 | [
"891"
] | 74136de9609e9e272e3fc2de1b6b939e629df093 | diff --git a/src/header/internals/cell.rs b/src/header/internals/cell.rs
--- a/src/header/internals/cell.rs
+++ b/src/header/internals/cell.rs
@@ -86,6 +86,20 @@ impl<V: ?Sized + Any + 'static> PtrMapCell<V> {
}.map(|val| &mut **val)
}
+ #[inline]
+ pub fn into_value(self, key: TypeId) -> Option<B... | diff --git a/src/header/mod.rs b/src/header/mod.rs
--- a/src/header/mod.rs
+++ b/src/header/mod.rs
@@ -751,6 +760,13 @@ mod tests {
assert_eq!(headers.get_raw("Content-length"), None);
}
+ #[test]
+ fn test_remove() {
+ let mut headers = Headers::new();
+ headers.set(ContentLength(10... | Headers should offer method to remove and return header
If I take a `Headers` by value (moving it into my function), I want to avoid copying them. For that reason it would be useful if either `Headers::remove` would return the popped item (as `HashMap::remove` does), or if a new method was added.
| (I'm willing to write a PR for this)
Hm, I agree with this entirely, 👍 . This would be a breaking change, since `remove` currently returns a `bool`, but it seems like the right one to make. As such, I'd aim it for master and not for the 0.9.x branch. Basically:
``` rust
fn remove<H: Header>(&mut self) -> Option<H>;
... | 2016-08-22T19:54:17Z | 0.10 | 97abb81b3cc271a6dd258da86559bc25ab77c652 |
hyperium/hyper | 875 | hyperium__hyper-875 | [
"870"
] | e5841365dd82ff7f594f24309b48ae692cb09cc5 | diff --git a/src/header/common/mod.rs b/src/header/common/mod.rs
--- a/src/header/common/mod.rs
+++ b/src/header/common/mod.rs
@@ -27,6 +27,7 @@ pub use self::content_disposition::{ContentDisposition, DispositionType, Disposi
pub use self::content_length::ContentLength;
pub use self::content_encoding::ContentEncoding... | diff --git /dev/null b/src/header/common/content_location.rs
new file mode 100644
--- /dev/null
+++ b/src/header/common/content_location.rs
@@ -0,0 +1,44 @@
+header! {
+ /// `Content-Location` header, defined in
+ /// [RFC7231](https://tools.ietf.org/html/rfc7231#section-3.1.4.2)
+ ///
+ /// The header can ... | Add Content-Location header
See https://tools.ietf.org/html/rfc7231#section-3.1.4.2
| I'd like to take a shot at this. ABNF from RFC here is:
```
Content-Location = absolute-URI / partial-URI
```
ABNF is exactly same as with `Referer` which is implemented as
```
header! {
// TODO Use URL
(Referer, "Referer") => [String]
// testcase
}
```
`/TODO:? Use URL/` is mentioned for `Location` an... | 2016-07-27T09:58:01Z | 0.10 | 97abb81b3cc271a6dd258da86559bc25ab77c652 |
hyperium/hyper | 873 | hyperium__hyper-873 | [
"806"
] | 50ccdaa7e7db574ec9890c220765ffd2da5e493b | diff --git a/doc/guide/server.md b/doc/guide/server.md
--- a/doc/guide/server.md
+++ b/doc/guide/server.md
@@ -1,30 +1,384 @@
% Server Guide
-# The `Handler`
+# Hello, World
-```ignore,no_run
-extern crate hyper;
-use hyper::server::{Handler, Request, Response, Decoder, Encoder, Next, HttpStream as Http};
+Let's s... | diff --git a/.travis.yml b/.travis.yml
--- a/.travis.yml
+++ b/.travis.yml
@@ -22,7 +22,7 @@ script:
- ./.travis/readme.py
- cargo build --verbose $FEATURES
- cargo test --verbose $FEATURES
- - 'for f in ./doc/**/*.md; do rustdoc --test $f; done'
+ - 'for f in ./doc/**/*.md; do rustdoc -L ./target/debug -L .... | Add a Server Guide
Add a guide on how to do more and more complicated things with the Server/Handler in `docs/guide/server.md`.
| So what sort of spec would you hold for this guide? like what points should it cover?
I could imagine the guide going in steps:
- Introduce the `Handler` trait. Such as show how to make a simple "Hello World" handler, like from the `examples/hello.rs`.
- Explain `WouldBlock`, and/or `try_read`/`try_write`, and repeati... | 2016-07-26T00:44:05Z | 0.10 | 97abb81b3cc271a6dd258da86559bc25ab77c652 |
hyperium/hyper | 867 | hyperium__hyper-867 | [
"859"
] | a22ae26cecf56b1a97b3d15bc57ac05a6231c8e6 | diff --git a/src/net.rs b/src/net.rs
--- a/src/net.rs
+++ b/src/net.rs
@@ -1,6 +1,7 @@
//! A collection of traits abstracting over Listeners and Streams.
use std::io::{self, Read, Write};
use std::net::{SocketAddr};
+use std::option;
use rotor::mio::tcp::{TcpStream, TcpListener};
use rotor::mio::{Selector, Token... | diff --git a/src/server/mod.rs b/src/server/mod.rs
--- a/src/server/mod.rs
+++ b/src/server/mod.rs
@@ -375,8 +403,3 @@ where F: FnMut(http::Control) -> H, H: Handler<T>, T: Transport {
self(ctrl)
}
}
-
-#[cfg(test)]
-mod tests {
-
-}
diff --git a/tests/server.rs b/tests/server.rs
--- a/tests/server.rs
++... | Listen on multiple addresses in async hyper
Given that hyper is now async it would be great to be able to easily have a single server listen on multiple addresses.
It's already possible to get the local address of a connection via `Request::transport`.
It's not possible to implement your own `Transport` to do this as... | Interesting. Your proposed use case is to listen on port 80 and 443 in the same event loop?
At the moment I just want to listen for http on multiple IPV4 and 6 addresses. That just seemed like a natural extension.
While I have personal feelings on having an app run on both 80 and 443 together (I'd be that the http li... | 2016-07-18T07:04:45Z | 0.10 | 97abb81b3cc271a6dd258da86559bc25ab77c652 |
hyperium/hyper | 857 | hyperium__hyper-857 | [
"848"
] | 220d09fc3a68cdd9a10589b2b454b54312518bb3 | diff --git a/examples/client.rs b/examples/client.rs
--- a/examples/client.rs
+++ b/examples/client.rs
@@ -48,7 +48,7 @@ impl hyper::client::Handler<HttpStream> for Dump {
Err(e) => match e.kind() {
io::ErrorKind::WouldBlock => Next::read(),
_ => {
- pri... | diff --git a/src/http/conn.rs b/src/http/conn.rs
--- a/src/http/conn.rs
+++ b/src/http/conn.rs
@@ -943,22 +956,13 @@ impl<'a, K: Key + 'a> Seed<'a, K> {
pub trait MessageHandlerFactory<K: Key, T: Transport> {
type Output: MessageHandler<T>;
- fn create(&mut self, seed: Seed<K>) -> Self::Output;
-}
+ fn cr... | Client panics with 'handler not in queue for key'
Using latest master. I have a `Client` that sends HTTP POST requests to the same URL from multiple threads and sometime this happens:
```
2016-06-29 19:39:49 TRACE:hyper::client: on_incoming MessageHead { version: Http11, subject: RawStatus(200, "OK"), headers: Headers... | I'm still getting this error on 220d09f:
```
thread 'hyper-client' panicked at 'handler not in queue for key', ../src/libcore/option.rs:699
stack backtrace:
1: 0x101062fab - std::sys::backtrace::tracing::imp::write::h3800f45f421043b8
2: 0x101065135 - std::panicking::default_hook::_$u7b$$u7b$closure... | 2016-07-13T19:24:29Z | 0.9 | 220d09fc3a68cdd9a10589b2b454b54312518bb3 |
hyperium/hyper | 856 | hyperium__hyper-856 | [
"848"
] | 5f273ef646a9e7b7154ecd52b1f65388b77ea422 | diff --git a/src/client/mod.rs b/src/client/mod.rs
--- a/src/client/mod.rs
+++ b/src/client/mod.rs
@@ -5,6 +5,7 @@
use std::collections::HashMap;
use std::fmt;
+use std::io;
use std::marker::PhantomData;
use std::sync::mpsc;
use std::thread;
diff --git a/src/client/mod.rs b/src/client/mod.rs
--- a/src/client/mod... | diff --git a/src/http/mod.rs b/src/http/mod.rs
--- a/src/http/mod.rs
+++ b/src/http/mod.rs
@@ -410,6 +411,19 @@ impl Next {
}
}
+impl Next_ {
+ fn register(&self) -> Reg {
+ match *self {
+ Next_::Read => Reg::Read,
+ Next_::Write => Reg::Write,
+ Next_::ReadWrite => R... | Client panics with 'handler not in queue for key'
Using latest master. I have a `Client` that sends HTTP POST requests to the same URL from multiple threads and sometime this happens:
```
2016-06-29 19:39:49 TRACE:hyper::client: on_incoming MessageHead { version: Http11, subject: RawStatus(200, "OK"), headers: Headers... | 2016-07-08T17:16:53Z | 0.9 | 220d09fc3a68cdd9a10589b2b454b54312518bb3 | |
hyperium/hyper | 853 | hyperium__hyper-853 | [
"651"
] | b47affd94b1ca53d04642202728f194a1ceec04d | diff --git a/src/header/common/host.rs b/src/header/common/host.rs
--- a/src/header/common/host.rs
+++ b/src/header/common/host.rs
@@ -1,6 +1,8 @@
use header::{Header, HeaderFormat};
use std::fmt;
+use std::str::FromStr;
use header::parsing::from_one_raw_str;
+use url::idna::domain_to_unicode;
/// The `Host` head... | diff --git a/src/header/common/host.rs b/src/header/common/host.rs
--- a/src/header/common/host.rs
+++ b/src/header/common/host.rs
@@ -97,6 +62,35 @@ impl HeaderFormat for Host {
}
}
+impl fmt::Display for Host {
+ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ self.fmt_header(f)
+ }
+}
+... | Origin Header
It seems like the "Origin" header is missing [here](http://hyper.rs/hyper/hyper/header/index.html)
http://tools.ietf.org/id/draft-abarth-origin-03.html
| Is this in common use? I've never used it myself, and when checking the dev consoles, I notice neither Firefox nor Chrome set that header while browsing.
The Origin header is set for CORS requests.
On 15 October 2015 01:36:27 CEST, Sean McArthur notifications@github.com wrote:
> Is this in common use? I've never use... | 2016-07-06T20:03:14Z | 0.9 | 220d09fc3a68cdd9a10589b2b454b54312518bb3 |
hyperium/hyper | 845 | hyperium__hyper-845 | [
"843"
] | e682844431f9d3e83f9dfc8bd5f7ef873b8a9b16 | diff --git a/examples/hello.rs b/examples/hello.rs
--- a/examples/hello.rs
+++ b/examples/hello.rs
@@ -14,7 +14,7 @@ static PHRASE: &'static [u8] = b"Hello World!";
struct Hello;
impl Handler<HttpStream> for Hello {
- fn on_request(&mut self, _: Request) -> Next {
+ fn on_request(&mut self, _: Request<HttpStr... | diff --git a/tests/server.rs b/tests/server.rs
--- a/tests/server.rs
+++ b/tests/server.rs
@@ -99,7 +99,7 @@ impl TestHandler {
}
impl Handler<HttpStream> for TestHandler {
- fn on_request(&mut self, _req: Request) -> Next {
+ fn on_request(&mut self, _req: Request<HttpStream>) -> Next {
//self.tx.se... | Remote Address Might Not Always Available
So looking more carefully at how hyper does its thing it looks like the remote address (from the transport) might not always be available.
In the case of a GET request there likely won't be a body and it looks like https://github.com/hyperium/hyper/blob/master/src/server/mod.r... | I've also simply felt that it'd be better to have access to the `Transport` in the `on_request` event. So to do this, I've been thinking of adding a `&'a T` field to the `Request` struct.
``` rust
fn on_request<'a>(&mut self, req: Request<'a>) -> Next {
let addr = req.transport().peer_addr().unwrap();
}
```
I won... | 2016-06-23T22:29:49Z | 0.9 | 220d09fc3a68cdd9a10589b2b454b54312518bb3 |
hyperium/hyper | 841 | hyperium__hyper-841 | [
"833",
"821"
] | 6dab63fbac546fee78dadad20ec2617c7396f15a | diff --git a/src/header/internals/item.rs b/src/header/internals/item.rs
--- a/src/header/internals/item.rs
+++ b/src/header/internals/item.rs
@@ -78,6 +78,9 @@ impl Item {
Err(_) => ()
}
}
+ if self.raw.is_some() && self.typed.get_mut(tid).is_some() {
+ self.raw... | diff --git a/src/header/mod.rs b/src/header/mod.rs
--- a/src/header/mod.rs
+++ b/src/header/mod.rs
@@ -670,6 +670,7 @@ mod tests {
fn test_get_mutable() {
let mut headers = Headers::from_raw(&raw!(b"Content-Length: 10")).unwrap();
*headers.get_mut::<ContentLength>().unwrap() = ContentLength(20);
... | Kill raw part when getting mutable reference to typed header
Fixes #821.
get_mut doesn't seem to work
I'm not sure what happened here:
``` rust
extern crate hyper;
use hyper::header::Headers;
use hyper::header::{ContentLength, ContentType};
use hyper::http::RawStatus;
use hyper::method::Method;
use hyper::mime::{Attr... |
I guess the mixture of raw and non-raw methods is breaking it, but I'm not sure. Does set_raw create two copies of the thing -- one typed, one untyped?
I guess the issue is that typed_mut doesn't remove the header from the raw headers when inserting a typed one.
Ah, this is a bug. The invariants I've been enforcing ... | 2016-06-20T22:13:45Z | 0.9 | 220d09fc3a68cdd9a10589b2b454b54312518bb3 |
hyperium/hyper | 834 | hyperium__hyper-834 | [
"831"
] | 43ac0dd09569f80625f7875ff27543bfaf339b99 | diff --git a/src/http/conn.rs b/src/http/conn.rs
--- a/src/http/conn.rs
+++ b/src/http/conn.rs
@@ -646,13 +646,6 @@ impl<H: MessageHandler<T>, T: Transport> State<H, T> {
_ => Reading::Closed,
};
let writing = match http1.writing {
- Writing::Rea... | diff --git a/src/http/h1/encode.rs b/src/http/h1/encode.rs
--- a/src/http/h1/encode.rs
+++ b/src/http/h1/encode.rs
@@ -335,7 +347,7 @@ mod tests {
use mock::{Async, Buf};
#[test]
- fn test_write_chunked_sync() {
+ fn test_chunked_encode_sync() {
let mut dst = Buf::new();
let mut enco... | Client needs a way to "end" writing chunked requests
| This cannot be `Next::end()`, as that signals the entire message is complete. There is need to signal "writing is done, but I still want to read from the server".
Some options I've thought of:
- Make the Handler write with zero bytes if chunked, ie `encoder.write(b"")`
- Add a method to `Encoder<T>`, such that the han... | 2016-06-17T11:08:53Z | 0.9 | 220d09fc3a68cdd9a10589b2b454b54312518bb3 |
hyperium/hyper | 827 | hyperium__hyper-827 | [
"804"
] | f20d5953c775868a139f3f55e7774cbbd6425dbf | diff --git a/src/http/buffer.rs b/src/http/buffer.rs
--- a/src/http/buffer.rs
+++ b/src/http/buffer.rs
@@ -98,6 +98,12 @@ pub struct BufReader<'a, R: io::Read + 'a> {
reader: &'a mut R
}
+impl<'a, R: io::Read + 'a> BufReader<'a, R> {
+ pub fn get_ref(&self) -> &R {
+ self.reader
+ }
+}
+
impl<'a, ... | diff --git a/src/client/pool.rs /dev/null
--- a/src/client/pool.rs
+++ /dev/null
@@ -1,291 +0,0 @@
-//! Client Connection Pooling
-use std::borrow::ToOwned;
-use std::collections::HashMap;
-use std::io::{self, Read, Write};
-use std::net::{SocketAddr, Shutdown};
-use std::sync::{Arc, Mutex};
-
-use std::time::Duration;... | Remote Address not set in Request
The remote_addr member of hyper::server::Request is commented out and not yet set on each request. Presumably https://github.com/hyperium/hyper/blob/master/src/server/request.rs#L19 is commented out as a placeholder to be done for 0.10.
Just making an issue so its not forgotten :+1:
... | 2016-06-14T15:04:58Z | 0.9 | 220d09fc3a68cdd9a10589b2b454b54312518bb3 | |
hyperium/hyper | 778 | hyperium__hyper-778 | [
"395"
] | 1ec56fe6b68ecf74213cf7e285f80c3a4ee70ce9 | diff --git a/.travis.yml b/.travis.yml
--- a/.travis.yml
+++ b/.travis.yml
@@ -3,6 +3,8 @@ matrix:
fast_finish: true
include:
- os: osx
+ rust: stable
+ env: FEATURES="--no-default-features --features security-framework"
- rust: nightly
env: FEATURES="--features ... | diff --git a/benches/client.rs /dev/null
--- a/benches/client.rs
+++ /dev/null
@@ -1,111 +0,0 @@
-#![deny(warnings)]
-#![feature(test)]
-extern crate hyper;
-
-extern crate test;
-
-use std::fmt;
-use std::io::{self, Read, Write, Cursor};
-use std::net::SocketAddr;
-use std::time::Duration;
-
-use hyper::net;
-
-static... | Non-blocking/Evented I/O
Hyper would be far more powerful of a client & server if it was based on traditional event-oriented I/O, single-threaded or multi-threaded. You should look into https://github.com/carllerche/mio or a wrapper around libuv or something of that sort.
Another option is to split hyper up into mult... | We agree. We're actively looking into it. Mio looks promising. We also need
a Windows library, and a wrapper combining the two.
On Tue, Mar 24, 2015, 6:06 AM Jarred Nicholls notifications@github.com
wrote:
> Hyper would be far more powerful of a client & server if it was based on
> traditional event-oriented I/O, sin... | 2016-05-04T19:40:53Z | 0.9 | 220d09fc3a68cdd9a10589b2b454b54312518bb3 |
hyperium/hyper | 775 | hyperium__hyper-775 | [
"774"
] | 3a3e08687b9711edcc2d08e1f307805322ff68bb | diff --git a/examples/client.rs b/examples/client.rs
--- a/examples/client.rs
+++ b/examples/client.rs
@@ -20,7 +20,20 @@ fn main() {
}
};
- let client = Client::new();
+ let client = match env::var("HTTP_PROXY") {
+ Ok(mut proxy) => {
+ // parse the proxy, message if it doesn't ... | diff --git a/src/client/mod.rs b/src/client/mod.rs
--- a/src/client/mod.rs
+++ b/src/client/mod.rs
@@ -479,8 +483,9 @@ mod tests {
use std::io::Read;
use header::Server;
use http::h1::Http11Message;
- use mock::{MockStream};
+ use mock::{MockStream, MockSsl};
use super::{Client, RedirectPolicy... | Proxy handling does not properly set destination Host header
Here is a script transcript of a working proxy session
```
Script started on Wed 27 Apr 2016 09:32:58 AM PDT
[~/repos/rust/hyper-upstream]
~$ telnet my-proxy 8080
Trying x.x.x.x...
Connected to my-proxy.
Escape character is '^]'.
GET http://xkcd.com http/1.1... | I see, I misunderstood the spec. I understood that the `Host` header is the host of the proxy server, with the absolute-uri in the request line aimed at the target host. Re-reading the spec, it seems I am indeed incorrect, as HTTP/1.0 proxies may just forward the `Host` header directly.
It may be that the proxy you ar... | 2016-04-27T18:21:16Z | 0.9 | 220d09fc3a68cdd9a10589b2b454b54312518bb3 |
hyperium/hyper | 771 | hyperium__hyper-771 | [
"531"
] | 4828437551c7f5ed3f54acb1c1bf1fd50a6a3516 | diff --git a/src/client/mod.rs b/src/client/mod.rs
--- a/src/client/mod.rs
+++ b/src/client/mod.rs
@@ -55,9 +55,9 @@
//! clone2.post("http://example.domain/post").body("foo=bar").send().unwrap();
//! });
//! ```
+use std::borrow::Cow;
use std::default::Default;
use std::io::{self, copy, Read};
-use std::iter::... | diff --git a/src/client/mod.rs b/src/client/mod.rs
--- a/src/client/mod.rs
+++ b/src/client/mod.rs
@@ -456,6 +478,8 @@ fn get_host_and_port(url: &Url) -> ::Result<(&str, u16)> {
mod tests {
use std::io::Read;
use header::Server;
+ use http::h1::Http11Message;
+ use mock::{MockStream};
use super::{... | Add Proxy support to Client
I imagine some sort of `Proxy` type being added a property of `Client`, with a corresponding `set_proxy(Option<Proxy>)` method.
Use of a proxy can have different requirements: all requests, only https requests, only http... So it would probably mean `Proxy` would be an enum... and the proxy... | It would be awesome to have this feature!
Yes please. Some of us need this to use Rust at work.
Something like:
```
let mut client = Client::new();
// after checking config, env for HTTP_PROXY, whatever
let proxy = Proxy::new(server, port, scheme); // AuthProxy::new for the more complicated cases
client.add_proxy(p... | 2016-04-25T22:51:19Z | 0.9 | 220d09fc3a68cdd9a10589b2b454b54312518bb3 |
hyperium/hyper | 750 | hyperium__hyper-750 | [
"747"
] | c85b056cabd1bbe62340af03696810c7e155fe17 | diff --git a/src/header/common/mod.rs b/src/header/common/mod.rs
--- a/src/header/common/mod.rs
+++ b/src/header/common/mod.rs
@@ -44,6 +44,8 @@ pub use self::if_range::IfRange;
pub use self::last_modified::LastModified;
pub use self::location::Location;
pub use self::pragma::Pragma;
+pub use self::prefer::{Prefer, ... | diff --git /dev/null b/src/header/common/prefer.rs
new file mode 100644
--- /dev/null
+++ b/src/header/common/prefer.rs
@@ -0,0 +1,203 @@
+use std::fmt;
+use std::str::FromStr;
+use header::{Header, HeaderFormat};
+use header::parsing::{from_comma_delimited, fmt_comma_delimited};
+
+/// `Prefer` header, defined in [RFC... | Add prefer header
I'd like to use the [`Prefer`](http://tools.ietf.org/html/rfc7240) header, could types for this header be added?
| This is the first I've heard of this header. Is there a situation where its usage is common?
If you look at the [PostgREST](http://postgrest.com/api/reading/) project you'll see it's being used to suppress counts and in a few other cases. The [spec](http://tools.ietf.org/html/rfc7240#section-2.1) also gives some inter... | 2016-03-24T18:12:17Z | 0.8 | c85b056cabd1bbe62340af03696810c7e155fe17 |
hyperium/hyper | 743 | hyperium__hyper-743 | [
"683"
] | 028f5864324f95d4d9007c304358b6e7b91743fc | diff --git a/src/header/common/cache_control.rs b/src/header/common/cache_control.rs
--- a/src/header/common/cache_control.rs
+++ b/src/header/common/cache_control.rs
@@ -1,7 +1,7 @@
use std::fmt;
use std::str::FromStr;
use header::{Header, HeaderFormat};
-use header::parsing::{from_one_comma_delimited, fmt_comma_de... | diff --git a/src/header/common/content_length.rs b/src/header/common/content_length.rs
--- a/src/header/common/content_length.rs
+++ b/src/header/common/content_length.rs
@@ -79,7 +79,16 @@ __hyper__tm!(ContentLength, tests {
test_header!(test1, vec![b"3495"], Some(HeaderField(3495)));
test_header!(test_inv... | Response with multiple `Transfer-Encoding: chunked` header fields not parsed as chunk
I've adapted this code from `client/response.rs`:
``` rust
fn main() {
let stream = MockStream::with_input(b"\
HTTP/1.1 200 OK\r\n\
Transfer-Encoding: chunked\r\n\
Transfer-Encoding: chunked\r\n\
\... | Indeed, it would seem the bug is in the parsing of the `TransferEncoding` header. It should handle more than 1 field occurrence.
@seanmonstar I'm running into this issue myself, but I'm not sure how/where to best fix it. Any pointers where I should start looking?
This occurs in the parsing. `TransferEncoding` uses [... | 2016-03-11T20:08:29Z | 0.8 | c85b056cabd1bbe62340af03696810c7e155fe17 |
hyperium/hyper | 718 | hyperium__hyper-718 | [
"715"
] | a4230eb510224b3a52e0f2d616fade8f0e8313b9 | diff --git a/src/buffer.rs b/src/buffer.rs
--- a/src/buffer.rs
+++ b/src/buffer.rs
@@ -79,7 +79,7 @@ unsafe fn grow_zerofill(buf: &mut Vec<u8>, additional: usize) {
use std::ptr;
let len = buf.len();
buf.set_len(len + additional);
- ptr::write_bytes(buf.as_mut_ptr(), 0, buf.len());
+ ptr::write_byt... | diff --git a/src/buffer.rs b/src/buffer.rs
--- a/src/buffer.rs
+++ b/src/buffer.rs
@@ -151,4 +151,14 @@ mod tests {
assert_eq!(rdr.pos, 0);
assert_eq!(rdr.cap, 0);
}
+
+ #[test]
+ fn test_resize() {
+ let raw = b"hello world";
+ let mut rdr = BufReader::with_capacity(&raw[..],... | Odd error when unwrapping a response
I'm getting a weird error when trying to get data from this API. Any help would be appreciated.
``` rust
let client = Client::new();
let mut res = client.get(&"https://data.medicare.gov/resource/pqp8-xrjv.json?$limit=1".to_string())
.send().unwrap();
```
```
thread '<main>' pani... | Hm, what version of hyper? I just tried that URL using https://github.com/hyperium/hyper/blob/master/examples/client.rs and it worked for me.
Was on 0.6 when I posted the issue. Updated to 0.7 and still getting the same thing.
Here's the log incase it helps
```
TRACE:hyper::header: Headers.set( "Connection", Connec... | 2016-01-04T23:01:42Z | 0.7 | a4230eb510224b3a52e0f2d616fade8f0e8313b9 |
hyperium/hyper | 699 | hyperium__hyper-699 | [
"698"
] | 3f1b13c72d925b80601ab5468dbe36273622b451 | diff --git a/src/server/request.rs b/src/server/request.rs
--- a/src/server/request.rs
+++ b/src/server/request.rs
@@ -9,7 +9,7 @@ use std::time::Duration;
use buffer::BufReader;
use net::NetworkStream;
use version::{HttpVersion};
-use method::Method::{self, Get, Head};
+use method::Method;
use header::{Headers, Co... | diff --git a/src/server/request.rs b/src/server/request.rs
--- a/src/server/request.rs
+++ b/src/server/request.rs
@@ -159,6 +157,24 @@ mod tests {
assert_eq!(read_to_string(req).unwrap(), "".to_owned());
}
+ #[test]
+ fn test_get_with_body() {
+ let mut mock = MockStream::with_input(b"\
+ ... | Request body should be allowed with GET/HEAD requests
Currently, the body is ignored when the request method is either GET or HEAD.
I had a look through the HTTP 1.1 spec and didn't find any mention of restricting request bodies to certian methods (http://www.w3.org/Protocols/rfc2616/rfc2616-sec4.html#sec4.3).
I hav... | 2616 has been [superseded](https://www.mnot.net/blog/2014/06/07/rfc2616_is_dead). See http://tools.ietf.org/html/rfc7231#section-4.3.2 for the relevant MUST NOT.
| 2015-11-29T17:10:41Z | 0.7 | a4230eb510224b3a52e0f2d616fade8f0e8313b9 |
hyperium/hyper | 693 | hyperium__hyper-693 | [
"655"
] | 072d4fe36af21e1551316242ba5ebb5a011d38ca | diff --git a/src/header/common/mod.rs b/src/header/common/mod.rs
--- a/src/header/common/mod.rs
+++ b/src/header/common/mod.rs
@@ -7,6 +7,7 @@
//! is used, such as `ContentType(pub Mime)`.
pub use self::accept::Accept;
+pub use self::access_control_allow_credentials::AccessControlAllowCredentials;
pub use self::ac... | diff --git /dev/null b/src/header/common/access_control_allow_credentials.rs
new file mode 100644
--- /dev/null
+++ b/src/header/common/access_control_allow_credentials.rs
@@ -0,0 +1,89 @@
+use std::fmt::{self, Display};
+use std::str;
+use unicase::UniCase;
+use header::{Header, HeaderFormat};
+
+/// `Access-Control-A... | Access-Control-Allow-Credentials header
the Access-Control-Allow-Credentials header is missing
http://www.w3.org/TR/2008/WD-access-control-20080912/#access-control-allow-credentials
ABNF:
```
Access-Control-Allow-Credentials: "Access-Control-Allow-Credentials" ":" "true"
```
| 2015-11-22T08:55:39Z | 0.6 | 072d4fe36af21e1551316242ba5ebb5a011d38ca | |
hyperium/hyper | 687 | hyperium__hyper-687 | [
"686"
] | d44ee5980f744b34bc33ad34b1ae2cafcf7ad6e7 | diff --git a/Cargo.toml b/Cargo.toml
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -25,11 +25,11 @@ unicase = "1.0"
url = "0.2"
[dependencies.cookie]
-version = "0.1"
+version = "0.2"
default-features = false
[dependencies.openssl]
-version = "0.6.4"
+version = "0.7"
optional = true
[dependencies.solicit]
diff --git... | diff --git a/src/header/common/set_cookie.rs b/src/header/common/set_cookie.rs
--- a/src/header/common/set_cookie.rs
+++ b/src/header/common/set_cookie.rs
@@ -142,7 +140,7 @@ impl SetCookie {
#[test]
fn test_parse() {
let h = Header::parse_header(&[b"foo=bar; HttpOnly".to_vec()][..]);
- let mut c1 = Cookie::n... | Can we bump the version of the cookie crate from 0.1 to 0.2?
I'm trying to build https://github.com/cyderize/rust-websocket.
Now that fails (see https://github.com/cyderize/rust-websocket/issues/54) because websocket wants a newer version of openssl than hyper/cookie does, which causes a conflict.
Websocket could of c... | 2015-11-20T19:15:49Z | 0.6 | 072d4fe36af21e1551316242ba5ebb5a011d38ca | |
hyperium/hyper | 680 | hyperium__hyper-680 | [
"561"
] | b4a9227204e1c08b047643b0c2f655fbf49e30b0 | diff --git a/src/header/common/mod.rs b/src/header/common/mod.rs
--- a/src/header/common/mod.rs
+++ b/src/header/common/mod.rs
@@ -23,6 +23,7 @@ pub use self::allow::Allow;
pub use self::authorization::{Authorization, Scheme, Basic, Bearer};
pub use self::cache_control::{CacheControl, CacheDirective};
pub use self::... | diff --git /dev/null b/src/header/common/content_disposition.rs
new file mode 100644
--- /dev/null
+++ b/src/header/common/content_disposition.rs
@@ -0,0 +1,328 @@
+// # References
+//
+// "The Content-Disposition Header Field" https://www.ietf.org/rfc/rfc2183.txt
+// "The Content-Disposition Header Field in the Hypert... | Content-Disposition header
Not strictly part of HTTP/1.1 but comes up in common usage.
See:
- RFC 6266
- Browser conformance tests at: http://greenbytes.de/tech/tc2231/
- IANA assignment at: http://www.iana.org/assignments/cont-disp/cont-disp.xhtml
(I'm just documenting this. I'm creating a heavily stripped down vari... | If anyone takes this on, you might want to start with the one at https://github.com/mikedilger/formdata/blob/master/src/headers.rs and then extend it to comply with the standards listed above.
| 2015-11-11T20:06:56Z | 0.6 | 072d4fe36af21e1551316242ba5ebb5a011d38ca |
hyperium/hyper | 677 | hyperium__hyper-677 | [
"673"
] | becced4ef293d131ae2ca245621e6ac65bb32c29 | diff --git a/src/header/common/mod.rs b/src/header/common/mod.rs
--- a/src/header/common/mod.rs
+++ b/src/header/common/mod.rs
@@ -10,6 +10,7 @@ pub use self::accept::Accept;
pub use self::access_control_allow_headers::AccessControlAllowHeaders;
pub use self::access_control_allow_methods::AccessControlAllowMethods;
... | diff --git /dev/null b/src/header/common/access_control_expose_headers.rs
new file mode 100644
--- /dev/null
+++ b/src/header/common/access_control_expose_headers.rs
@@ -0,0 +1,60 @@
+use unicase::UniCase;
+
+header! {
+ /// `Access-Control-Expose-Headers` header, part of
+ /// [CORS](http://www.w3.org/TR/cors/#a... | Header request: Access-Control-Expose-Headers
http://www.w3.org/TR/cors/#access-control-expose-headers-response-header
| 2015-11-02T21:04:17Z | 0.6 | 072d4fe36af21e1551316242ba5ebb5a011d38ca | |
hyperium/hyper | 647 | hyperium__hyper-647 | [
"646"
] | 32e09a04292b0247456a8fb9003a75a6abaa998e | diff --git a/src/http/h1.rs b/src/http/h1.rs
--- a/src/http/h1.rs
+++ b/src/http/h1.rs
@@ -225,6 +225,7 @@ impl HttpMessage for Http11Message {
SizedReader(stream, len)
} else if headers.has::<ContentLength>() {
trace!("illegal Content-Length: {:?}", headers.get_raw("Conte... | diff --git a/src/http/h1.rs b/src/http/h1.rs
--- a/src/http/h1.rs
+++ b/src/http/h1.rs
@@ -893,10 +894,12 @@ mod tests {
use std::error::Error;
use std::io::{self, Read, Write};
+
use buffer::BufReader;
use mock::MockStream;
+ use http::HttpMessage;
- use super::{read_chunk_size, parse_req... | Panic when getting empty response from server
As noted in this other (closed) issue: https://github.com/hyperium/hyper/issues/365
When receiving empty response data, hyper consistently panics with:
```
thread '<unnamed>' panicked at 'thread '<unnamed>Http11Message lost its underlying stream somehow.', /home/jneves/.c... | Yep, try updating hyper, this was fixed in a patch.
On Fri, Sep 4, 2015, 12:26 AM João Neves notifications@github.com wrote:
> As noted in this other (closed) issue: #365
> https://github.com/hyperium/hyper/issues/365
>
> When receiving empty response data, hyper consistently panics with:
>
> thread '<unnamed>' pan... | 2015-09-04T23:13:55Z | 0.6 | 072d4fe36af21e1551316242ba5ebb5a011d38ca |
hyperium/hyper | 645 | hyperium__hyper-645 | [
"640"
] | 8dbc38c75acfc93557f7acdba58edeb8d27dfa2d | diff --git a/src/client/pool.rs b/src/client/pool.rs
--- a/src/client/pool.rs
+++ b/src/client/pool.rs
@@ -34,7 +34,7 @@ impl Default for Config {
#[derive(Debug)]
struct PoolImpl<S> {
- conns: HashMap<Key, Vec<S>>,
+ conns: HashMap<Key, Vec<PooledStreamInner<S>>>,
config: Config,
}
diff --git a/src/c... | diff --git a/src/client/mod.rs b/src/client/mod.rs
--- a/src/client/mod.rs
+++ b/src/client/mod.rs
@@ -446,8 +446,10 @@ fn get_host_and_port(url: &Url) -> ::Result<(String, u16)> {
#[cfg(test)]
mod tests {
+ use std::io::Read;
use header::Server;
use super::{Client, RedirectPolicy};
+ use super::poo... | Client Connection Pool wrongly handles HEAD response with body
| 2015-09-01T23:49:03Z | 0.6 | 072d4fe36af21e1551316242ba5ebb5a011d38ca | |
hyperium/hyper | 636 | hyperium__hyper-636 | [
"635"
] | 44a4010537dd9abbdf803061226505b56a053bc8 | diff --git a/src/header/common/connection.rs b/src/header/common/connection.rs
--- a/src/header/common/connection.rs
+++ b/src/header/common/connection.rs
@@ -4,6 +4,9 @@ use unicase::UniCase;
pub use self::ConnectionOption::{KeepAlive, Close, ConnectionHeader};
+const KEEP_ALIVE: UniCase<&'static str> = UniCase("... | diff --git a/src/header/common/connection.rs b/src/header/common/connection.rs
--- a/src/header/common/connection.rs
+++ b/src/header/common/connection.rs
@@ -131,6 +136,7 @@ mod tests {
fn test_parse() {
assert_eq!(Connection::close(),parse_option(b"close".to_vec()));
assert_eq!(Connection::keep... | Connection Header case insensitivity
http://tools.ietf.org/html/rfc7230#section-6.1:
```
... "Connection options are case-insensitive." ...
```
I noticed that Apache Bench sends "Keep-Alive" and hyper misinterprets it
```
DEBUG:hyper::server::request: Headers { Connection: Keep-Alive, Host: 192.168.66.62:8881, Accep... | 2015-08-27T22:39:32Z | 0.6 | 072d4fe36af21e1551316242ba5ebb5a011d38ca | |
hyperium/hyper | 632 | hyperium__hyper-632 | [
"629"
] | da2d29309a986ba25c5af6e95c71d033c48e4b2c | diff --git a/src/uri.rs b/src/uri.rs
--- a/src/uri.rs
+++ b/src/uri.rs
@@ -1,4 +1,5 @@
//! HTTP RequestUris
+use std::fmt::{Display, self};
use std::str::FromStr;
use url::Url;
use url::ParseError as UrlError;
| diff --git a/src/uri.rs b/src/uri.rs
--- a/src/uri.rs
+++ b/src/uri.rs
@@ -72,6 +73,17 @@ impl FromStr for RequestUri {
}
}
+impl Display for RequestUri {
+ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ match *self {
+ RequestUri::AbsolutePath(ref path) => f.write_str(path),
+ ... | implement fmt::Display for RequestUri
| 2015-08-18T20:29:29Z | 0.6 | 072d4fe36af21e1551316242ba5ebb5a011d38ca | |
hyperium/hyper | 625 | hyperium__hyper-625 | [
"436"
] | af062ac954d5b90275138880ce2f5013d6664b5a | diff --git a/src/client/response.rs b/src/client/response.rs
--- a/src/client/response.rs
+++ b/src/client/response.rs
@@ -47,9 +47,9 @@ impl Response {
version: version,
headers: headers,
url: url,
- message: message,
status_raw: raw_status,
- i... | diff --git a/src/header/common/content_length.rs b/src/header/common/content_length.rs
--- a/src/header/common/content_length.rs
+++ b/src/header/common/content_length.rs
@@ -1,37 +1,86 @@
-header! {
- #[doc="`Content-Length` header, defined in"]
- #[doc="[RFC7230](http://tools.ietf.org/html/rfc7230#section-3.3.2... | When a server returns NoContent, reading the response should not hang
When a client makes a request that results in a `NoContent` status code, the read methods on the repsonse should return an immediate EOF status, rather than blocking.
| 2015-08-05T23:47:36Z | 0.6 | 072d4fe36af21e1551316242ba5ebb5a011d38ca | |
hyperium/hyper | 621 | hyperium__hyper-621 | [
"315"
] | 421422b620206c43bc85e05b973042da1b20f130 | diff --git a/Cargo.toml b/Cargo.toml
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -47,5 +47,5 @@ env_logger = "*"
default = ["ssl"]
ssl = ["openssl", "cookie/secure"]
serde-serialization = ["serde"]
-nightly = []
-
+timeouts = []
+nightly = ["timeouts"]
diff --git a/src/client/mod.rs b/src/client/mod.rs
--- a/src/client/mod... | diff --git a/src/lib.rs b/src/lib.rs
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -2,6 +2,7 @@
#![cfg_attr(test, deny(missing_docs))]
#![cfg_attr(test, deny(warnings))]
#![cfg_attr(all(test, feature = "nightly"), feature(test))]
+#![cfg_attr(feature = "timeouts", feature(duration, socket_timeout))]
//! # Hyper
//!
diff ... | Support for pervasive timeouts
We need to provide timeouts for all of our blocking APIs and ways to set timeouts for all internal blocking actions.
| Indeed, and we had a PR offering timeouts, but the IO reform currently means there is no API to do so for TcpStreams.
There is now going to be a stable way to timeout on condition variables, so we could implement _something_.
Link?
On Wed, Apr 1, 2015, 2:13 PM Jonathan Reem notifications@github.com wrote:
> There i... | 2015-07-27T16:58:37Z | 0.6 | 072d4fe36af21e1551316242ba5ebb5a011d38ca |
hyperium/hyper | 567 | hyperium__hyper-567 | [
"468"
] | c37d85728f67997cef4887736c5228322c8967ec | diff --git a/src/header/common/accept.rs b/src/header/common/accept.rs
--- a/src/header/common/accept.rs
+++ b/src/header/common/accept.rs
@@ -27,6 +27,51 @@ header! {
#[doc="* `audio/*; q=0.2, audio/basic` (`*` value won't parse correctly)"]
#[doc="* `text/plain; q=0.5, text/html, text/x-dvi; q=0.8, text/x-c... | diff --git a/src/header/common/accept_charset.rs b/src/header/common/accept_charset.rs
--- a/src/header/common/accept_charset.rs
+++ b/src/header/common/accept_charset.rs
@@ -18,6 +18,35 @@ header! {
#[doc=""]
#[doc="# Example values"]
#[doc="* `iso-8859-5, unicode-1-1;q=0.8`"]
+ #[doc=""]
+ #[doc=... | Add example usage for each Header
The header types docs could show an example usage on each of their respective pages.
| This is solved by #503
Ah, when I meant example usage, I meant showing in a rust code fench how to
create a header to to send in a Request/Response.
| 2015-06-15T03:44:31Z | 0.5 | c37d85728f67997cef4887736c5228322c8967ec |
hyperium/hyper | 518 | hyperium__hyper-518 | [
"495"
] | 38f40c7f6a17bd33951bbab1adddf542cbb96de6 | diff --git a/benches/client.rs b/benches/client.rs
--- a/benches/client.rs
+++ b/benches/client.rs
@@ -8,7 +8,7 @@ use std::fmt;
use std::io::{self, Read, Write, Cursor};
use std::net::SocketAddr;
-use hyper::net;
+use hyper::net::{self, ContextVerifier};
static README: &'static [u8] = include_bytes!("../README.... | diff --git a/src/client/mod.rs b/src/client/mod.rs
--- a/src/client/mod.rs
+++ b/src/client/mod.rs
@@ -401,6 +406,8 @@ mod tests {
use header::Server;
use super::{Client, RedirectPolicy};
use url::Url;
+ use mock::ChannelMockConnector;
+ use std::sync::mpsc::{self, TryRecvError};
mock_connec... | Client: Setting a custom SSL verifier discards previous Connector
When the `Client::set_ssl_verifier` method is called, it will discard any previously existing `Connector` instance that the `Client` was instantiated to use. This wasn't a problem before, when the connectors were largely stateless, but with the introduct... | This is true. Before, it was possible when `Client` was generic over the NetworkConnector. Perhaps such a method `set_ssl_verifier` should be added to the `NetworkConnector` trait...
| 2015-05-09T18:02:10Z | 0.4 | 38f40c7f6a17bd33951bbab1adddf542cbb96de6 |
hyperium/hyper | 499 | hyperium__hyper-499 | [
"480"
] | b916a7b18cdbbecc872dba8f4ed12d5697cc531c | diff --git a/src/header/common/mod.rs b/src/header/common/mod.rs
--- a/src/header/common/mod.rs
+++ b/src/header/common/mod.rs
@@ -42,7 +42,7 @@ pub use self::referer::Referer;
pub use self::server::Server;
pub use self::set_cookie::SetCookie;
pub use self::transfer_encoding::TransferEncoding;
-pub use self::upgrade... | diff --git a/src/header/common/upgrade.rs b/src/header/common/upgrade.rs
--- a/src/header/common/upgrade.rs
+++ b/src/header/common/upgrade.rs
@@ -31,47 +29,107 @@ header! {
(Upgrade, "Upgrade") => (Protocol)+
test_upgrade {
+ // Testcase from the RFC
test_header!(
test1,
... | Reminder: Upgrade header Protocols should support version
As defined in http://tools.ietf.org/html/rfc7230#section-6.7 a protocol consists of a name and an optional version token.
| I don't understand what the action is for this issue. Does the `Upgrade` header need to be changed?
Yes we need to change `Upgrade` header field. (What means "need" we can also keep it but do not implement the RFC)
The RFC says:
```
Upgrade = 1#protocol
protocol = protocol-name ["/" protoc... | 2015-05-02T17:30:05Z | 0.3 | b916a7b18cdbbecc872dba8f4ed12d5697cc531c |
hyperium/hyper | 498 | hyperium__hyper-498 | [
"497"
] | 6d7ae81e36096947b28ce5a5414df3c75d1fbae9 | diff --git a/src/http.rs b/src/http.rs
--- a/src/http.rs
+++ b/src/http.rs
@@ -409,8 +409,8 @@ impl<'a> TryParse for httparse::Response<'a, 'a> {
httparse::Status::Complete(len) => {
let code = res.code.unwrap();
let reason = match StatusCode::from_u16(code).canonical_reas... | diff --git a/src/http.rs b/src/http.rs
--- a/src/http.rs
+++ b/src/http.rs
@@ -460,7 +460,7 @@ mod tests {
use buffer::BufReader;
use mock::MockStream;
- use super::{read_chunk_size, parse_request};
+ use super::{read_chunk_size, parse_request, parse_response};
#[test]
fn test_write_chunke... | Real status text gets lost
This is blocking the Servo rustup. Code went from
``` rust
let reason = match str::from_utf8(cursor.into_inner()) {
Ok(s) => s.trim(),
Err(_) => return Err(HttpStatusError)
};
let reason = match from_u16::<StatusCode>(code) {
Some(status) => match status.... | For what is the reason phrase needed in servo?
https://xhr.spec.whatwg.org/#the-statustext-attribute
| 2015-05-01T22:09:54Z | 0.3 | b916a7b18cdbbecc872dba8f4ed12d5697cc531c |
hyperium/hyper | 492 | hyperium__hyper-492 | [
"490"
] | 1426a4ce343bb4533234ac51e7f10d110ec701a6 | diff --git /dev/null b/examples/headers.rs
new file mode 100644
--- /dev/null
+++ b/examples/headers.rs
@@ -0,0 +1,13 @@
+#![deny(warnings)]
+
+#[macro_use]
+// TODO: only import header!, blocked by https://github.com/rust-lang/rust/issues/25003
+extern crate hyper;
+
+// A header in the form of `X-Foo: some random str... | diff --git a/src/header/common/mod.rs b/src/header/common/mod.rs
--- a/src/header/common/mod.rs
+++ b/src/header/common/mod.rs
@@ -95,6 +95,21 @@ macro_rules! deref(
}
);
+macro_rules! tm {
+ ($id:ident, $tm:ident{$($tf:item)*}) => {
+ #[allow(unused_imports)]
+ mod $tm{
+ use std::s... | Breaking change in the header! macro not documented
I updated to 0.3.15 and my code is now failing due to changes in `header!` macro:
```
src/lib.rs:250:43: 250:44 error: unexpected end of macro invocation
src/lib.rs:250 header!{ (TenantId, "TenantId") => [String] }
```
This is most likely due to commits https://gith... | cc @pyfisch as he is the one which added the commits mentioned above
I'd say this was an oversight. We shouldn't have made a breaking change. A reason making it easier to miss is that all of our internal uses _do_ include a test function.
I think part of a fix so as to make sure we don't break the exported `header!` ... | 2015-04-30T22:05:09Z | 0.3 | b916a7b18cdbbecc872dba8f4ed12d5697cc531c |
hyperium/hyper | 491 | hyperium__hyper-491 | [
"388"
] | 92ee51acdbf9ac1e2f2d3770f5566196c13b20bd | diff --git a/src/header/common/mod.rs b/src/header/common/mod.rs
--- a/src/header/common/mod.rs
+++ b/src/header/common/mod.rs
@@ -34,6 +34,7 @@ pub use self::if_match::IfMatch;
pub use self::if_modified_since::IfModifiedSince;
pub use self::if_none_match::IfNoneMatch;
pub use self::if_unmodified_since::IfUnmodified... | diff --git /dev/null b/src/header/common/if_range.rs
new file mode 100644
--- /dev/null
+++ b/src/header/common/if_range.rs
@@ -0,0 +1,73 @@
+use header::{self, EntityTag, HttpDate};
+
+/// `If-Range` header, defined in [RFC7233](http://tools.ietf.org/html/rfc7233#section-3.2)
+///
+/// If a client has a partial copy o... | Implement If-Range header parsing
Spec: `http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.27`
| RFC2616 is obsolte.
New and better spec: https://tools.ietf.org/html/rfc7233#section-3.2
I will do this.
| 2015-04-30T17:51:04Z | 0.3 | b916a7b18cdbbecc872dba8f4ed12d5697cc531c |
hyperium/hyper | 486 | hyperium__hyper-486 | [
"41"
] | 362044c32c2e6a5dcb701c48339d0dddde27effc | diff --git a/src/client/mod.rs b/src/client/mod.rs
--- a/src/client/mod.rs
+++ b/src/client/mod.rs
@@ -46,15 +46,17 @@ use status::StatusClass::Redirection;
use {Url, HttpResult};
use HttpError::HttpUriError;
+pub use self::pool::Pool;
pub use self::request::Request;
pub use self::response::Response;
+pub mod p... | diff --git /dev/null b/src/client/pool.rs
new file mode 100644
--- /dev/null
+++ b/src/client/pool.rs
@@ -0,0 +1,227 @@
+//! Client Connection Pooling
+use std::borrow::ToOwned;
+use std::collections::HashMap;
+use std::io::{self, Read, Write};
+use std::net::{SocketAddr, Shutdown};
+use std::sync::{Arc, Mutex};
+
+use... | Implement keep-alive
| This is really important for SSL requests.
server side is done
| 2015-04-28T01:26:13Z | 0.3 | b916a7b18cdbbecc872dba8f4ed12d5697cc531c |
hyperium/hyper | 485 | hyperium__hyper-485 | [
"475"
] | f7f0361626a808293e52cbe3fc07bc89490a7c03 | diff --git a/src/header/common/accept_language.rs b/src/header/common/accept_language.rs
--- a/src/header/common/accept_language.rs
+++ b/src/header/common/accept_language.rs
@@ -1,39 +1,4 @@
-use header::QualityItem;
-use std::str::FromStr;
-use std::fmt;
-
-/// A language tag.
-/// See http://www.w3.org/Protocols/rfc... | diff --git a/src/header/common/accept_language.rs b/src/header/common/accept_language.rs
--- a/src/header/common/accept_language.rs
+++ b/src/header/common/accept_language.rs
@@ -57,7 +22,7 @@ header! {
#[cfg(test)]
mod tests {
- use header::{Header, qitem, Quality, QualityItem};
+ use header::{Header, Langua... | Implement Content-Language header
https://tools.ietf.org/html/rfc7231#section-3.1.3.2
This will be useful for Servo.
| 2015-04-27T19:12:52Z | 0.3 | b916a7b18cdbbecc872dba8f4ed12d5697cc531c | |
hyperium/hyper | 455 | hyperium__hyper-455 | [
"437"
] | dac2f4db8ac4cd3e529a8a8333a575dbb5b37839 | diff --git a/src/http.rs b/src/http.rs
--- a/src/http.rs
+++ b/src/http.rs
@@ -12,7 +12,7 @@ use method::Method;
use status::StatusCode;
use uri::RequestUri;
use version::HttpVersion::{self, Http10, Http11};
-use HttpError:: HttpTooLargeError;
+use HttpError::{HttpIoError, HttpTooLargeError};
use {HttpError, HttpRe... | diff --git a/src/http.rs b/src/http.rs
--- a/src/http.rs
+++ b/src/http.rs
@@ -440,8 +447,10 @@ pub struct RawStatus(pub u16, pub Cow<'static, str>);
mod tests {
use std::io::{self, Write};
- use super::{read_chunk_size};
+ use buffer::BufReader;
+ use mock::MockStream;
+ use super::{read_chunk_si... | HttpTooLargeError after the response
Ever since the new buffering code, I get `HttpTooLargeError`s after almost every response. It is after the handler returns and the response has been sent, and so the site continues to function. But clearly something is amiss. The requests are rather normal small requests, nothin... | I maked a pull request: https://github.com/hyperium/hyper/pull/454
| 2015-04-15T18:20:52Z | 0.3 | b916a7b18cdbbecc872dba8f4ed12d5697cc531c |
hyperium/hyper | 407 | hyperium__hyper-407 | [
"406"
] | ce5231508e615276333dc2dff7c8c27a6716a93d | diff --git a/src/buffer.rs b/src/buffer.rs
--- a/src/buffer.rs
+++ b/src/buffer.rs
@@ -27,7 +27,12 @@ impl<R: Read> BufReader<R> {
pub fn get_mut(&mut self) -> &mut R { &mut self.inner }
pub fn get_buf(&self) -> &[u8] {
- self.buf.get_ref()
+ let pos = self.buf.position() as usize;
+ if... | diff --git a/src/buffer.rs b/src/buffer.rs
--- a/src/buffer.rs
+++ b/src/buffer.rs
@@ -93,3 +98,18 @@ fn reserve(v: &mut Vec<u8>) {
v.reserve(cmp::min(cap * 4, MAX_BUFFER_SIZE) - cap);
}
}
+
+#[cfg(test)]
+mod tests {
+
+ use std::io::BufRead;
+ use super::BufReader;
+
+ #[test]
+ fn test_con... | hyper 0.3.5 is looping
handle() is being called repeatedly on just 1 request until some resource becomes exhausted and response.start() fails. 0.3.4 worked fine. I'll post more details once I look into the code.
| This commit is the culprit: cb59f609c61a097d5d9fa728b9df33d79922573b
fix(http): read more before triggering TooLargeError
I wont try to fix, I'll leave it for you Sean as you're more familiar with what you just did.
To test, the client that makes the server loop is a GET request via this firefox extension: http://ww... | 2015-03-30T04:21:21Z | 0.3 | b916a7b18cdbbecc872dba8f4ed12d5697cc531c |
hyperium/hyper | 401 | hyperium__hyper-401 | [
"389"
] | b04f6d8e7ad9550588bceadcc0e21f1434ab244a | diff --git /dev/null b/src/buffer.rs
new file mode 100644
--- /dev/null
+++ b/src/buffer.rs
@@ -0,0 +1,95 @@
+use std::cmp;
+use std::iter;
+use std::io::{self, Read, BufRead, Cursor};
+
+pub struct BufReader<R> {
+ buf: Cursor<Vec<u8>>,
+ inner: R
+}
+
+const INIT_BUFFER_SIZE: usize = 4096;
+const MAX_BUFFER_SIZ... | diff --git a/src/client/response.rs b/src/client/response.rs
--- a/src/client/response.rs
+++ b/src/client/response.rs
@@ -103,9 +104,10 @@ impl Read for Response {
mod tests {
use std::borrow::Cow::Borrowed;
use std::boxed::BoxAny;
- use std::io::{self, Read, BufReader};
+ use std::io::{self, Read};
... | Hyper client fails if the header isn't fully received in the first read
Some HTTP servers do not send the entire HTTP header in a single chunk. Hyper assumes that the entire header is received when calling fill_buf, which isn't always the case.
Running the client example in the documentation against a [Flask test serv... | True, I was hoping that the BufReader would fill it's entire buffer before yielding, which [by default is 64kb](https://github.com/rust-lang/rust/blob/master/src/libstd/io/mod.rs#L50). Is the test server head bigger than this? Or BufReader is yielding earlier?
The head is a few bytes long. By looking at Wireshark I co... | 2015-03-27T18:02:42Z | 0.3 | b916a7b18cdbbecc872dba8f4ed12d5697cc531c |
hyperium/hyper | 383 | hyperium__hyper-383 | [
"381"
] | 7469e62d1e54d9b6f51e9435306e0455de05e1d0 | diff --git a/README.md b/README.md
--- a/README.md
+++ b/README.md
@@ -28,7 +28,7 @@ Hello World Server:
extern crate hyper;
use std::io::Write;
-use std::net::IpAddr;
+use std::net::Ipv4Addr;
use hyper::Server;
use hyper::server::Request;
diff --git a/README.md b/README.md
--- a/README.md
+++ b/README.md
@@ -4... | diff --git a/benches/client.rs b/benches/client.rs
--- a/benches/client.rs
+++ b/benches/client.rs
@@ -1,5 +1,5 @@
#![deny(warnings)]
-#![feature(collections, io, net, test)]
+#![feature(collections, test)]
extern crate hyper;
extern crate test;
diff --git a/benches/server.rs b/benches/server.rs
--- a/benches/serv... | hyper doesn't built with new rustc.
`IpAddr` was splitted to `Ipv4Addr` and `Ipv6Addr`
```
src\server/mod.rs:4:16: 4:22 error: unresolved import `std::net::IpAddr`. There is no `IpAddr` in `std::net`
src\server/mod.rs:4 use std::net::{IpAddr, SocketAddr};
```
rustc 1.0.0-dev (c10918905 2015-03-18) (built 2015-03-18)
... | 2015-03-20T09:32:33Z | 0.3 | b916a7b18cdbbecc872dba8f4ed12d5697cc531c | |
hyperium/hyper | 382 | hyperium__hyper-382 | [
"381",
"381"
] | 7469e62d1e54d9b6f51e9435306e0455de05e1d0 | diff --git a/README.md b/README.md
--- a/README.md
+++ b/README.md
@@ -28,7 +28,7 @@ Hello World Server:
extern crate hyper;
use std::io::Write;
-use std::net::IpAddr;
+use std::net::Ipv4Addr;
use hyper::Server;
use hyper::server::Request;
diff --git a/README.md b/README.md
--- a/README.md
+++ b/README.md
@@ -4... | diff --git a/benches/server.rs b/benches/server.rs
--- a/benches/server.rs
+++ b/benches/server.rs
@@ -5,7 +5,7 @@ extern crate test;
use test::Bencher;
use std::io::{Read, Write};
-use std::net::IpAddr;
+use std::net::Ipv4Addr;
use hyper::method::Method::Get;
use hyper::server::{Request, Response};
diff --git ... | hyper doesn't built with new rustc.
`IpAddr` was splitted to `Ipv4Addr` and `Ipv6Addr`
```
src\server/mod.rs:4:16: 4:22 error: unresolved import `std::net::IpAddr`. There is no `IpAddr` in `std::net`
src\server/mod.rs:4 use std::net::{IpAddr, SocketAddr};
```
rustc 1.0.0-dev (c10918905 2015-03-18) (built 2015-03-18)
... | 2015-03-19T08:16:38Z | 0.3 | b916a7b18cdbbecc872dba8f4ed12d5697cc531c | |
hyperium/hyper | 377 | hyperium__hyper-377 | [
"369"
] | fe8c6d9914b7c213edd97fefeddc0ef831e02d4b | diff --git /dev/null b/src/header/common/expect.rs
new file mode 100644
--- /dev/null
+++ b/src/header/common/expect.rs
@@ -0,0 +1,37 @@
+use std::fmt;
+
+use header::{Header, HeaderFormat};
+
+/// The `Expect` header.
+///
+/// > The "Expect" header field in a request indicates a certain set of
+/// > behaviors (expec... | diff --git a/src/server/mod.rs b/src/server/mod.rs
--- a/src/server/mod.rs
+++ b/src/server/mod.rs
@@ -184,11 +193,78 @@ pub trait Handler: Sync + Send {
/// Receives a `Request`/`Response` pair, and should perform some action on them.
///
/// This could reading from the request, and writing to the respo... | hyper does not comply with `Expect: 100-continue` statement
I'm using hyper to receive githook commit messages and when the payload is longer than 1024 bytes, `request.read_to_string()` is much much slower than it probably should be (something like a factor 100 on localhost)...
I have created a very simple test case i... | Hmm. Hyper is using a BufReader, which by [default uses 64kbs](https://github.com/rust-lang/rust/blob/master/src/libstd/io/mod.rs#L55). Is it significantly bigger than that?
It is much smaller: 1024 bytes (as indicated by the title of the Issue :wink: ). And the issue starts getting visible at precisely this value.
... | 2015-03-16T23:00:08Z | 0.3 | b916a7b18cdbbecc872dba8f4ed12d5697cc531c |
hyperium/hyper | 354 | hyperium__hyper-354 | [
"347"
] | 7235d3f74a6f058a9bedc840519be80384e292da | diff --git a/README.md b/README.md
--- a/README.md
+++ b/README.md
@@ -27,12 +27,13 @@ Hello World Server:
```rust
extern crate hyper;
-use hyper::status::StatusCode;
-use hyper::server::Server;
-use hyper::server::request::Request;
-use hyper::server::response::Response;
+use std::io::Write;
+use std::net::IpAddr;... | diff --git a/benches/client.rs b/benches/client.rs
--- a/benches/client.rs
+++ b/benches/client.rs
@@ -1,33 +1,53 @@
-#![feature(core, old_io, test)]
+#![feature(collections, io, net, test)]
extern crate hyper;
extern crate test;
use std::fmt;
-use std::old_io::net::ip::Ipv4Addr;
-use hyper::server::{Request, Re... | Switch to new std::io
Installed Rust nightly build, after not using Rust for 3 weeks. Hyper won't compile any more.
The I/O libraries changed. Again. Not your fault. Sigh.
```
Compiling hyper v0.2.1
/home/john/.cargo/registry/src/github.com-1ecc6299db9ec823/hyper-0.2.1/src/net.rs:215:25: 215:29 error: mismatched types... | 2015-03-01T03:23:46Z | 0.2 | 7235d3f74a6f058a9bedc840519be80384e292da | |
hyperium/hyper | 331 | hyperium__hyper-331 | [
"326"
] | 41fd8de243dc1183b994d46a9624b1ee6c2dcdd2 | diff --git a/src/header/mod.rs b/src/header/mod.rs
--- a/src/header/mod.rs
+++ b/src/header/mod.rs
@@ -206,6 +206,11 @@ impl Headers {
self.data.insert(UniCase(name.into_cow()), Item::new_raw(value));
}
+ /// Remove a header set by set_raw
+ pub fn remove_raw(&mut self, name: &str) {
+ self... | diff --git a/src/header/mod.rs b/src/header/mod.rs
--- a/src/header/mod.rs
+++ b/src/header/mod.rs
@@ -662,6 +667,14 @@ mod tests {
assert_eq!(headers.get(), Some(&ContentLength(20)));
}
+ #[test]
+ fn test_remove_raw() {
+ let mut headers = Headers::new();
+ headers.set_raw("content... | Removing a raw header
Currently, I can insert or overwrite a header by doing, for example:
```
request_headers.set_raw("Accept-Encoding", vec![b"gzip, deflate".to_vec()]);
```
But apparently, I cannot remove it, only set it to a different value.
Wouldn't it be useful to add a remove_raw() method to Headers?
Raw heade... | Good call, this would be needed to support XHR's `removeHeader` method.
| 2015-02-22T12:24:43Z | 0.2 | 7235d3f74a6f058a9bedc840519be80384e292da |
hyperium/hyper | 329 | hyperium__hyper-329 | [
"328"
] | e8833c0c894a2b87b5d9b48b07858ec7fc890b7a | diff --git a/examples/client.rs b/examples/client.rs
--- a/examples/client.rs
+++ b/examples/client.rs
@@ -1,4 +1,4 @@
-#![feature(env, io)]
+#![feature(env, old_io)]
extern crate hyper;
use std::env;
diff --git a/examples/hello.rs b/examples/hello.rs
--- a/examples/hello.rs
+++ b/examples/hello.rs
@@ -1,4 +1,4 @@
... | diff --git a/benches/client.rs b/benches/client.rs
--- a/benches/client.rs
+++ b/benches/client.rs
@@ -1,4 +1,4 @@
-#![feature(core, io, test)]
+#![feature(core, old_io, test)]
extern crate hyper;
extern crate test;
diff --git a/benches/client_mock_tcp.rs b/benches/client_mock_tcp.rs
--- a/benches/client_mock_tcp.r... | Build failure with rust nightly
Hi, I'm not sure what this error means, or why there are so many of these "note: write `[...]` instead" lines without any souce file and line number information...
```
$ cargo build
Compiling hyper v0.1.13
note: write `[..]` instead
note: write `[..]` instead
note: write `[..]` inste... | 2015-02-21T23:07:22Z | 0.1 | e8833c0c894a2b87b5d9b48b07858ec7fc890b7a | |
hyperium/hyper | 319 | hyperium__hyper-319 | [
"314"
] | f8776f4c241e6c064b7cdcaa62e4eab180784c69 | diff --git a/src/header/shared/quality_item.rs b/src/header/shared/quality_item.rs
--- a/src/header/shared/quality_item.rs
+++ b/src/header/shared/quality_item.rs
@@ -26,6 +27,12 @@ impl<T> QualityItem<T> {
}
}
+impl<T: PartialEq> cmp::PartialOrd for QualityItem<T> {
+ fn partial_cmp(&self, other: &QualityIt... | diff --git a/src/header/shared/quality_item.rs b/src/header/shared/quality_item.rs
--- a/src/header/shared/quality_item.rs
+++ b/src/header/shared/quality_item.rs
@@ -5,6 +5,7 @@
use std::fmt;
use std::str;
+use std::cmp;
#[cfg(test)] use super::encoding::*;
/// Represents an item with a quality value as define... | Implement `PartialOrd` for `QualityItem`
Sort `QualityItems` according to their `q` value. This is useful for comparison and to sort `QualityItems`. It makes it easier to find the preferred item, that matches the provided items.
| 2015-02-15T17:04:29Z | 0.1 | e8833c0c894a2b87b5d9b48b07858ec7fc890b7a | |
hyperium/hyper | 313 | hyperium__hyper-313 | [
"301"
] | f554c09e12da805a219675fe7eceeffca4e41fec | diff --git a/src/header/common/mod.rs b/src/header/common/mod.rs
--- a/src/header/common/mod.rs
+++ b/src/header/common/mod.rs
@@ -20,6 +20,7 @@ pub use self::date::Date;
pub use self::etag::Etag;
pub use self::expires::Expires;
pub use self::host::Host;
+pub use self::if_match::IfMatch;
pub use self::if_modified_s... | diff --git /dev/null b/src/header/common/if_match.rs
new file mode 100644
--- /dev/null
+++ b/src/header/common/if_match.rs
@@ -0,0 +1,68 @@
+use header::{EntityTag, Header, HeaderFormat};
+use header::parsing::{from_comma_delimited, fmt_comma_delimited, from_one_raw_str};
+use std::fmt;
+
+/// The `If-Match` header
+/... | feat(headers): add IfMatch header
Add support for the If-Match http header.
| 2015-02-14T20:00:41Z | 0.1 | e8833c0c894a2b87b5d9b48b07858ec7fc890b7a | |
hyperium/hyper | 310 | hyperium__hyper-310 | [
"309"
] | f554c09e12da805a219675fe7eceeffca4e41fec | diff --git a/src/http.rs b/src/http.rs
--- a/src/http.rs
+++ b/src/http.rs
@@ -3,7 +3,10 @@ use std::borrow::Cow::{Borrowed, Owned};
use std::borrow::IntoCow;
use std::cmp::min;
use std::old_io::{self, Reader, IoResult, BufWriter};
+use std::old_io::util as io_util;
+use std::mem;
use std::num::from_u16;
+use std::... | diff --git a/src/lib.rs b/src/lib.rs
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -1,5 +1,5 @@
#![feature(core, collections, hash, io, os, path, std_misc,
- slicing_syntax, box_syntax)]
+ slicing_syntax, box_syntax, unsafe_destructor)]
#![deny(missing_docs)]
#![cfg_attr(test, deny(warnings))]
#![cfg_att... | Read body for all requests with a Content-Length header
The framing of a HTTP request doesn't depend on the method [1], so any request with a non-zero Content-Length has a corresponding body. This does not change in the case of idempotent methods like GET; what is different is that for such methods it is incorrect for ... | Good catch. I've also noticed that for requests that should have a body, such as POST, and the user doesn't read it out, it bleeds into the next request also.
We could write a Drop impl for Request that tries to read out the remainder of the body.
| 2015-02-14T02:39:22Z | 0.1 | e8833c0c894a2b87b5d9b48b07858ec7fc890b7a |
hyperium/hyper | 302 | hyperium__hyper-302 | [
"238"
] | f836ee89c13e6afa44429d3da2517530175bad25 | diff --git a/src/header/common/mod.rs b/src/header/common/mod.rs
--- a/src/header/common/mod.rs
+++ b/src/header/common/mod.rs
@@ -21,6 +21,7 @@ pub use self::etag::Etag;
pub use self::expires::Expires;
pub use self::host::Host;
pub use self::if_modified_since::IfModifiedSince;
+pub use self::if_none_match::IfNoneMa... | diff --git /dev/null b/src/header/common/if_none_match.rs
new file mode 100644
--- /dev/null
+++ b/src/header/common/if_none_match.rs
@@ -0,0 +1,84 @@
+use header::{Header, HeaderFormat, EntityTag};
+use header::parsing::{from_comma_delimited, fmt_comma_delimited, from_one_raw_str};
+use std::fmt::{self};
+
+/// The `I... | add If-None-Match header
This is needed for https://github.com/servo/servo/pull/4117/.
Spec: https://tools.ietf.org/html/rfc7232#section-3.2
| 2015-02-07T20:57:28Z | 0.1 | e8833c0c894a2b87b5d9b48b07858ec7fc890b7a | |
hyperium/hyper | 292 | hyperium__hyper-292 | [
"291"
] | eee462568657ac54b1cf44d473f5227979241255 | diff --git a/src/header/common/authorization.rs b/src/header/common/authorization.rs
--- a/src/header/common/authorization.rs
+++ b/src/header/common/authorization.rs
@@ -32,9 +32,9 @@ impl<S: Scheme> Header for Authorization<S> {
match (from_utf8(unsafe { &raw[].get_unchecked(0)[] }), Scheme::scheme(None:... | diff --git a/benches/client_mock_tcp.rs b/benches/client_mock_tcp.rs
--- a/benches/client_mock_tcp.rs
+++ b/benches/client_mock_tcp.rs
@@ -1,4 +1,4 @@
-#![feature(core, collections, io, test)]
+#![feature(collections, io, test)]
extern crate hyper;
extern crate test;
diff --git a/src/header/mod.rs b/src/header/mod.... | fix(rustup): update FromStr
| There were the following issues with your Pull Request
- Commit: 12746b6076b62dd8167af2670ac345dc2497c36f
- Commits must be in the following format: **%{type}(%{scope}): %{description}**
Guidelines are available at https://github.com/hyperium/hyper/blob/master/CONTRIBUTING.md
---
This message was auto-generated by... | 2015-02-04T02:58:09Z | 0.1 | e8833c0c894a2b87b5d9b48b07858ec7fc890b7a |
hyperium/hyper | 289 | hyperium__hyper-289 | [
"252"
] | e9af13c3a6b1de4cc1f0774c085bd20ded4d41d6 | diff --git a/Cargo.toml b/Cargo.toml
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -15,7 +15,6 @@ keywords = ["http", "hyper", "hyperium"]
cookie = "*"
log = ">= 0.2.0"
mime = "*"
-mucell = "*"
openssl = "*"
rustc-serialize = "*"
time = "*"
diff --git /dev/null b/src/header/cell.rs
new file mode 100644
--- /dev/null
+++ b... | diff --git a/src/header/mod.rs b/src/header/mod.rs
--- a/src/header/mod.rs
+++ b/src/header/mod.rs
@@ -695,37 +710,58 @@ mod tests {
}
#[bench]
- fn bench_header_get(b: &mut Bencher) {
+ fn bench_headers_new(b: &mut Bencher) {
+ b.iter(|| {
+ let mut h = Headers::new();
+ ... | Mucell often breaks Hyper
Mucell breaks Hyper really often. Like for example just now: https://travis-ci.org/hyperium/hyper/builds/47357537 I do not really know what mucell makes it superior to the standard library types, but for me it looks like it only provides a minor speed increasement. So do we really need it or c... | @pyfisch it's fixed now, but I do see your concern.
I guess a benchmark (of hyper) using both mucell and refcell would be useful to know if it's worth using something outside of std.
| 2015-02-02T20:16:36Z | 0.1 | e8833c0c894a2b87b5d9b48b07858ec7fc890b7a |
hyperium/hyper | 283 | hyperium__hyper-283 | [
"281"
] | 93821fc731fe00295dad13b488b8e4b4097d15a8 | diff --git a/src/header/shared/quality_item.rs b/src/header/shared/quality_item.rs
--- a/src/header/shared/quality_item.rs
+++ b/src/header/shared/quality_item.rs
@@ -28,7 +28,12 @@ impl<T> QualityItem<T> {
impl<T: fmt::Display> fmt::Display for QualityItem<T> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Res... | diff --git a/src/header/shared/quality_item.rs b/src/header/shared/quality_item.rs
--- a/src/header/shared/quality_item.rs
+++ b/src/header/shared/quality_item.rs
@@ -79,7 +84,7 @@ pub fn qitem<T>(item: T) -> QualityItem<T> {
#[test]
fn test_quality_item_show1() {
let x = qitem(Chunked);
- assert_eq!(format!(... | Don't print "; q=1" when QualityItem is set to 1
See https://github.com/servo/servo/issues/4734
| 2015-01-28T05:53:47Z | 0.1 | e8833c0c894a2b87b5d9b48b07858ec7fc890b7a | |
hyperium/hyper | 267 | hyperium__hyper-267 | [
"237"
] | fb92a260c0506f9d1764504527648a7bd7be3560 | diff --git a/src/header/common/mod.rs b/src/header/common/mod.rs
--- a/src/header/common/mod.rs
+++ b/src/header/common/mod.rs
@@ -23,6 +23,7 @@ pub use self::host::Host;
pub use self::if_modified_since::IfModifiedSince;
pub use self::last_modified::LastModified;
pub use self::location::Location;
+pub use self::prag... | diff --git /dev/null b/src/header/common/pragma.rs
new file mode 100644
--- /dev/null
+++ b/src/header/common/pragma.rs
@@ -0,0 +1,61 @@
+use std::fmt;
+use std::ascii::AsciiExt;
+
+use header::{Header, HeaderFormat, parsing};
+
+/// The `Pragma` header defined by HTTP/1.0.
+///
+/// > The "Pragma" header field allows ... | add Pragma header
This is needed for https://github.com/servo/servo/pull/4117/.
Spec: https://tools.ietf.org/html/rfc7234#section-5.4
| 2015-01-22T21:12:20Z | 0.1 | e8833c0c894a2b87b5d9b48b07858ec7fc890b7a | |
hyperium/hyper | 213 | hyperium__hyper-213 | [
"211",
"211"
] | 27b262c22678ed785ed269da4f4a4ddc154526d1 | diff --git a/src/http.rs b/src/http.rs
--- a/src/http.rs
+++ b/src/http.rs
@@ -544,6 +544,9 @@ pub fn read_header<R: Reader>(stream: &mut R) -> HttpResult<Option<RawHeaderLine
}
};
}
+ // Remove optional trailing whitespace
+ let real_len = value.len() - value.iter().rev().take_while(|&... | diff --git a/src/header/mod.rs b/src/header/mod.rs
--- a/src/header/mod.rs
+++ b/src/header/mod.rs
@@ -594,6 +594,13 @@ mod tests {
assert!(headers.get::<CrazyLength>().is_none());
}
+ #[test]
+ fn test_trailing_whitespace() {
+ let headers = Headers::from_raw(&mut mem("Content-Length: 10 ... | Whitespace trailing header values causes incorrect parsing of header field
[RFC7230](https://tools.ietf.org/html/rfc7230#section-3.2) allows optional trailing whitespace for header fields. So `Content-Length: 10 \r\nContent-Type: text/plain\r\n\r\n` is a valid header. It causes the parser to fail, it thinks the value ... | True! It seems like in [read_header](https://github.com/hyperium/hyper/blob/master/src/http.rs#L509) should trim the OWS.
True! It seems like in [read_header](https://github.com/hyperium/hyper/blob/master/src/http.rs#L509) should trim the OWS.
| 2014-12-29T11:18:29Z | 0.0 | 27b262c22678ed785ed269da4f4a4ddc154526d1 |
hyperium/hyper | 206 | hyperium__hyper-206 | [
"205"
] | 33f61213ce9d58722647a03f2f04514c1c14ade9 | diff --git a/Cargo.toml b/Cargo.toml
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -19,6 +19,8 @@ typeable = "*"
cookie = "*"
time = "*"
mucell = "*"
+log = "*"
+rustc-serialize = "*"
[dev-dependencies]
curl = "*"
diff --git a/src/header/common/accept.rs b/src/header/common/accept.rs
--- a/src/header/common/accept.rs
+++... | diff --git a/src/client/mod.rs b/src/client/mod.rs
--- a/src/client/mod.rs
+++ b/src/client/mod.rs
@@ -381,7 +381,7 @@ mod tests {
client.set_redirect_policy(RedirectPolicy::FollowAll);
let res = client.get("http://127.0.0.1").send().unwrap();
- assert_eq!(res.headers.get(), Some(&Server("moc... | Multiple matching crates for log
I'm not sure if this is a cargo bug, but a rust project that has a log dependency causes hyper to not be compiled. Cargo confuses liblog in rustlib with the liblog that cargo provided.
```
~/.cargo/registry/src/github.com-1ecc6299db9ec823/hyper-0.0.16/src/lib.rs:132:23: 132:40 error: m... | Same issue here. I've simply made a hello world application which depends on hyper. My Cargo's dependencies looks like this:
```
hyper = "0.0.16"
```
Yep, things moved around. I'm fixing for latest nightly currently.
| 2014-12-23T21:10:33Z | 0.0 | 27b262c22678ed785ed269da4f4a4ddc154526d1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.