aboutsummaryrefslogtreecommitdiff
path: root/lib/http.c
diff options
context:
space:
mode:
authorFabian Frank <fabian@pagefault.de>2014-01-29 21:28:50 -0800
committerDaniel Stenberg <daniel@haxx.se>2014-01-30 11:34:37 +0100
commitdd011df9e1a31e66611f58758ee93f9a346b36a2 (patch)
treee9fdf81ac03a4216da09bac6cb4fd3c38a2cb9b8 /lib/http.c
parent8e778887b54c059dc32e297caac7e49dfe2801cc (diff)
http2: switch into http2 mode if NPN indicates
Check the NPN result before preparing an HTTP request and switch into HTTP/2.0 mode if necessary. This is a work in progress, the actual code to prepare and send the request using nghttp2 is still missing from Curl_http2_send_request().
Diffstat (limited to 'lib/http.c')
-rw-r--r--lib/http.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/lib/http.c b/lib/http.c
index fe602b9de..063e1fa51 100644
--- a/lib/http.c
+++ b/lib/http.c
@@ -1668,6 +1668,21 @@ CURLcode Curl_http(struct connectdata *conn, bool *done)
the rest of the request in the PERFORM phase. */
*done = TRUE;
+ switch (conn->negnpn) {
+ case NPN_HTTP2_DRAFT09:
+ infof(data, "http, we have to use HTTP-draft-09/2\n");
+ Curl_http2_init(conn);
+ Curl_http2_switched(conn);
+ Curl_http2_send_request(conn);
+ break;
+ case NPN_HTTP1_1:
+ /* continue with HTTP/1.1 when explicitly requested */
+ break;
+ default:
+ /* and as fallback */
+ break;
+ }
+
http = data->req.protop;
if(!data->state.this_is_a_follow) {