mirror of
https://github.com/curl/curl.git
synced 2026-07-28 22:53:07 +03:00
HTTP2: add layer between existing http and socket(TLS) layer
This patch chooses different approach to integrate HTTP2 into HTTP curl stack. The idea is that we insert HTTP2 layer between HTTP code and socket(TLS) layer. When HTTP2 is initialized (either in NPN or Upgrade), we replace the Curl_recv/Curl_send callbacks with HTTP2's, but keep the original callbacks in http_conn struct. When sending serialized data by nghttp2, we use original Curl_send callback. Likewise, when reading data from network, we use original Curl_recv callback. In this way we can treat both TLS and non-TLS connections. With this patch, one can transfer contents from https://twitter.com and from nghttp2 test server in plain HTTP as well. The code still has rough edges. The notable one is I could not figure out how to call nghttp2_session_send() when underlying socket is writable.
This commit is contained in:
parent
4d8db595ca
commit
63b26d889f
3 changed files with 211 additions and 51 deletions
|
|
@ -1056,6 +1056,7 @@ CURLcode Curl_add_buffer_send(Curl_send_buffer *in,
|
|||
return res;
|
||||
}
|
||||
|
||||
|
||||
if(conn->handler->flags & PROTOPT_SSL) {
|
||||
/* We never send more than CURL_MAX_WRITE_SIZE bytes in one single chunk
|
||||
when we speak HTTPS, as if only a fraction of it is sent now, this data
|
||||
|
|
@ -1673,7 +1674,6 @@ CURLcode Curl_http(struct connectdata *conn, bool *done)
|
|||
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 */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue