Loading lib/http.c +2 −0 Original line number Diff line number Diff line Loading @@ -176,6 +176,8 @@ CURLcode Curl_http_setup_conn(struct connectdata *conn) http->len = BUFSIZE; http->memlen = 0; Curl_http2_setup_conn(conn); return CURLE_OK; } Loading lib/http2.c +13 −0 Original line number Diff line number Diff line Loading @@ -93,6 +93,13 @@ static CURLcode http2_disconnect(struct connectdata *conn, return CURLE_OK; } /* called from Curl_http_setup_conn */ void Curl_http2_setup_conn(struct connectdata *conn) { conn->proto.httpc.settings.max_concurrent_streams = DEFAULT_MAX_CONCURRENT_STREAMS; } /* * HTTP2 handler interface. This isn't added to the general list of protocols * but will be used at run-time when the protocol is dynamically switched from Loading Loading @@ -302,6 +309,9 @@ static int on_frame_recv(nghttp2_session *session, const nghttp2_frame *frame, httpc->settings.max_concurrent_streams)); DEBUGF(infof(conn->data, "ENABLE_PUSH == %s\n", httpc->settings.enable_push?"TRUE":"false")); infof(conn->data, "Connection state changed (MAX_CONCURRENT_STREAMS updated)!\n"); Curl_multi_connchanged(conn->data->multi); break; default: DEBUGF(infof(conn->data, "Got frame type %x for stream %x!\n", Loading Loading @@ -1198,6 +1208,9 @@ CURLcode Curl_http2_setup(struct connectdata *conn) conn->httpversion = 20; conn->bundle->multiuse = BUNDLE_MULTIPLEX; infof(conn->data, "Connection state changed (HTTP/2 confirmed)\n"); Curl_multi_connchanged(conn->data->multi); return CURLE_OK; } Loading lib/http2.h +9 −1 Original line number Diff line number Diff line Loading @@ -7,7 +7,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * * Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al. * Copyright (C) 1998 - 2015, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms Loading @@ -26,6 +26,11 @@ #ifdef USE_NGHTTP2 #include "http.h" /* value for MAX_CONCURRENT_STREAMS we use until we get an updated setting from the peer */ #define DEFAULT_MAX_CONCURRENT_STREAMS 13 /* * Store nghttp2 version info in this buffer, Prefix with a space. Return * total length written. Loading @@ -39,12 +44,15 @@ CURLcode Curl_http2_request_upgrade(Curl_send_buffer *req, CURLcode Curl_http2_setup(struct connectdata *conn); CURLcode Curl_http2_switched(struct connectdata *conn, const char *data, size_t nread); /* called from Curl_http_setup_conn */ void Curl_http2_setup_conn(struct connectdata *conn); #else /* USE_NGHTTP2 */ #define Curl_http2_init(x) CURLE_UNSUPPORTED_PROTOCOL #define Curl_http2_send_request(x) CURLE_UNSUPPORTED_PROTOCOL #define Curl_http2_request_upgrade(x,y) CURLE_UNSUPPORTED_PROTOCOL #define Curl_http2_setup(x) CURLE_UNSUPPORTED_PROTOCOL #define Curl_http2_switched(x,y,z) CURLE_UNSUPPORTED_PROTOCOL #define Curl_http2_setup_conn(x) #endif #endif /* HEADER_CURL_HTTP2_H */ Loading lib/multi.c +34 −1 Original line number Diff line number Diff line Loading @@ -928,6 +928,34 @@ CURLMcode curl_multi_wait(CURLM *multi_handle, return CURLM_OK; } /* * Curl_multi_connchanged() is called to tell that there is a connection in * this multi handle that has changed state (pipelining become possible, the * number of allowed streams changed or similar), and a subsequent use of this * multi handle should move CONNECT_PEND handles back to CONNECT to have them * retry. */ void Curl_multi_connchanged(struct Curl_multi *multi) { multi->recheckstate = TRUE; } /* * multi_ischanged() is called * * Returns TRUE/FALSE whether the state is changed to trigger a CONNECT_PEND * => CONNECT action. * * Set 'clear' to TRUE to have it also clear the state variable. */ static bool multi_ischanged(struct Curl_multi *multi, bool clear) { bool retval = multi->recheckstate; if(clear) multi->recheckstate = FALSE; return retval; } static CURLMcode multi_runsingle(struct Curl_multi *multi, struct timeval now, struct SessionHandle *data) Loading Loading @@ -979,6 +1007,11 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi, return CURLM_INTERNAL_ERROR; } if(multi_ischanged(multi, TRUE)) { DEBUGF(infof(data, "multi changed, check CONNECT_PEND queue!\n")); Curl_multi_process_pending_handles(multi); } if(data->easy_conn && data->mstate > CURLM_STATE_CONNECT && data->mstate < CURLM_STATE_COMPLETED) /* Make sure we set the connection's current owner */ Loading Loading @@ -1750,7 +1783,7 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi, multistate(data, CURLM_STATE_MSGSENT); } } while(rc == CURLM_CALL_MULTI_PERFORM); } while((rc == CURLM_CALL_MULTI_PERFORM) || multi_ischanged(multi, FALSE)); data->result = result; Loading lib/multihandle.h +2 −1 Original line number Diff line number Diff line Loading @@ -102,6 +102,8 @@ struct Curl_multi { /* pipelining wanted bits (CURLPIPE*) */ long pipelining; bool recheckstate; /* see Curl_multi_connchanged */ /* Shared connection cache (bundles)*/ struct conncache conn_cache; Loading Loading @@ -144,4 +146,3 @@ struct Curl_multi { }; #endif /* HEADER_CURL_MULTIHANDLE_H */ Loading
lib/http.c +2 −0 Original line number Diff line number Diff line Loading @@ -176,6 +176,8 @@ CURLcode Curl_http_setup_conn(struct connectdata *conn) http->len = BUFSIZE; http->memlen = 0; Curl_http2_setup_conn(conn); return CURLE_OK; } Loading
lib/http2.c +13 −0 Original line number Diff line number Diff line Loading @@ -93,6 +93,13 @@ static CURLcode http2_disconnect(struct connectdata *conn, return CURLE_OK; } /* called from Curl_http_setup_conn */ void Curl_http2_setup_conn(struct connectdata *conn) { conn->proto.httpc.settings.max_concurrent_streams = DEFAULT_MAX_CONCURRENT_STREAMS; } /* * HTTP2 handler interface. This isn't added to the general list of protocols * but will be used at run-time when the protocol is dynamically switched from Loading Loading @@ -302,6 +309,9 @@ static int on_frame_recv(nghttp2_session *session, const nghttp2_frame *frame, httpc->settings.max_concurrent_streams)); DEBUGF(infof(conn->data, "ENABLE_PUSH == %s\n", httpc->settings.enable_push?"TRUE":"false")); infof(conn->data, "Connection state changed (MAX_CONCURRENT_STREAMS updated)!\n"); Curl_multi_connchanged(conn->data->multi); break; default: DEBUGF(infof(conn->data, "Got frame type %x for stream %x!\n", Loading Loading @@ -1198,6 +1208,9 @@ CURLcode Curl_http2_setup(struct connectdata *conn) conn->httpversion = 20; conn->bundle->multiuse = BUNDLE_MULTIPLEX; infof(conn->data, "Connection state changed (HTTP/2 confirmed)\n"); Curl_multi_connchanged(conn->data->multi); return CURLE_OK; } Loading
lib/http2.h +9 −1 Original line number Diff line number Diff line Loading @@ -7,7 +7,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * * Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al. * Copyright (C) 1998 - 2015, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms Loading @@ -26,6 +26,11 @@ #ifdef USE_NGHTTP2 #include "http.h" /* value for MAX_CONCURRENT_STREAMS we use until we get an updated setting from the peer */ #define DEFAULT_MAX_CONCURRENT_STREAMS 13 /* * Store nghttp2 version info in this buffer, Prefix with a space. Return * total length written. Loading @@ -39,12 +44,15 @@ CURLcode Curl_http2_request_upgrade(Curl_send_buffer *req, CURLcode Curl_http2_setup(struct connectdata *conn); CURLcode Curl_http2_switched(struct connectdata *conn, const char *data, size_t nread); /* called from Curl_http_setup_conn */ void Curl_http2_setup_conn(struct connectdata *conn); #else /* USE_NGHTTP2 */ #define Curl_http2_init(x) CURLE_UNSUPPORTED_PROTOCOL #define Curl_http2_send_request(x) CURLE_UNSUPPORTED_PROTOCOL #define Curl_http2_request_upgrade(x,y) CURLE_UNSUPPORTED_PROTOCOL #define Curl_http2_setup(x) CURLE_UNSUPPORTED_PROTOCOL #define Curl_http2_switched(x,y,z) CURLE_UNSUPPORTED_PROTOCOL #define Curl_http2_setup_conn(x) #endif #endif /* HEADER_CURL_HTTP2_H */ Loading
lib/multi.c +34 −1 Original line number Diff line number Diff line Loading @@ -928,6 +928,34 @@ CURLMcode curl_multi_wait(CURLM *multi_handle, return CURLM_OK; } /* * Curl_multi_connchanged() is called to tell that there is a connection in * this multi handle that has changed state (pipelining become possible, the * number of allowed streams changed or similar), and a subsequent use of this * multi handle should move CONNECT_PEND handles back to CONNECT to have them * retry. */ void Curl_multi_connchanged(struct Curl_multi *multi) { multi->recheckstate = TRUE; } /* * multi_ischanged() is called * * Returns TRUE/FALSE whether the state is changed to trigger a CONNECT_PEND * => CONNECT action. * * Set 'clear' to TRUE to have it also clear the state variable. */ static bool multi_ischanged(struct Curl_multi *multi, bool clear) { bool retval = multi->recheckstate; if(clear) multi->recheckstate = FALSE; return retval; } static CURLMcode multi_runsingle(struct Curl_multi *multi, struct timeval now, struct SessionHandle *data) Loading Loading @@ -979,6 +1007,11 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi, return CURLM_INTERNAL_ERROR; } if(multi_ischanged(multi, TRUE)) { DEBUGF(infof(data, "multi changed, check CONNECT_PEND queue!\n")); Curl_multi_process_pending_handles(multi); } if(data->easy_conn && data->mstate > CURLM_STATE_CONNECT && data->mstate < CURLM_STATE_COMPLETED) /* Make sure we set the connection's current owner */ Loading Loading @@ -1750,7 +1783,7 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi, multistate(data, CURLM_STATE_MSGSENT); } } while(rc == CURLM_CALL_MULTI_PERFORM); } while((rc == CURLM_CALL_MULTI_PERFORM) || multi_ischanged(multi, FALSE)); data->result = result; Loading
lib/multihandle.h +2 −1 Original line number Diff line number Diff line Loading @@ -102,6 +102,8 @@ struct Curl_multi { /* pipelining wanted bits (CURLPIPE*) */ long pipelining; bool recheckstate; /* see Curl_multi_connchanged */ /* Shared connection cache (bundles)*/ struct conncache conn_cache; Loading Loading @@ -144,4 +146,3 @@ struct Curl_multi { }; #endif /* HEADER_CURL_MULTIHANDLE_H */