aboutsummaryrefslogtreecommitdiff
path: root/lib/http2.c
AgeCommit message (Collapse)Author
2015-07-23http2: verify success of strchr() in http2_send()Kamil Dudka
Detected by Coverity. Error: NULL_RETURNS: lib/http2.c:1301: returned_null: "strchr" returns null (checked 103 out of 109 times). lib/http2.c:1301: var_assigned: Assigning: "hdbuf" = null return value from "strchr". lib/http2.c:1302: dereference: Incrementing a pointer which might be null: "hdbuf". 1300| 1301| hdbuf = strchr(hdbuf, 0x0a); 1302|-> ++hdbuf; 1303| 1304| authority_idx = 0;
2015-07-21http2: satisfy external references even if http2 is not compiled in.Patrick Monnerat
2015-07-20http2: add stream != NULL checks for reliabilityDaniel Stenberg
They should not trigger, but in case of internal problems we at least avoid crashes this way.
2015-06-24http2: Use nghttp2 library error code for error return valueTatsuhiro Tsujikawa
2015-06-24http2: Harden header validation for curl_pushheader_bynameTatsuhiro Tsujikawa
Since we do prefix match using given header by application code against header name pair in format "NAME:VALUE", and VALUE part can contain ":", we have to careful about existence of ":" in header parameter. ":" should be allowed to match HTTP/2 pseudo-header field, and other use of ":" in header must be treated as error, and curl_pushheader_byname should return NULL. This commit implements this behaviour.
2015-06-24http2: curl_pushheader_byname now takes a const char *Daniel Stenberg
2015-06-24http2: free all header memory after the push callbackDaniel Stenberg
2015-06-24http2: fixed the header accessor functions for the push callbackDaniel Stenberg
2015-06-24http2: setup the new pushed stream properlyDaniel Stenberg
2015-06-24http2: initial implementation of the push callbackDaniel Stenberg
2015-05-25http2: Copy data passed in Curl_http2_switched into HTTP/2 connection bufferTatsuhiro Tsujikawa
Previously, after seeing upgrade to HTTP/2, we feed data followed by upgrade response headers directly to nghttp2_session_mem_recv() in Curl_http2_switched(). But it turns out that passed buffer, mem, is part of stream->mem, and callbacks called by nghttp2_session_mem_recv() will write stream specific data into stream->mem, overwriting input data. This will corrupt input, and most likely frame length error is detected by nghttp2 library. The fix is first copy the passed data to HTTP/2 connection buffer, httpc->inbuf, and call nghttp2_session_mem_recv().
2015-05-22http2: on_frame_recv: return early on stream 0Daniel Stenberg
Coverity CID 1299426 warned about possible NULL dereference otherwise, but that would only ever happen if we get invalid HTTP/2 data with frames for stream 0. Avoid this risk by returning early when stream 0 is used.
2015-05-22http2: Make HTTP Upgrade workTatsuhiro Tsujikawa
This commit just add implicitly opened stream 1 to streams hash.
2015-05-20http2: show stream IDs in decimalDaniel Stenberg
It makes them easier to match output from the nghttpd test server.
2015-05-20http2: Faster http2 uploadTatsuhiro Tsujikawa
Previously, when we send all given buffer in data_source_callback, we return NGHTTP2_ERR_DEFERRED, and nghttp2 library removes this stream temporarily for writing. This itself is good. If this is the sole stream in the session, nghttp2_session_want_write() returns zero, which means that libcurl does not check writeability of the underlying socket. This leads to very slow upload, because it seems curl only upload 16k something per 1 second. To fix this, if we still have data to send, call nghttp2_session_resume_data after nghttp2_session_send. This makes nghttp2_session_want_write() returns nonzero (if connection window still opens), and as a result, socket writeability is checked, and upload speed becomes normal.
2015-05-18http2: store upload state per streamDaniel Stenberg
Use a curl_off_t for upload left
2015-05-18http2: fix build when NOT h2-enabledDaniel Stenberg
2015-05-18http2: switch to use Curl_hash_destroy()Daniel Stenberg
as after 4883f7019d3, the *_clean() function only flushes the hash.
2015-05-18http2: Ignore if we have stream ID not in hash in on_stream_closeTatsuhiro Tsujikawa
We could get stream ID not in the hash in on_stream_close. For example, if we decided to reject stream (e.g., PUSH_PROMISE), then we don't create stream and store it in hash with its stream ID.
2015-05-18Require nghttp2 v1.0.0Tatsuhiro Tsujikawa
This commit requires nghttp2 v1.0.0 to compile, and migrate to v1.0.0, and utilize recent version of nghttp2 to simplify the code, First we use nghttp2_option_set_no_recv_client_magic function to detect nghttp2 v1.0.0. That function only exists since v1.0.0. Since nghttp2 v0.7.5, nghttp2 ensures header field ordering, and validates received header field. If it found error, RST_STREAM with PROTOCOL_ERROR is issued. Since we require v1.0.0, we can utilize this feature to simplify libcurl code. This commit does this. Migration from 0.7 series are done based on nghttp2 migration document. For libcurl, we removed the code sending first 24 bytes client magic. It is now done by nghttp2 library. on_invalid_frame_recv callback signature changed, and is updated accordingly.
2015-05-18http2: infof length in on_frame_send()Daniel Stenberg
2015-05-18http2: bump the h2 buffer size to 32K for speedDaniel Stenberg
2015-05-18http2: remove the stream from the hash in stream_close callbackDaniel Stenberg
... and suddenly things work much better!
2015-05-18http2: if there is paused data, do not clear the drain fieldDaniel Stenberg
2015-05-18http2: rename s/data/pausedataDaniel Stenberg
2015-05-18http2: "stream %x" in all outputs to make it easier to search forDaniel Stenberg
2015-05-18http2: Curl_expire() all handles with incoming trafficDaniel Stenberg
... so that they'll get handled next in the multi loop.
2015-05-18http2: don't signal settings change for same valuesDaniel Stenberg
2015-05-18http2: set default concurrency, fix ConnectionExists for multiplexDaniel Stenberg
2015-05-18bundles: store no/default/pipeline/multiplexDaniel Stenberg
to allow code to act differently on the situation. Also added some more info message for the connection re-use function to make it clearer when connections are not re-used.
2015-05-18http2: lazy init header_recvbufDaniel Stenberg
It makes us use less memory when not doing HTTP/2 and subsequently also makes us not have to cleanup HTTP/2 related data when not using HTTP/2!
2015-05-18http2: separate multiplex/pipelining + cleanup memory leaksDaniel Stenberg
2015-05-18http2: Fix bug that data to be drained are overwritten by pending "paused" dataTatsuhiro Tsujikawa
2015-05-18http2: Don't call nghttp2_session_mem_recv while it is paused by a streamTatsuhiro Tsujikawa
2015-05-18http2: Read data left in connection buffer after pauseTatsuhiro Tsujikawa
Previously when we do pause because of out of buffer, we just throw away unread data in connection buffer. This just broke protocol framing, and I saw occasional FRAME_SIZE_ERROR. This commit fix this issue by remembering how much data read, and in the next iteration, we process remaining data.
2015-05-18http2: Fix streams get stuckTatsuhiro Tsujikawa
This commit fixes the bug that streams get stuck if stream gets some DATA, and stream->closed becomes true at the same time. Previously, in this condition, after we processed DATA, we are going to try to read data from underlying transport, but there is no data, and gets EAGAIN. There was no code path to evaludate stream->closed.
2015-05-18http2: store incoming h2 SETTINGSDaniel Stenberg
2015-05-18http2: remove debug logging from on_frame_recvDaniel Stenberg
2015-05-18http2: remove the closed check in http2_recvDaniel Stenberg
With the "drained" functionality we can get here slightly asynchronously so the stream have have been closed but there is pending data left to read.
2015-05-18http2: bump the h2 buffer to 8KDaniel Stenberg
2015-05-18http2: more debug outputsDaniel Stenberg
2015-05-18http2: leave WAITPERFORM when conn is multiplexedDaniel Stenberg
No need to wait for our "spot" like for pipelining
2015-05-18http2: force "drainage" of streamsDaniel Stenberg
... which is necessary since the socket won't be readable but there is data waiting in the buffer.
2015-05-18http2: move the mem+len pair to the stream structDaniel Stenberg
2015-05-18http2: more stream-oriented data, stream ID 0 is for connectionsDaniel Stenberg
2015-05-18http2: move lots of state data to the 'stream' structDaniel Stenberg
... from the connection struct. The stream one being the 'struct HTTP' which is kept in the SessionHandle struct (easy handle). lookup streams for incoming frames in the stream hash, hashing is based on the stream id and we get the SessionHandle for the incoming stream that way.
2015-05-18HTTP: partial start at fixing up hash-lookups on http2 frame receivalDaniel Stenberg
2015-05-18http: a stream hash for h2 multiplexingDaniel Stenberg
2015-05-18http: a stream hash for h2 multiplexingDaniel Stenberg
2015-05-18http2: debug log when receiving unexpected stream_idDaniel Stenberg