Commit Graph

406 Commits

Author SHA1 Message Date
Tatsuhiro Tsujikawa 136aae725f nghttpx: Add --no-server-rewrite option not to rewrite server header field 2016-08-31 23:47:15 +09:00
Tatsuhiro Tsujikawa 1064e017c6 nghttpx: Reset stream if invalid header field is received in h2 2016-08-28 00:49:38 +09:00
Tatsuhiro Tsujikawa 0d4d1a63d4 nghttpx: Add --server-name option to change server response header field 2016-08-26 22:28:09 +09:00
Tatsuhiro Tsujikawa 5f65460944 nghttpx: Don't change pushed stream's priority
There is a discussion in httpbis mailing list which argues that
dependency tree is for client, and changing it in server side is not
what client expects.
https://lists.w3.org/Archives/Public/ietf-http-wg/2016JulSep/0416.html

Currently, we make pushed stream depend on the parent stream of
associated stream (that is main HTML in most of the cases), so that
associated stream and pushed stream become siblings.  In this case, we
also observed that these resources complete each other to get its
parent weight.  This means that the delivery of associated stream is
delayed by pushed streams.

So at this moment, it is not a good idea to change pushed stream
priority in a way we do currently.
2016-08-20 22:09:18 +09:00
Tatsuhiro Tsujikawa 4807e71b7d nghttpx: Fix bug that api and healthmon params do not work with http2 proxy 2016-08-18 22:31:53 +09:00
Tatsuhiro Tsujikawa cbced219ec nghttpx: Rewrite read timer handling
For HTTP/2, read timer starts when there is no downstream, and timer
stops when there is at least one downstream.  For HTTP/1, read timer
starts when request handling finished, and timer stops when request
handling starts.
2016-06-24 00:04:39 +09:00
Tatsuhiro Tsujikawa 123752a032 nghttpx: Handle error from push_upload_data and end_upload_data
We have to gracefully handle the case where response ends before
request body is fully received.
2016-06-17 22:32:15 +09:00
Tatsuhiro Tsujikawa 56e7cd4be2 nghttpx: Add healthmon parameter to -f option to enable health monitor mode 2016-06-17 00:00:37 +09:00
Tatsuhiro Tsujikawa af9662f971 nghttpx: Make API processing one of alternative mode 2016-06-16 23:30:35 +09:00
Tatsuhiro Tsujikawa 2867f03861 nghttpx: Close TODO comments 2016-06-05 23:02:50 +09:00
Tatsuhiro Tsujikawa d837887af6 nghttpx: Avoid copy 2016-06-04 16:23:50 +09:00
Tatsuhiro Tsujikawa d0bf247419 nghttpx: Refactor graceful shutdown in Http2Upstream
Instead of using bool flag, just stop prepare watcher.
2016-06-04 12:43:17 +09:00
Tatsuhiro Tsujikawa 845aa7a710 nghttpx: Share downstream config object
This is the unit of sharing configurations to change
2016-06-03 19:57:43 +09:00
Tatsuhiro Tsujikawa 667c8b0e27 nghttpx: Add APIDownstreamConnection to handle API request
For those connections via frontend with api parameter, they use solely
APIDownstreamConnection.

In this commit, APIDownstreamConnection just consumes all request
body, and do nothing.  The next few commits implements our first API
endpoint: /v1/api/dynamicconfig.
2016-06-02 23:50:56 +09:00
Tatsuhiro Tsujikawa e4dc6cf432 src: Use nghttp2_session_set_local_window_size() 2016-05-29 23:34:38 +09:00
Tatsuhiro Tsujikawa 0fca352114 nghttpx: Make SETTINGS timeout value configurable
SETTINGS timeout can be configurable using
--frontend-http2-settings-timeout and
--backend-http2-settings-timeout.
2016-05-21 14:13:57 +09:00
Tatsuhiro Tsujikawa a224aba577 nghttpx: No need to check activeness of SETTINGS ACK timer
We don't have to check activeness of SETTINGS ACK timer since we only
send SETTINGS frame without ACK only once per session at the moment.
2016-05-21 13:18:22 +09:00
Tatsuhiro Tsujikawa 2a3b6c11eb nghttpx: Don't restart SETTINGS timer, and fix log message in HTTP/2 frontend 2016-05-21 10:29:11 +09:00
Tatsuhiro Tsujikawa d2f4e4e325 nghttpx: Always expect response trailer fields 2016-04-27 23:00:36 +09:00
Tatsuhiro Tsujikawa 6f52da834b nghttpx: Fix bug that server push from mruby script did not work 2016-04-16 18:52:14 +09:00
Tatsuhiro Tsujikawa b6708a4b87 nghttpx: Retry next HTTP/2 backend address when connection cannot be made 2016-04-13 00:38:08 +09:00
Tatsuhiro Tsujikawa a14cea6363 nghttpx: Enable link header field based push for non-final response 2016-04-10 18:58:54 +09:00
Tatsuhiro Tsujikawa 46514074a4 nghttpx: Better load balancing between backend HTTP/2 servers 2016-04-03 15:09:01 +09:00
Tatsuhiro Tsujikawa fe0843be88 nghttpx: Fix bug that logger wrote string which was not NULL-terminated 2016-03-28 22:22:26 +09:00
Tatsuhiro Tsujikawa ad8be7d474 src: parse_link_header takes StringRef 2016-03-25 23:51:42 +09:00
Tatsuhiro Tsujikawa 17ccbae084 src: Don't compare against c-string 2016-03-25 00:07:21 +09:00
Tatsuhiro Tsujikawa d7051f5207 nghttpx: Add custom error pages 2016-03-19 23:41:21 +09:00
Tatsuhiro Tsujikawa ab734f09b6 nghttpx: Fix possible crash in rare case 2016-03-15 00:46:15 +09:00
Tatsuhiro Tsujikawa 2a606bae4c Add nghttp2_error_callback to tell application human readable error message 2016-03-13 18:22:52 +09:00
Tatsuhiro Tsujikawa 67569486d1 src: Rewrite http:create_via_header_value 2016-03-12 21:13:09 +09:00
Tatsuhiro Tsujikawa d64051fedc src: Return StringRef from http2::stringify_status 2016-03-12 21:13:09 +09:00
Tatsuhiro Tsujikawa 12dad32890 Add nghttp2_on_header_callback2 2016-03-12 21:13:09 +09:00
Tatsuhiro Tsujikawa eb393985b7 nghttpx: Make a copy before adding header to Downstream 2016-03-12 21:12:26 +09:00
Tatsuhiro Tsujikawa b1b57cc740 nghttpx: Use StringRef for authority, scheme and path 2016-03-12 21:12:26 +09:00
Tatsuhiro Tsujikawa bae37e3e4a nghttpx: Add custom memory allocator mainly for header related objects 2016-03-09 21:16:28 +09:00
Tatsuhiro Tsujikawa fe6ccd16da nghttpx: Change read timeout reset timing 2016-03-05 19:11:36 +09:00
Tatsuhiro Tsujikawa e302cc9c16 src: Simplify function parameter using StringRef 2016-03-04 00:38:43 +09:00
Tatsuhiro Tsujikawa 3f2b54cfc4 src: Refactor using StringRef 2016-03-04 00:33:35 +09:00
Tatsuhiro Tsujikawa acbf38fd3c src: Refactor using StringRef, simplify function parameters 2016-03-04 00:26:59 +09:00
Tatsuhiro Tsujikawa 1e8bea15e5 src: Use StringRef inside LinkHeader 2016-03-03 23:31:44 +09:00
Tatsuhiro Tsujikawa 06921f35f3 nghttpx: Restructure mode settings
It is very hard to support multiple protocols in backend while
retaining multiple mode settings.  Therefore, we dropped modes except
for default and HTTP/2 proxy mode.  The other removed modes can be
emulated using combinations of options.  Now the backend connection is
not encrypted by default.  To enable encryption on backend connection,
use --backend-tls option.
2016-02-28 21:35:26 +09:00
Tatsuhiro Tsujikawa 1832f78684 nghttpx: Move downstream proto to DownstreamAddrGroup 2016-02-28 16:56:14 +09:00
Tatsuhiro Tsujikawa aafcc55006 nghttpx: Deprecate --http2-max-concurrent-streams option
We added 2 new option instead: --frontend-http2-max-concurrent-streams
and --backend-http2-max-concurrent-streams.
2016-02-28 00:19:18 +09:00
Tatsuhiro Tsujikawa 23ecfd412d nghttpx: Fix mruby compile error, clean up add_header interface 2016-02-20 23:30:02 +09:00
Tatsuhiro Tsujikawa 3ff148811b nghttpx: Use StringRef for add_hedeader 2016-02-20 23:30:02 +09:00
Tatsuhiro Tsujikawa 6f1347fc8b nghttpx: Tokenize trailer field as well so that we can ditch prohibited headers in HTTP/2 2016-02-20 23:30:02 +09:00
Tatsuhiro Tsujikawa d8c8a4631d nghttpx: Interleave text/html pushed resources with associated resource 2016-02-14 00:28:08 +09:00
Tatsuhiro Tsujikawa 17758126fa nghttpx: Add headers given in add-response-headers for mruby response 2016-02-13 22:31:38 +09:00
Tatsuhiro Tsujikawa b440f585bc nghttpx: Use Header to store custom request/response header fields 2016-02-13 22:19:05 +09:00
Tatsuhiro Tsujikawa ee07694783 nghttpx: Add request-header-field-buffer and max-request-header-fields options
This commit adds request-header-field-buffer and
max-request-header-fields, and deprecates header-field-buffer and
max-header-fields options.
2016-02-06 17:22:23 +09:00
Tatsuhiro Tsujikawa 85bb37ab7c Enable ConstructorInitializerAllOnOneLineOrOnePerLine for better diff 2016-01-27 21:14:07 +09:00
Tatsuhiro Tsujikawa 98253b1d0d nghttpx: Use DefaultMemchunks as HTTP/2 and SPDY frontend response buffer 2016-01-27 15:28:01 +09:00
Tatsuhiro Tsujikawa 497ffc6387 nghttpx: Change pushed stream's priority
By default, as RFC 7540 calls for, pushed stream depends on its
associated (parent) stream.  There are some situations that this is
sub-optimal.  For example, if associated stream is HTML, and server is
configured to push css and javascript files which are in critical
rendering path.  Then the default priority scheme is sub-optimal,
since browser typically blocks rendering while waiting for critical
resources.  In this case, it is better to at least give pushed stream
the same priority of associated stream, and interleave these streams.

This change gives pushed stream the same priority of associated stream
if pushed stream has content-type "application/javascript" or
"text/css".  The pushed stream now depends on the stream which
associated stream depends on.  We use the same weight of associated
stream.
2016-01-21 21:11:57 +09:00
Tatsuhiro Tsujikawa eb8649bf9b nghttpx: Don't greedily read data from backend
This might help throughput, but it interfere stream priority.  The
throughput issue is generally caused by the small buffer size to store
response body, which was 16K.  We increased it to 128K to compensate
this change.
2016-01-20 11:20:15 +09:00
Tatsuhiro Tsujikawa 0402481be4 nghttpx: Organize connection related configuration into struct 2016-01-19 16:56:12 +09:00
Tatsuhiro Tsujikawa 16549bb276 nghttpx: Structured configurations for http and http2 2016-01-18 17:00:20 +09:00
Tatsuhiro Tsujikawa ef5d981ab1 nghttpx: Simplify 2016-01-17 17:04:16 +09:00
Tatsuhiro Tsujikawa d16ff1f519 nghttpx: Use StringAdaptor for Config::server_name 2016-01-17 01:15:11 +09:00
Tatsuhiro Tsujikawa f25fd09bbb nghttpx: Don't emit :authority if request dones not contain authority info
RFC 7540 says that proxy should not emit :authority when translating
HTTP/1 request in origin or asterisk form to HTTP/2.  To keep this
semantics in tact, we should also refrain from emitting :authority if
it is missing (host header field is required in this case).
2016-01-16 21:12:51 +09:00
Tatsuhiro Tsujikawa f8472f4709 nghttpx: Remove backend priority handling code
Currently, this does not do anything useful.
2016-01-15 00:17:40 +09:00
Tatsuhiro Tsujikawa 5a8cf94361 nghttpx: Refactor Downstream::response_sent_bodylen_ 2016-01-14 23:54:28 +09:00
Tatsuhiro Tsujikawa fa31d0940c nghttpx: Refactor Downstream::request_datalen_ 2016-01-14 23:36:47 +09:00
Tatsuhiro Tsujikawa e7e52b11ce nghttpx: Refactor Downstream::response_bodylen_ 2016-01-14 23:20:44 +09:00
Tatsuhiro Tsujikawa 3b8889a2a1 nghttpx: Extract response related fields to Response struct 2016-01-14 01:05:10 +09:00
Tatsuhiro Tsujikawa 919f08eb38 nghttpx: Extract request related fields to Request struct
Header field related functions are now gathered into FieldStore class.
This commit only handles request.  Subsequent commit will do the same
thing for response.
2016-01-14 01:04:32 +09:00
Tatsuhiro Tsujikawa 6566ea7d6b nghttpx: Update doc 2016-01-11 17:36:47 +09:00
Tatsuhiro Tsujikawa 2f50bc1b3c nghttpx: Take into account of trailers when applying max_header_fields 2016-01-05 16:47:44 +09:00
Tatsuhiro Tsujikawa 1753bea692 nghttpx: Support server push from HTTP/2 backend
This commits enables HTTP/2 server push from HTTP/2 backend to be
relayed to HTTP/2 frontend.  To use this feature, --http2-bridge or
--client is required.  Server push via Link header field contiues to
work.
2015-11-16 23:12:25 +09:00
Tatsuhiro Tsujikawa c3459c9e86 nghttpx: Clarify return value of nghttp2_submit_push_promise is stream ID 2015-11-16 21:44:36 +09:00
Tatsuhiro Tsujikawa fe8720341d nghttpx: Fix crash on non-final response from backend server 2015-11-13 23:59:36 +09:00
Tatsuhiro Tsujikawa c6ef1c02b9 Switch to clang-format-3.6 2015-11-13 00:53:29 +09:00
Tatsuhiro Tsujikawa 558934cee5 src: Use nghttp2_session_upgrade2 2015-11-07 16:13:06 +09:00
Tatsuhiro Tsujikawa ac41946533 nghttpx: Use NGHTTP2_NV_FLAG_NO_COPY_NAME and NGHTTP2_NV_FLAG_NO_COPY_VALUE
For both HTTP/2 frontend and backend.

Also adds http2::stringify_status to optimize status code
serialization.
2015-11-05 23:47:11 +09:00
Tatsuhiro Tsujikawa 0155c9115a nghttpx: Fix so that --padding option works again 2015-10-04 10:36:20 +09:00
Tatsuhiro Tsujikawa e95b39d534 nghttpx: Fix sent bodylen logging 2015-10-03 19:14:26 +09:00
Tatsuhiro Tsujikawa ccbaaa1e14 nghttpx: Fix freeze in large transfer 2015-10-03 19:00:16 +09:00
Tatsuhiro Tsujikawa 777e1ee2c5 nghttpx: Use send_data_callback for higher throughput 2015-10-03 17:56:37 +09:00
Tatsuhiro Tsujikawa da89f9c150 nghttpx: Refactor client handler write
Move write buffer to Upstream objects
2015-10-03 11:09:42 +09:00
Tatsuhiro Tsujikawa d22573086f nghttpx: Add x-http2-push header field for pushed resource
Fixes GH-352
2015-09-14 00:28:19 +09:00
Tatsuhiro Tsujikawa 1148584526 nghttpx: Reserve room for required header fields for PUSH_PROMISE 2015-09-14 00:26:50 +09:00
Tatsuhiro Tsujikawa 57aee184ca Update doc 2015-09-12 18:33:07 +09:00
Tatsuhiro Tsujikawa 3ce1c1d39f nghttpx: Add date header field to error_reply and send_reply 2015-09-07 23:11:23 +09:00
Tatsuhiro Tsujikawa 1b63e6d478 nghttpx: Call request phase hook for pushed resource as well 2015-09-06 15:21:36 +09:00
Tatsuhiro Tsujikawa 28defbfb4a nghttpx: Allow link header server push for HTTP/2 backend as well 2015-09-06 15:12:20 +09:00
Tatsuhiro Tsujikawa 1df682140c nghttpx: Don't do mruby push with --no-server-push option 2015-09-06 00:06:48 +09:00
Tatsuhiro Tsujikawa ef1595672c nghttpx: Add Request#push in mruby scripting
Refactor Http2Upstream so that we can share code between link header
field based push and mruby push.
2015-09-06 00:05:07 +09:00
Tatsuhiro Tsujikawa 77958eab46 Merge branch 'master' into nghttpx-mruby 2015-09-05 19:04:04 +09:00
Tatsuhiro Tsujikawa 8f41accf41 nghttpx: Don't initiate push if client disabled push 2015-09-05 19:02:55 +09:00
Tatsuhiro Tsujikawa e19d5efced nghttpx: Allow absolute URI in Link header field for push 2015-09-05 19:01:02 +09:00
Tatsuhiro Tsujikawa a9338f1c0e nghttpx: Fix hang when error page is sent on response phase hook error 2015-09-04 22:34:40 +09:00
Tatsuhiro Tsujikawa 9e685a2734 nghttpx: Various test failures 2015-09-04 02:47:25 +09:00
Tatsuhiro Tsujikawa d044c58558 nghttpx: Detect mruby presence and guard mruby related code with ifdef 2015-09-04 00:54:41 +09:00
Tatsuhiro Tsujikawa 200217d8ea nghttpx: Store empty string to path for server-wide OPTIONS request
This change is required to show path attribute to mruby script.  It is
desirable to construct URI from parts.  Just checking method and path
is "*" is awkward.
2015-09-04 00:14:09 +09:00
Tatsuhiro Tsujikawa 02bb2c3e83 nghttpx: Create authority from host or authority-form for CONNECT request 2015-09-03 23:36:49 +09:00
Tatsuhiro Tsujikawa 65f2b16132 nghttpx: More freedom for custom response headers 2015-09-03 22:29:16 +09:00
Tatsuhiro Tsujikawa baadec5ef4 nghttpx: Add response mruby hook 2015-09-03 01:33:52 +09:00
Tatsuhiro Tsujikawa e06af02573 nghttpx: Add Response mruby object 2015-09-03 00:40:14 +09:00
Tatsuhiro Tsujikawa e436caf0bb nghttpx: Don't forward request if response was commited in mruby hook 2015-09-02 23:22:26 +09:00
Tatsuhiro Tsujikawa 1508c50a45 nghttpx: Add basic infrastructure for mruby support 2015-09-02 02:45:15 +09:00
Tatsuhiro Tsujikawa 0bbff5b738 nghttpx: Continue if push was failed 2015-07-31 21:25:43 +09:00