From dd011df9e1a31e66611f58758ee93f9a346b36a2 Mon Sep 17 00:00:00 2001 From: Fabian Frank Date: Wed, 29 Jan 2014 21:28:50 -0800 Subject: 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(). --- lib/http.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'lib/http.c') 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) { -- cgit v1.2.3