{"action":"created","comment":{"url":"https://api.github.com/repos/hyperium/hyper/pulls/comments/171989023","pull_request_review_id":100944828,"id":171989023,"diff_hunk":"@@ -0,0 +1,456 @@\n+//! Lower-level client connection API.\n+//!\n+//! The types in thie module are to provide a lower-level API based around a\n+//! single connection. Connecting to a host, pooling connections, and the like\n+//! are not handled at this level. This module provides the building blocks to\n+//! customize those things externally.\n+//!\n+//! If don't have need to manage connections yourself, consider using the\n+//! higher-level [Client](super) API.\n+use std::fmt;\n+use std::marker::PhantomData;\n+\n+use bytes::Bytes;\n+use futures::{Async, Future, Poll, Stream};\n+use futures::future::{self, Either};\n+use tokio_io::{AsyncRead, AsyncWrite};\n+\n+use proto;\n+use super::{dispatch, Request, Response};\n+\n+/// Returns a `Handshake` future over some IO.\n+///\n+/// This is a shortcut for `Builder::new().handshake(io)`.\n+pub fn handshake<T>(io: T) -> Handshake<T, ::Body>\n+where\n+    T: AsyncRead + AsyncWrite,\n+{\n+    Builder::new()\n+        .handshake(io)\n+}\n+\n+/// The sender side of an established connection.\n+pub struct SendRequest<B> {\n+    dispatch: dispatch::Sender<proto::dispatch::ClientMsg<B>, ::Response>,\n+\n+}\n+\n+/// A future that processes all HTTP state for the IO object.\n+///\n+/// In most cases, this should just be spawned into an executor, so that it\n+/// can process incoming and outgoing messages, notice hangups, and the like.\n+pub struct Connection<T, B>\n+where\n+    T: AsyncRead + AsyncWrite,\n+    B: Stream<Error=::Error> + 'static,\n+    B::Item: AsRef<[u8]>,\n+{\n+    inner: proto::dispatch::Dispatcher<\n+        proto::dispatch::Client<B>,\n+        B,\n+        T,\n+        B::Item,\n+        proto::ClientUpgradeTransaction,\n+    >,\n+}\n+\n+\n+/// A builder to configure an HTTP connection.\n+///\n+/// After setting options, the builder is used to create a `Handshake` future.\n+#[derive(Clone, Debug)]\n+pub struct Builder {\n+    h1_writev: bool,\n+    keep_alive: bool,\n+}\n+\n+/// A future setting up HTTP over an IO object.\n+///\n+/// If successful, yields a `(SendRequest, Connection)` pair.\n+pub struct Handshake<T, B> {\n+    inner: HandshakeInner<T, B, proto::ClientUpgradeTransaction>,\n+}\n+\n+/// A future returned by `SendRequest::send_request`.\n+///\n+/// Yields a `Response` if successful.\n+pub struct ResponseFuture {\n+    // for now, a Box is used to hide away the internal `B`\n+    // that can be returned if canceled\n+    inner: Box<Future<Item=Response, Error=::Error>>,\n+}\n+\n+/// Deconstructed parts of a `Connection`.\n+///\n+/// This allows taking apart a `Connection` at a later time, in order to\n+/// reclaim the IO object, and additional related pieces.\n+#[derive(Debug)]\n+pub struct Parts<T> {\n+    /// The original IO object used in the handshake.\n+    pub io: T,\n+    /// A buffer of bytes that have been read but not processed as HTTP.\n+    ///\n+    /// For instance, if the `Connection` is used for an HTTP upgrade request,\n+    /// it is possible the server sent back the first bytes of the new protocol\n+    /// along with the response upgrade.\n+    ///\n+    /// You will want to check for any existing bytes if you plan to continue\n+    /// communicating on the IO object.\n+    pub read_buf: Bytes,\n+    _inner: (),\n+}\n+\n+// internal client api\n+\n+/*\n+pub(super) type ConnectionNoUpgrades<T, B> = proto::dispatch::Dispatcher<\n+    proto::dispatch::Client<B>,\n+    B,\n+    T,\n+    B::Item,\n+    proto::ClientUpgradeTransaction,\n+>;\n+*/\n+\n+pub(super) struct HandshakeNoUpgrades<T, B> {\n+    inner: HandshakeInner<T, B, proto::ClientTransaction>,\n+}\n+\n+struct HandshakeInner<T, B, R> {\n+    builder: Builder,\n+    io: Option<T>,\n+    _marker: PhantomData<(B, R)>,\n+}\n+\n+// ===== impl SendRequest\n+\n+impl<B> SendRequest<B>\n+{\n+    /// Polls to determine whether this sender can be used yet for a request.\n+    ///\n+    /// If the associated connection is closed, this returns an Error.\n+    pub fn poll_ready(&mut self) -> Poll<(), ::Error> {","path":"src/client/conn.rs","position":132,"original_position":132,"commit_id":"7c9565bb3f91be94e6e7957c336e734d87148ff2","original_commit_id":"7c9565bb3f91be94e6e7957c336e734d87148ff2","user":{"login":"sfackler","id":1455697,"avatar_url":"https://avatars0.githubusercontent.com/u/1455697?v=4","gravatar_id":"","url":"https://api.github.com/users/sfackler","html_url":"https://github.com/sfackler","followers_url":"https://api.github.com/users/sfackler/followers","following_url":"https://api.github.com/users/sfackler/following{/other_user}","gists_url":"https://api.github.com/users/sfackler/gists{/gist_id}","starred_url":"https://api.github.com/users/sfackler/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sfackler/subscriptions","organizations_url":"https://api.github.com/users/sfackler/orgs","repos_url":"https://api.github.com/users/sfackler/repos","events_url":"https://api.github.com/users/sfackler/events{/privacy}","received_events_url":"https://api.github.com/users/sfackler/received_events","type":"User","site_admin":false},"body":"Ah cool, makes sense. I was thinking it wouldn't be an error, so I was a bit confused :)","created_at":"2018-03-02T23:29:42Z","updated_at":"2018-03-02T23:29:42Z","html_url":"https://github.com/hyperium/hyper/pull/1454#discussion_r171989023","pull_request_url":"https://api.github.com/repos/hyperium/hyper/pulls/1454","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/hyperium/hyper/pulls/comments/171989023"},"html":{"href":"https://github.com/hyperium/hyper/pull/1454#discussion_r171989023"},"pull_request":{"href":"https://api.github.com/repos/hyperium/hyper/pulls/1454"}},"in_reply_to_id":171453734},"pull_request":{"url":"https://api.github.com/repos/hyperium/hyper/pulls/1454","id":172122520,"html_url":"https://github.com/hyperium/hyper/pull/1454","diff_url":"https://github.com/hyperium/hyper/pull/1454.diff","patch_url":"https://github.com/hyperium/hyper/pull/1454.patch","issue_url":"https://api.github.com/repos/hyperium/hyper/issues/1454","number":1454,"state":"open","locked":false,"title":"feat(client): introduce lower-level Connection API","user":{"login":"seanmonstar","id":51479,"avatar_url":"https://avatars1.githubusercontent.com/u/51479?v=4","gravatar_id":"","url":"https://api.github.com/users/seanmonstar","html_url":"https://github.com/seanmonstar","followers_url":"https://api.github.com/users/seanmonstar/followers","following_url":"https://api.github.com/users/seanmonstar/following{/other_user}","gists_url":"https://api.github.com/users/seanmonstar/gists{/gist_id}","starred_url":"https://api.github.com/users/seanmonstar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/seanmonstar/subscriptions","organizations_url":"https://api.github.com/users/seanmonstar/orgs","repos_url":"https://api.github.com/users/seanmonstar/repos","events_url":"https://api.github.com/users/seanmonstar/events{/privacy}","received_events_url":"https://api.github.com/users/seanmonstar/received_events","type":"User","site_admin":false},"body":"Adds the API described in #1449.\r\n\r\nCloses #1449 ","created_at":"2018-03-01T01:43:41Z","updated_at":"2018-03-02T23:29:42Z","closed_at":null,"merged_at":null,"merge_commit_sha":"bf2bc2b9f5ba311d9ff9386cee07e13a092a5bc6","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/hyperium/hyper/pulls/1454/commits","review_comments_url":"https://api.github.com/repos/hyperium/hyper/pulls/1454/comments","review_comment_url":"https://api.github.com/repos/hyperium/hyper/pulls/comments{/number}","comments_url":"https://api.github.com/repos/hyperium/hyper/issues/1454/comments","statuses_url":"https://api.github.com/repos/hyperium/hyper/statuses/7c9565bb3f91be94e6e7957c336e734d87148ff2","head":{"label":"hyperium:client-connection","ref":"client-connection","sha":"7c9565bb3f91be94e6e7957c336e734d87148ff2","user":{"login":"hyperium","id":8730506,"avatar_url":"https://avatars1.githubusercontent.com/u/8730506?v=4","gravatar_id":"","url":"https://api.github.com/users/hyperium","html_url":"https://github.com/hyperium","followers_url":"https://api.github.com/users/hyperium/followers","following_url":"https://api.github.com/users/hyperium/following{/other_user}","gists_url":"https://api.github.com/users/hyperium/gists{/gist_id}","starred_url":"https://api.github.com/users/hyperium/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hyperium/subscriptions","organizations_url":"https://api.github.com/users/hyperium/orgs","repos_url":"https://api.github.com/users/hyperium/repos","events_url":"https://api.github.com/users/hyperium/events{/privacy}","received_events_url":"https://api.github.com/users/hyperium/received_events","type":"Organization","site_admin":false},"repo":{"id":23500865,"name":"hyper","full_name":"hyperium/hyper","owner":{"login":"hyperium","id":8730506,"avatar_url":"https://avatars1.githubusercontent.com/u/8730506?v=4","gravatar_id":"","url":"https://api.github.com/users/hyperium","html_url":"https://github.com/hyperium","followers_url":"https://api.github.com/users/hyperium/followers","following_url":"https://api.github.com/users/hyperium/following{/other_user}","gists_url":"https://api.github.com/users/hyperium/gists{/gist_id}","starred_url":"https://api.github.com/users/hyperium/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hyperium/subscriptions","organizations_url":"https://api.github.com/users/hyperium/orgs","repos_url":"https://api.github.com/users/hyperium/repos","events_url":"https://api.github.com/users/hyperium/events{/privacy}","received_events_url":"https://api.github.com/users/hyperium/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/hyperium/hyper","description":"An HTTP library for Rust","fork":false,"url":"https://api.github.com/repos/hyperium/hyper","forks_url":"https://api.github.com/repos/hyperium/hyper/forks","keys_url":"https://api.github.com/repos/hyperium/hyper/keys{/key_id}","collaborators_url":"https://api.github.com/repos/hyperium/hyper/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/hyperium/hyper/teams","hooks_url":"https://api.github.com/repos/hyperium/hyper/hooks","issue_events_url":"https://api.github.com/repos/hyperium/hyper/issues/events{/number}","events_url":"https://api.github.com/repos/hyperium/hyper/events","assignees_url":"https://api.github.com/repos/hyperium/hyper/assignees{/user}","branches_url":"https://api.github.com/repos/hyperium/hyper/branches{/branch}","tags_url":"https://api.github.com/repos/hyperium/hyper/tags","blobs_url":"https://api.github.com/repos/hyperium/hyper/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/hyperium/hyper/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/hyperium/hyper/git/refs{/sha}","trees_url":"https://api.github.com/repos/hyperium/hyper/git/trees{/sha}","statuses_url":"https://api.github.com/repos/hyperium/hyper/statuses/{sha}","languages_url":"https://api.github.com/repos/hyperium/hyper/languages","stargazers_url":"https://api.github.com/repos/hyperium/hyper/stargazers","contributors_url":"https://api.github.com/repos/hyperium/hyper/contributors","subscribers_url":"https://api.github.com/repos/hyperium/hyper/subscribers","subscription_url":"https://api.github.com/repos/hyperium/hyper/subscription","commits_url":"https://api.github.com/repos/hyperium/hyper/commits{/sha}","git_commits_url":"https://api.github.com/repos/hyperium/hyper/git/commits{/sha}","comments_url":"https://api.github.com/repos/hyperium/hyper/comments{/number}","issue_comment_url":"https://api.github.com/repos/hyperium/hyper/issues/comments{/number}","contents_url":"https://api.github.com/repos/hyperium/hyper/contents/{+path}","compare_url":"https://api.github.com/repos/hyperium/hyper/compare/{base}...{head}","merges_url":"https://api.github.com/repos/hyperium/hyper/merges","archive_url":"https://api.github.com/repos/hyperium/hyper/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/hyperium/hyper/downloads","issues_url":"https://api.github.com/repos/hyperium/hyper/issues{/number}","pulls_url":"https://api.github.com/repos/hyperium/hyper/pulls{/number}","milestones_url":"https://api.github.com/repos/hyperium/hyper/milestones{/number}","notifications_url":"https://api.github.com/repos/hyperium/hyper/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/hyperium/hyper/labels{/name}","releases_url":"https://api.github.com/repos/hyperium/hyper/releases{/id}","deployments_url":"https://api.github.com/repos/hyperium/hyper/deployments","created_at":"2014-08-30T21:14:33Z","updated_at":"2018-03-02T19:22:21Z","pushed_at":"2018-03-02T22:30:38Z","git_url":"git://github.com/hyperium/hyper.git","ssh_url":"git@github.com:hyperium/hyper.git","clone_url":"https://github.com/hyperium/hyper.git","svn_url":"https://github.com/hyperium/hyper","homepage":"https://hyper.rs","size":24415,"stargazers_count":3236,"watchers_count":3236,"language":"Rust","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":547,"mirror_url":null,"archived":false,"open_issues_count":62,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit"},"forks":547,"open_issues":62,"watchers":3236,"default_branch":"master"}},"base":{"label":"hyperium:master","ref":"master","sha":"4351ed1d13e6f66b8dd3ef9f2b74776d02752ed7","user":{"login":"hyperium","id":8730506,"avatar_url":"https://avatars1.githubusercontent.com/u/8730506?v=4","gravatar_id":"","url":"https://api.github.com/users/hyperium","html_url":"https://github.com/hyperium","followers_url":"https://api.github.com/users/hyperium/followers","following_url":"https://api.github.com/users/hyperium/following{/other_user}","gists_url":"https://api.github.com/users/hyperium/gists{/gist_id}","starred_url":"https://api.github.com/users/hyperium/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hyperium/subscriptions","organizations_url":"https://api.github.com/users/hyperium/orgs","repos_url":"https://api.github.com/users/hyperium/repos","events_url":"https://api.github.com/users/hyperium/events{/privacy}","received_events_url":"https://api.github.com/users/hyperium/received_events","type":"Organization","site_admin":false},"repo":{"id":23500865,"name":"hyper","full_name":"hyperium/hyper","owner":{"login":"hyperium","id":8730506,"avatar_url":"https://avatars1.githubusercontent.com/u/8730506?v=4","gravatar_id":"","url":"https://api.github.com/users/hyperium","html_url":"https://github.com/hyperium","followers_url":"https://api.github.com/users/hyperium/followers","following_url":"https://api.github.com/users/hyperium/following{/other_user}","gists_url":"https://api.github.com/users/hyperium/gists{/gist_id}","starred_url":"https://api.github.com/users/hyperium/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hyperium/subscriptions","organizations_url":"https://api.github.com/users/hyperium/orgs","repos_url":"https://api.github.com/users/hyperium/repos","events_url":"https://api.github.com/users/hyperium/events{/privacy}","received_events_url":"https://api.github.com/users/hyperium/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/hyperium/hyper","description":"An HTTP library for Rust","fork":false,"url":"https://api.github.com/repos/hyperium/hyper","forks_url":"https://api.github.com/repos/hyperium/hyper/forks","keys_url":"https://api.github.com/repos/hyperium/hyper/keys{/key_id}","collaborators_url":"https://api.github.com/repos/hyperium/hyper/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/hyperium/hyper/teams","hooks_url":"https://api.github.com/repos/hyperium/hyper/hooks","issue_events_url":"https://api.github.com/repos/hyperium/hyper/issues/events{/number}","events_url":"https://api.github.com/repos/hyperium/hyper/events","assignees_url":"https://api.github.com/repos/hyperium/hyper/assignees{/user}","branches_url":"https://api.github.com/repos/hyperium/hyper/branches{/branch}","tags_url":"https://api.github.com/repos/hyperium/hyper/tags","blobs_url":"https://api.github.com/repos/hyperium/hyper/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/hyperium/hyper/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/hyperium/hyper/git/refs{/sha}","trees_url":"https://api.github.com/repos/hyperium/hyper/git/trees{/sha}","statuses_url":"https://api.github.com/repos/hyperium/hyper/statuses/{sha}","languages_url":"https://api.github.com/repos/hyperium/hyper/languages","stargazers_url":"https://api.github.com/repos/hyperium/hyper/stargazers","contributors_url":"https://api.github.com/repos/hyperium/hyper/contributors","subscribers_url":"https://api.github.com/repos/hyperium/hyper/subscribers","subscription_url":"https://api.github.com/repos/hyperium/hyper/subscription","commits_url":"https://api.github.com/repos/hyperium/hyper/commits{/sha}","git_commits_url":"https://api.github.com/repos/hyperium/hyper/git/commits{/sha}","comments_url":"https://api.github.com/repos/hyperium/hyper/comments{/number}","issue_comment_url":"https://api.github.com/repos/hyperium/hyper/issues/comments{/number}","contents_url":"https://api.github.com/repos/hyperium/hyper/contents/{+path}","compare_url":"https://api.github.com/repos/hyperium/hyper/compare/{base}...{head}","merges_url":"https://api.github.com/repos/hyperium/hyper/merges","archive_url":"https://api.github.com/repos/hyperium/hyper/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/hyperium/hyper/downloads","issues_url":"https://api.github.com/repos/hyperium/hyper/issues{/number}","pulls_url":"https://api.github.com/repos/hyperium/hyper/pulls{/number}","milestones_url":"https://api.github.com/repos/hyperium/hyper/milestones{/number}","notifications_url":"https://api.github.com/repos/hyperium/hyper/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/hyperium/hyper/labels{/name}","releases_url":"https://api.github.com/repos/hyperium/hyper/releases{/id}","deployments_url":"https://api.github.com/repos/hyperium/hyper/deployments","created_at":"2014-08-30T21:14:33Z","updated_at":"2018-03-02T19:22:21Z","pushed_at":"2018-03-02T22:30:38Z","git_url":"git://github.com/hyperium/hyper.git","ssh_url":"git@github.com:hyperium/hyper.git","clone_url":"https://github.com/hyperium/hyper.git","svn_url":"https://github.com/hyperium/hyper","homepage":"https://hyper.rs","size":24415,"stargazers_count":3236,"watchers_count":3236,"language":"Rust","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":547,"mirror_url":null,"archived":false,"open_issues_count":62,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit"},"forks":547,"open_issues":62,"watchers":3236,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/hyperium/hyper/pulls/1454"},"html":{"href":"https://github.com/hyperium/hyper/pull/1454"},"issue":{"href":"https://api.github.com/repos/hyperium/hyper/issues/1454"},"comments":{"href":"https://api.github.com/repos/hyperium/hyper/issues/1454/comments"},"review_comments":{"href":"https://api.github.com/repos/hyperium/hyper/pulls/1454/comments"},"review_comment":{"href":"https://api.github.com/repos/hyperium/hyper/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/hyperium/hyper/pulls/1454/commits"},"statuses":{"href":"https://api.github.com/repos/hyperium/hyper/statuses/7c9565bb3f91be94e6e7957c336e734d87148ff2"}},"author_association":"OWNER"}}
{"actor":{"display_login":"sfackler"}}