Commit Graph

64 Commits

Author SHA1 Message Date
Tatsuhiro Tsujikawa e34b8ac7fb src: Avoid to call costly evbuffer_add() repeatedly
The profiler and benchmarking showed that calling evbuffer_add()
repeatedly is very costly. To avoid this, we buffer up small writes
into one large chunk and call evbuffer_add() less times.
2014-03-03 23:45:57 +09:00
Tatsuhiro Tsujikawa dfbea797bd src: Use static_cast instead of reinterpret_cast if possible 2014-01-19 21:18:37 +09:00
Tatsuhiro Tsujikawa a37bc88f40 nghttpx: Rename ClientHandler::get_pending_write_length to get_outbuf_length
And other renames.
2014-01-19 17:49:04 +09:00
Tatsuhiro Tsujikawa bacea078da nghttpx: Take into account both frontend buffer and body buffer length 2014-01-19 17:42:31 +09:00
Tatsuhiro Tsujikawa f59a9c5c58 nghttpx: Disable TLS renegotiation properly
4ed4efc does not disable TLS renegotiation at all, if client keeps
rengotiations without sending application data. In this change,
we intercept the raw incoming data from the client and if it is a
renegotiation, drop the connection immediately.
2014-01-19 17:25:18 +09:00
Tatsuhiro Tsujikawa 707a0b4103 Move name/value validation functions to src
nghttp2 library itself now accept octet header/value pairs,
completely not restricted by HTTP/1 header name/value rule.
The applications may impose restriction about them using
validators.
2014-01-17 02:16:53 +09:00
Tatsuhiro Tsujikawa 0e4b3d435e Emit header name/value pair using callback functions
Now, in nghttp2_on_frame_recv_callback, nva and nvlen in
HEADERS and PUSH_PROMISE frames are always NULL and 0 respectively.
The header name/value pairs are emitted successive
nghttp2_on_header_callback functions. The end of header fields are
signaled with nghttp2_on_end_headers_callback function.

Since NGHTTP2_ERR_PAUSE for nghttp2_on_frame_recv_callback is
introduced to handle header block, it is now deprecated.
Instead, nghttp2_on_header_callback can be paused using
NGHTTP2_ERR_PAUSE.
2014-01-17 01:49:43 +09:00
Tatsuhiro Tsujikawa 1c43cdbbc8 nghttpx: Don't rewrite location if proxy mode is used 2013-12-28 17:02:43 +09:00
Tatsuhiro Tsujikawa e955598923 nghttpx: Remove downstream_port from location rewrite code 2013-12-21 18:35:53 +09:00
Tatsuhiro Tsujikawa ccfa13cd5b nghttpx: Rewrite location header field
We thought that this kind of rewrite can be achieved by the configuration
of the backend severs, but in some configuration, however, it may get
complicated. So we decided to implement at least location rewrite in
nghttpx.

This commit also contains a fix to the bug which prevents the http2
backend request from concatenating header fields with the same value.
2013-12-21 17:49:31 +09:00
Tatsuhiro Tsujikawa 9f7b231c2c nghttpx: Code cleanup 2013-12-20 23:36:24 +09:00
Tatsuhiro Tsujikawa b38b233aa6 nghttpx: Check failure of evbuffer_* and bufferevent_* functions 2013-12-20 23:28:54 +09:00
Tatsuhiro Tsujikawa 6ea91e57e0 Adjust struct/class alignment 2013-12-06 23:17:38 +09:00
Tatsuhiro Tsujikawa 01f7162be3 nghttpx: Add connection-level flow control window size options
This commit also changes SPDY's flow control size. Previously,
the size for SPDY is the same amount of bytes with HTTP/2.
For example, --frontend-http2-upstream-window-bits=N,
the window size is 2**N - 1. Now SPDY code uses 2**N.
2013-11-21 00:15:17 +09:00
Tatsuhiro Tsujikawa 0ba2883940 nghttpx: Use initial window size in config directly 2013-11-12 11:08:43 +09:00
Tatsuhiro Tsujikawa 58beaa371d nghttpx: Support spdy/3.1, require spdylay >= 1.2.0 2013-11-12 11:03:46 +09:00
Tatsuhiro Tsujikawa b1905c5815 nghttpx: More replacement of spdy with http2 2013-11-04 18:22:29 +09:00
Tatsuhiro Tsujikawa ba3db66cec nghttpx: Replace "spdy" in option name with "http2" 2013-11-04 18:14:05 +09:00
Tatsuhiro Tsujikawa f3d71aa5bb nghttpx: Rename Spdy{Session,DownstreamConnection} to Http2{*} 2013-11-04 17:53:57 +09:00
Tatsuhiro Tsujikawa 9b6a0e5875 nghttpx: Fix stream hang with request body
The end of request stream is not detected correct place.
Also Downstream::end_upload_data() is not called.
2013-10-30 00:00:58 +09:00
Tatsuhiro Tsujikawa 67553d47e0 nghttpx: Use :authority and host instead of :host 2013-10-27 16:25:50 +09:00
Tatsuhiro Tsujikawa f355187176 nghttpx: Fix missing extension HTTP status code in response 2013-10-02 23:29:44 +09:00
Tatsuhiro Tsujikawa 825c1bac6b shrpx_downstream.cc: Utilize std::move 2013-09-24 23:53:55 +09:00
Tatsuhiro Tsujikawa cbef6fd0c6 nghttpx: Replace \r\n with space when constructing HTTP/1 headers 2013-09-11 23:24:32 +09:00
Tatsuhiro Tsujikawa 776cff3dc7 src: Use std::unique_ptr for nv 2013-09-07 01:52:46 +09:00
Tatsuhiro Tsujikawa 586533be2f nghttpx: Fix CONNECT fail on SPDY upstream 2013-09-05 23:40:48 +09:00
Tatsuhiro Tsujikawa 3544bfdbef src: Move pure HTTP code from shrpx_http.cc to http2.cc 2013-08-28 02:47:22 +09:00
Tatsuhiro Tsujikawa 1f3b96e233 nghttpx: Rewrite header handling 2013-08-28 00:09:46 +09:00
Tatsuhiro Tsujikawa 358d12a842 nghttpx: Fix bug CONNECT does not work 2013-08-22 21:28:27 +09:00
Tatsuhiro Tsujikawa 823bb6c35e nghttpx: Require content-length in SPDY upstream if FIN flag is not set 2013-08-21 01:05:06 +09:00
Tatsuhiro Tsujikawa aa9688b459 nghttpx: Fix possible multiple replies on HTTP2 and SPDY upstreams 2013-08-21 00:56:08 +09:00
Tatsuhiro Tsujikawa fafec1fdb8 nghttpx: Accept incoming bytes at least initial window size 2013-08-07 21:27:08 +09:00
Tatsuhiro Tsujikawa f613f68a13 src: Make window size - 1
To match the -w16 to 65535, which is HTTP/2.0 default initial window
size, decrement 1 from (1 << window_bits).
2013-08-03 19:53:07 +09:00
Tatsuhiro Tsujikawa fec566aa23 src: Send out data in output buffer before HTTP2/SPDY session tear down 2013-08-01 20:31:29 +09:00
Tatsuhiro Tsujikawa 924b1bd61a Use unmodified http-parser
Handle HTTP Upgrade and CONNECT explicitly
2013-07-31 21:48:37 +09:00
Tatsuhiro Tsujikawa 32bd1425b4 shrpx: SPDY support in upstream connection 2013-07-26 20:12:55 +09:00
Tatsuhiro Tsujikawa 41b21f7938 fixup 2013-07-26 19:38:54 +09:00
Tatsuhiro Tsujikawa 18f450fd2a Port shrpx to nghttp2 use 2013-07-26 19:33:25 +09:00
Tatsuhiro Tsujikawa 0edce70343 Rebranding nghttp2 2013-07-13 00:43:06 +09:00
Tatsuhiro Tsujikawa eddd48b783 shrpx: Don't issue RST_STREAM on downstream tunnel connection EOF
The RST_STREAM will be issued in spdy_data_read_callback.
2013-03-01 20:43:35 +09:00
Tatsuhiro Tsujikawa 2d23ae3741 shrpx: Fix missing delete 2013-03-01 00:07:00 +09:00
Tatsuhiro Tsujikawa cf1cfca51f shrpx: Fix not send RST_STREAM when downstream gets valid EOF 2013-03-01 00:05:57 +09:00
Tatsuhiro Tsujikawa da36fc3953 shrpx: Fix WINDOW_UPDATE may block until SpdyUpstream::send()
spdy_data_read_callback in SpdyDownstreamConnection calls
SpdyUpstream::resume_read() which submits WINDOW_UPDATE, but after
that they are not call SpdyUpstream::send(). This means that if no
pending outgoing data in upstream, then WINDOW_UPDATE is blocked until
SpdyUpstream::send() from somewhere. This change adds
SpdyUpstream::send() to resume_read() so that WINDOW_UPDATE is not
blocked.
2013-02-27 22:55:44 +09:00
Tatsuhiro Tsujikawa 7b3f57cef8 shrpx: Fix blocking upstream RST_STREAM and propagate REFUSED_STREAM
This change fixes upstream RST_STREAM is blocked until
SpdyUpstream::send() is called. Now downstream REFUSED_STREAM is
propagated to upstream client so that client can reset request.  The
RST_STREAM error code when downstream went wrong is changed from
CANCEL to INTERNAL_ERROR.
2013-02-27 22:39:44 +09:00
Tatsuhiro Tsujikawa dbb0df5c5b Remove strerror(3) from code which may run in multi-thread 2013-02-25 22:43:44 +09:00
Tatsuhiro Tsujikawa d830e099a6 shrpx: Send pending response data before RST_STREAM in tunnel connection 2013-02-11 02:05:11 +09:00
Tatsuhiro Tsujikawa 734d7bced8 shrpx: Handle downstream response_state == MSG_RESET case in SPDY upstream 2013-02-09 23:20:29 +09:00
Tatsuhiro Tsujikawa b43b31c362 shrpx: Remove x-forwarded-spdy header field 2013-02-09 17:21:46 +09:00
Tatsuhiro Tsujikawa 9ba19df813 shrpx: Add --spdy-bridge option
With --spdy-bridge option, it listens SPDY/HTTPS connections from
front end and forwards them to the backend in SPDY. The usage will be
written later. This change fixes the crash when more than 2
outstanding SpdyDownstreamConnection objects are added to SpdySession
and establishing connection to SPDY backend is failed.
2013-02-08 21:46:58 +09:00
Tatsuhiro Tsujikawa f0fc026799 shrpx: Check return value of library functions 2013-01-25 22:58:07 +09:00