diff options
author | Diego Bes <dbesprosvan@ahoffeld-pc.tango.corp> | 2016-03-18 15:25:56 -0700 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2016-03-31 22:23:11 +0200 |
commit | 324a97ecf82e5e415c3c9fb4df093053c1efedf1 (patch) | |
tree | ff166eca2ab220199c1cb8d46575d6a37f0e61ac /lib | |
parent | e683182918bafbe40d4525e51f6d360bfba14bfa (diff) |
http2: support "prior knowledge", no upgrade from HTTP/1.1
Supports HTTP/2 over clear TCP
- Optimize switching to HTTP/2 by removing calls to init and setup
before switching. Switching will eventually call setup and setup calls
init.
- Supports new version to “force” the use of HTTP/2 over clean TCP
- Add common line parameter “--http2-prior-knowledge” to the Curl
command line tool.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/http.c | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/lib/http.c b/lib/http.c index 94a1e936e..f261b3deb 100644 --- a/lib/http.c +++ b/lib/http.c @@ -1792,13 +1792,6 @@ CURLcode Curl_http(struct connectdata *conn, bool *done) switch(conn->negnpn) { case CURL_HTTP_VERSION_2: conn->httpversion = 20; /* we know we're on HTTP/2 now */ - result = Curl_http2_init(conn); - if(result) - return result; - - result = Curl_http2_setup(conn); - if(result) - return result; result = Curl_http2_switched(conn, NULL, 0); if(result) @@ -1808,7 +1801,18 @@ CURLcode Curl_http(struct connectdata *conn, bool *done) /* continue with HTTP/1.1 when explicitly requested */ break; default: - /* and as fallback */ + /* Check if user wants to use HTTP/2 with clear TCP*/ +#ifdef USE_NGHTTP2 + if(conn->data->set.httpversion == + CURL_HTTP_VERSION_2_PRIOR_KNOWLEDGE) { + DEBUGF(infof(data, "HTTP/2 over clean TCP\n")); + conn->httpversion = 20; + + result = Curl_http2_switched(conn, NULL, 0); + if(result) + return result; + } +#endif break; } } |