Commit Graph

2473 Commits

Author SHA1 Message Date
Tatsuhiro Tsujikawa 2b22ec42c7 Merge branch 'dev/expect-continue' of https://github.com/jchampio/nghttp2 into jchampio-dev/expect-continue 2016-03-31 20:00:27 +09:00
Jacob Champion dfdeeb3815 nghttp: only stop ContinueTimers if they exist
Fix a crash on disconnect if --expect-continue isn't actually in use.
2016-03-29 16:02:10 -07:00
Jacob Champion 4bed7854b5 nghttp: move ownership of ContinueTimer to Request
Each Request now owns its own (optional) ContinueTimer for
Expect/Continue handshakes. This removes the need for
shared_ptr/weak_ptr logic.
2016-03-29 13:11:27 -07:00
Jacob Champion aa64e7ad3c nghttp: stop ContinueTimers on response or reset
If the stream itself is reset, or the server sends a final response
immediately, any Expect/Continue handshake should be cancelled.
2016-03-29 12:41:28 -07:00
Tatsuhiro Tsujikawa e30edb096a clang-format 2016-03-29 22:11:42 +09:00
Tatsuhiro Tsujikawa cdb466956d nghttpx: One more fix for usage help 2016-03-29 22:10:30 +09:00
Jianqing Wang 199600af73 Fix error messages on deprecated mode 2016-03-29 12:09:52 +08:00
Jacob Champion edb874e659 nghttp: move ContinueTimer start to on_frame_send
The ContinueTimer could expire before the full HEADERS frame was
actually sent. By moving the call to timer->start() to the
on_frame_send_callback(), this race is fixed.
2016-03-28 15:24:20 -07: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 ff07018720 nghttpx: Fix bug that proxy with HTTP/1.1 CONNECT did not work
This was a regression in 5fbe4cc225.
2016-03-28 22:05:38 +09:00
Tatsuhiro Tsujikawa 757bcf1310 nghttpx: Fix bug that backend tls keyword did not work with -s option 2016-03-27 17:11:44 +09:00
Tatsuhiro Tsujikawa c9aba4ea0c nghttpx: Don't use data_prd.source.ptr 2016-03-27 16:57:43 +09:00
Tatsuhiro Tsujikawa 2cee80acf0 nghttpx: Fix handing stream after connection check was failed 2016-03-27 15:53:26 +09:00
Tatsuhiro Tsujikawa d9a2ff278c src: Use len instead of n for clarity 2016-03-27 15:52:24 +09:00
Tatsuhiro Tsujikawa ad8be7d474 src: parse_link_header takes StringRef 2016-03-25 23:51:42 +09:00
Tatsuhiro Tsujikawa 07926cffca src: Remove lookup_method_token(const std::string&) 2016-03-25 23:31:46 +09:00
Tatsuhiro Tsujikawa 00b2d7d513 src: Remove lookup_token(const std::string&) 2016-03-25 23:29:16 +09:00
Tatsuhiro Tsujikawa f74d7ea119 src: Don't allow const char * in starts_with 2016-03-25 23:20:48 +09:00
Tatsuhiro Tsujikawa 2bca6360b6 src: Don't allow const char * in istarts_with and istarts_with_l 2016-03-25 23:18:31 +09:00
Tatsuhiro Tsujikawa 841b3c87db src: Don't allow const char * in ends_with and ends_with_l 2016-03-25 23:04:44 +09:00
Tatsuhiro Tsujikawa 2ab79f4938 src: Don't allow const char * in iends_with and iends_with_l 2016-03-25 23:00:34 +09:00
Tatsuhiro Tsujikawa 2182a85875 src: Make strifind functin template 2016-03-25 22:56:23 +09:00
Tatsuhiro Tsujikawa 72d8d78d36 src: Don't allow const char * in 2nd argument of streq_l(S[N], T) 2016-03-25 22:53:31 +09:00
Tatsuhiro Tsujikawa dad61d032e src: Don't allow const char * in 2nd argument of strieq_l(S[N], T) 2016-03-25 22:51:20 +09:00
Tatsuhiro Tsujikawa 1bbb241baa src: Make streq(T, S) function template 2016-03-25 22:48:13 +09:00
Tatsuhiro Tsujikawa 3e6c38e3be src: Made strieq(T, S) template 2016-03-25 22:45:33 +09:00
Tatsuhiro Tsujikawa 9272e80fa6 nghttpx: Fix compile error on travis 2016-03-25 02:28:10 +09:00
Tatsuhiro Tsujikawa 44af3dab50 nghttpx: Update doc 2016-03-25 02:14:39 +09:00
Tatsuhiro Tsujikawa 22128767e6 nghttpx: Fix formatting issue on manual page 2016-03-25 02:08:25 +09:00
Tatsuhiro Tsujikawa a46c815e4e src: StringRef-fy 2016-03-25 01:41:06 +09:00
Tatsuhiro Tsujikawa 186d440168 nghttpx: More StringRef-fy 2016-03-25 01:19:42 +09:00
Tatsuhiro Tsujikawa a9e365ad7d fixup! nghttpx: More StringRef-fy 2016-03-25 01:10:48 +09:00
Tatsuhiro Tsujikawa a104d8a80b fixup! nghttpx: Use StringRef for SHRPX_UNIX_PATH_PREFIX 2016-03-25 01:10:25 +09:00
Tatsuhiro Tsujikawa a5029d1eed nghttpx: More StringRef-fy 2016-03-25 01:07:22 +09:00
Tatsuhiro Tsujikawa 848e45e333 nghttpx: Use StringRef for SHRPX_UNIX_PATH_PREFIX 2016-03-25 01:00:04 +09:00
Tatsuhiro Tsujikawa 79968c6374 src: Rewrite strifind 2016-03-25 00:27:59 +09:00
Tatsuhiro Tsujikawa 1699aef609 src: Remove strcompare 2016-03-25 00:16:25 +09:00
Tatsuhiro Tsujikawa 2d2d6c3cc0 src: Remove istarts_with(const char*) overload 2016-03-25 00:14:12 +09:00
Tatsuhiro Tsujikawa bfccab9b9f src: Remove starts_with(const char*, const char*) overload 2016-03-25 00:09:53 +09:00
Tatsuhiro Tsujikawa 17ccbae084 src: Don't compare against c-string 2016-03-25 00:07:21 +09:00
Tatsuhiro Tsujikawa 0875e66aab src: Remove streq(const char *) overload 2016-03-25 00:02:07 +09:00
Tatsuhiro Tsujikawa 4dfae3484f nghttpx: Refactor CertLookupTree interface 2016-03-24 23:35:15 +09:00
Tatsuhiro Tsujikawa 372123c178 nghttpx: Remove strieq(const char*, cosnt char*) overload, and fix unittests 2016-03-24 23:34:56 +09:00
Tatsuhiro Tsujikawa 13596bde90 nghttpx: Refactor option handling using StringRef 2016-03-24 22:15:58 +09:00
Jacob Champion 3b7b6a660e nghttp: prevent ContinueTimer double-invocation
If a 100 Continue interim response was received after the continue
timeout was reached, dispatch_continue() would force a double submission
of DATA frames. This patch prevents dispatch_continue() from doing
anything if the timer callback has already been invoked. This makes
ContinueTimer a single-shot mechanism, as originally intended.
2016-03-23 09:09:13 -07:00
Tatsuhiro Tsujikawa daa1ae3a45 nghttpx: Cosmetic change 2016-03-24 00:38:10 +09:00
Tatsuhiro Tsujikawa 44ee67ff71 nghttpx: Refactor split_host_port 2016-03-24 00:35:13 +09:00
Tatsuhiro Tsujikawa 144ae3af9d nghttpx: Memcached connection encryption with tls keyword
Like frontend and backend options, encryption for memcached
connections is configured using tls keyword in
tls-session-cache-memcached and tls-ticket-key-memcached options.
tls-session-cache-memcached-tls and tls-ticket-key-memcached-tls
options are deprecated.
2016-03-24 00:22:13 +09:00
Tatsuhiro Tsujikawa eec0b04a33 nghttpx: Enable/disable TLS per frontend address
This change allows user to disable TLS per frontend address using
no-tls keyword in --frontend option.  We removed --frontend-no-tls in
favor of this new feature.
2016-03-23 23:56:09 +09:00
Tatsuhiro Tsujikawa 58b06f32a2 nghttpx: Configure TLS per backend routing pattern
We added "tls" parameter to --backend option to enable TLS on that
backend connection.  --backend-tls options was deprecated, now is
noop.
2016-03-23 22:56:18 +09:00
Tatsuhiro Tsujikawa 5b58db39ff nghttpx: Fix failure case when comparing backend address set 2016-03-23 22:13:53 +09:00
Jacob Champion 1bc5cf5ee4 nghttp: time out on long Expect/Continue waits
To deal with servers that don't conform to RFC 7231 (or, potentially,
connections with a large round-trip time), don't wait forever for a 100
Continue status to come back. Currently, the timeout is hard-coded to
one second.

A ContinueTimer encapsulates the handshake timeout logic for a single
request. Somewhat counterintuitively, ContinueTimers are owned by the
HttpClient instead of the Request object, because their lifetime must be
bound to the life of the connection (which is owned by the HttpClient
and not the Requests). A Request is associated with its corresponding
ContinueTimer through a std::weak_ptr.
2016-03-22 13:10:00 -07:00
Jacob Champion f4c7ebcbca nghttp: implement Expect/Continue handshake
Requests that expect a 100 Continue will not submit their DATA frames
until the server sends the interim response.
2016-03-22 13:10:00 -07:00
Jacob Champion feb3d1b478 nghttp: add an --expect-continue option
Add a placeholder for the expect-continue option, which will perform an
Expect/Continue handshake for DATA uploads.
2016-03-22 13:10:00 -07:00
Tatsuhiro Tsujikawa 7c954c1ea7 nghttpx: Workaround for Ubuntu 15.04 which does not value-initialize on std::make_shared. 2016-03-23 01:32:17 +09:00
Tatsuhiro Tsujikawa e9f4d0eec2 nghttpx: Properly log incoming GOAWAY from backend 2016-03-23 01:16:44 +09:00
Tatsuhiro Tsujikawa 4f9c78799c nghttpd: Fix compile error with Android NDK 2016-03-23 01:16:02 +09:00
Tatsuhiro Tsujikawa 0f9ed40bd9 nghttpx: Share connection among different patterns if address set are same 2016-03-23 00:01:27 +09:00
Tatsuhiro Tsujikawa 4bb88b35ec nghttpx: "*" must match at least one character 2016-03-22 22:40:23 +09:00
Tatsuhiro Tsujikawa 04145e22a2 Revert "nghttpx: Call setsid after executing new binary"
This reverts commit 6680d8b792.
2016-03-22 00:21:32 +09:00
Tatsuhiro Tsujikawa dc3119303a Rewrite concat_string_ref 2016-03-20 17:55:17 +09:00
Tatsuhiro Tsujikawa d2b55ad1a2 nghttpx: Allow '*' in --error-page to be used as wildcard 2016-03-19 23:49:15 +09:00
Tatsuhiro Tsujikawa d7051f5207 nghttpx: Add custom error pages 2016-03-19 23:41:21 +09:00
Tatsuhiro Tsujikawa db1ee3aa88 nghttpd: Use StringRef 2016-03-19 20:57:40 +09:00
Tatsuhiro Tsujikawa a1e0bd134e nghttpx: Create at least the same number of h2 session as load balancing hosts 2016-03-19 12:00:27 +09:00
Tatsuhiro Tsujikawa dcae6efaa2 nghttpx: Rewrite Downstream::assemble_request_cookie using StringRef 2016-03-19 11:38:09 +09:00
Tatsuhiro Tsujikawa 8da0d649e4 Merge branch 'cmake' of https://github.com/Lekensteyn/nghttp2 into Lekensteyn-cmake 2016-03-19 11:20:31 +09:00
Peter Wu d10f149161 cmake: fix Windows support
Fix Windows build by defining `ssize_t` when missing and adjusting the
install commands.

Add support for ENABLE_WERROR=1 while at it.

Tested with MSVC 2013 on Windows 7 x64.
2016-03-16 17:33:20 +01:00
Peter Wu 3a2a943fe9 cmake: do not fail without libxml2
Avoid adding a LIBXML2_LIBRARIES-NOTFOUND to the libraries list when it
is not found. Likewise for OpenSSL.
2016-03-16 17:33:10 +01:00
Peter Wu 162b1c5e03 cmake: only install ASIO headers when requested 2016-03-15 00:02:46 +01:00
Peter Wu dc56b951df src/Makefile.am: fix missing allocator.h
Fix regression from v1.8.0-38-gbae37e3 breaking distcheck.
2016-03-14 17:49:23 +01:00
Peter Wu 7c55c335cc Merge branches 'master' and 'cmake-updated' into cmake
Update to latest master with appropriate cmake changes at the same time.
2016-03-14 17:26:15 +01:00
Peter Wu 2ddb83206b cmake: sync with v1.8.0-63-g37b09f6
Adds missing source files and configure.ac changes since
v1.7.0-93-g093eb51.
2016-03-14 17:20:37 +01:00
Tatsuhiro Tsujikawa ab734f09b6 nghttpx: Fix possible crash in rare case 2016-03-15 00:46:15 +09:00
Tatsuhiro Tsujikawa dd2bdf3e31 nghttpx: Update doc 2016-03-14 23:53:10 +09:00
Tatsuhiro Tsujikawa a909bb3eca nghttpx: Initialize proto field 2016-03-14 23:47:29 +09:00
Tatsuhiro Tsujikawa 01408209d8 nghttpx: Fix the bug that forwarded query contains duplicated '?'
This change also fixes that bug that the multiple '/' at the start of
request were not coalesced into one.
2016-03-14 22:20:00 +09:00
Peter Wu 7f8110601e cmake: fix compatibility with cmake before 3.3
The COMPILE_LANGUAGE generator expression is only supported since CMake
3.3. Moreover, it does not work with all generators (works with Makefile
and Ninja, but not with Visual Studio).

target_compile_options would only work if a target does not mix C and
C++ sources, since the flags are intended to be set for a specific
language, use set_source_files_properties instead. This approach is also
less repetitive.

Drop the idea of using lists and COMPILE_OPTIONS,
set_source_files_properties only understands COMPILE_FLAGS (a single
string, not a list).
2016-03-13 12:30:41 +01: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 3b2811bfc4 nghttpx: Remove AltSvc ctor 2016-03-13 14:01:59 +09:00
Tatsuhiro Tsujikawa 27275a02ac nghttpx: Remove unused EMPTY_STRING 2016-03-13 13:59:06 +09:00
Tatsuhiro Tsujikawa 34d209b30b nghttpx: Add wildcard host routing
This change allows host pattern in --backend to include '*' to
indicate wildcard match.  The wildcard match is made in suffix match
only.
2016-03-13 01:01:34 +09:00
Tatsuhiro Tsujikawa 94f52d49dc BlockAllocator: Delete copy ctor and assignment operator 2016-03-12 21:25:53 +09:00
Tatsuhiro Tsujikawa 0ee09320e0 src: Remove unused value_to_str 2016-03-12 21:13:09 +09:00
Tatsuhiro Tsujikawa 78fcb2143f Update doc 2016-03-12 21:13:09 +09:00
Tatsuhiro Tsujikawa 755b14de5d src: Unify path_join implementation 2016-03-12 21:13:09 +09:00
Tatsuhiro Tsujikawa 3455cb35e4 nghttpx: Rewrite create_forwarded to use BlockAllocator 2016-03-12 21:13:09 +09:00
Tatsuhiro Tsujikawa c1571a3209 src: Rewrite xff handling 2016-03-12 21:13:09 +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 c897d5b294 src: Use StringRef in parse_http_date 2016-03-12 21:13:09 +09:00
Tatsuhiro Tsujikawa 863a944179 src: Add specialization for char to avoid reinterpret_cast in constexpr 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 7a412df9a5 nghttpx: Fix tests 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
Peter Wu bdb6581990 Add CMake-related files to EXTRA_DIST 2016-03-12 01:38:12 +01:00
Peter Wu 618073e2b4 cmake: add "check" target
Add a "check" target that builds tests before running them.
2016-03-12 00:57:30 +01:00
Tatsuhiro Tsujikawa fa601e5ba3 Add isolation_threshold, use field to store block size rather than template parameter 2016-03-09 21:25:11 +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 907eeeda8a src: Return StringRef from util::get_uri_field 2016-03-08 21:38:15 +09:00
Tatsuhiro Tsujikawa fe6ccd16da nghttpx: Change read timeout reset timing 2016-03-05 19:11:36 +09:00
Tatsuhiro Tsujikawa 10ec00126c src: Don't process rel=preload again once we found it 2016-03-04 23:00:33 +09:00
Tatsuhiro Tsujikawa 2d6211c455 asio: Fix bug that server event loop breaks with exception
This can happen when we call throwing version of
basic_stream_socket::remote_endpoint() call while client disconnected.
2016-03-04 22:43: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 aaf0177318 src: Use str_size 2016-03-03 23:23:51 +09:00
Tatsuhiro Tsujikawa 9afc017532 src: Don't push if Link header field includes nopush 2016-03-03 23:20:32 +09:00
Tatsuhiro Tsujikawa 5da38b22c0 h2load: Fix bug that it did not try to connect to server again 2016-03-02 22:24:14 +09:00
Tatsuhiro Tsujikawa ce61f62644 h2load: Fix bug that initial max concurrent streams was too large 2016-03-02 21:18:42 +09:00
Tatsuhiro Tsujikawa a21c87d11c Add nghttp2_http2_strerror() to return HTTP/2 error code string 2016-02-29 23:10:20 +09:00
Tatsuhiro Tsujikawa 478fde5fef nghttpx: Fix compile error 2016-02-29 01:16:45 +09:00
Tatsuhiro Tsujikawa 284691253f nghttpx: Use StringRef for http::create_forwarded parameter 2016-02-29 00:05:32 +09:00
Tatsuhiro Tsujikawa 124d4c9fad src: Fix tests 2016-02-29 00:05:32 +09:00
Tatsuhiro Tsujikawa 5fbe4cc225 nghttpx: Clear upgrade_request flag when Downstream is attached to HTTP/2 backend 2016-02-28 23:21:57 +09:00
Tatsuhiro Tsujikawa df6466cfbd nghttpx: Update doc 2016-02-28 23:15:57 +09:00
Tatsuhiro Tsujikawa 2326337d32 nghttpx: Deprecate backend-http1-connections-per-host in favor of backend-connections-per-host 2016-02-28 22:15:49 +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 44d3801760 nghttpx: Deprecate backend-http1-connections-per-frontend in favor of backend-connections-per-frontend 2016-02-28 17:11:12 +09:00
Tatsuhiro Tsujikawa 1832f78684 nghttpx: Move downstream proto to DownstreamAddrGroup 2016-02-28 16:56:14 +09:00
Tatsuhiro Tsujikawa e7601cde8a nghttpx: Don't share session which is already in draining state 2016-02-28 12:41:34 +09:00
Tatsuhiro Tsujikawa 36f6a009b8 nghttpx: Effectively disable backend HTTP/2 connection flow control
This is required to avoid session stall because of too slow frontend
connection.
2016-02-28 00:19:18 +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 c731d1fea5 nghttpx: Deprecate --backend-http2-connections-per-worker option 2016-02-28 00:19:18 +09:00
Tatsuhiro Tsujikawa aa892e4d37 nghttpx: Share TLS session cache between HTTP/2 and HTTP/1 backend 2016-02-28 00:19:18 +09:00
Tatsuhiro Tsujikawa 8ca3e5f6ba nghttpx: Separate Downstream address group from config to runtime 2016-02-28 00:19:18 +09:00
Tatsuhiro Tsujikawa 21007da392 nghttpx: Rewrite backend HTTP/2 connection coalesce strategy
Previously, we use one Http2Session object per DownstreamAddrGroup.
This is not flexible, and we have to provision how many HTTP/2
connection is required in advance.  The new strategy is we add
Http2Session object on demand.  We measure the number of attached
downstream connection object and server advertised concurrency limit.
As long as former is smaller than the latter, we attach new downstream
connection to it.  Once the limit is reached, we create new
Http2Session object.  If the number lowers the limit, we start to
share Http2Session object again.
2016-02-28 00:19:18 +09:00
Tatsuhiro Tsujikawa 2415a22757 h2load: Fix uninitialized fields 2016-02-26 00:00:24 +09:00
Tatsuhiro Tsujikawa c098b4ac70 nghttpx: Remove --backend-tls-session-cache-per-worker option 2016-02-25 22:46:25 +09:00
Tatsuhiro Tsujikawa bc933e9981 src: Use lowercase to show it is not the name of frame 2016-02-25 21:18:09 +09:00
Tatsuhiro Tsujikawa 34bf153653 Merge branch 'master' into simple-extensions 2016-02-24 23:21:03 +09:00
Tatsuhiro Tsujikawa 2782ef67de nghttpd: Remove unused function 2016-02-23 01:18:52 +09:00
Tatsuhiro Tsujikawa 9d15f9b00d nghttpd: Start SETTINGS timer after it is written to output buffer 2016-02-23 01:18:07 +09:00
Tatsuhiro Tsujikawa 9672bc322f src: Remove unused functions 2016-02-21 16:51:46 +09:00
Tatsuhiro Tsujikawa b68be1e1fb src: Make token of type int32_t; we have no reason to use int16_t 2016-02-21 16:44:00 +09:00
Tatsuhiro Tsujikawa f2a7275700 nghttpx: Cache TLS session inside DownstreamAddr object 2016-02-21 16:35:43 +09:00
Tatsuhiro Tsujikawa 177d0a513f nghttpx: More logging for backend connection initiation 2016-02-21 16:11:50 +09:00
Tatsuhiro Tsujikawa dfc02843b6 src: Rename and rewrite numeric_hostport as to_numeric_addr and support AF_UNIX path 2016-02-21 15:28:11 +09:00
Tatsuhiro Tsujikawa 11c8803b92 nghttpx: Worker wide blocker which is used when socket(2) is failed 2016-02-21 15:27:19 +09:00
Tatsuhiro Tsujikawa c9a4f293a1 nghttpx: ConnectBlocker per backend address 2016-02-21 14:53:06 +09:00
Tatsuhiro Tsujikawa 61579ad20f nghttpx: Use StringRef for shrpx::add_header 2016-02-20 23:30:02 +09:00
Tatsuhiro Tsujikawa 9678daa46a nghttpx: Rename index_headers() as parse_content_length() 2016-02-20 23:30:02 +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 1703201084 nghttpx: Get rid of hdidx 2016-02-20 23:30:02 +09:00
Peter Wu 9c874bf9b5 cmake: rename nghttpx-bin target to nghttpx
`ninja nghttpx` would create the static library, but I expected a binary
`nghttpx` instead. Rename the nghttpx target to nghttpx_static and
nghttpx-bin to nghttpx.
2016-02-18 14:20:35 +01:00
Peter Wu 4814d14db5 cmake: fix installing nghttp2_asio.pc, manpages, README.rst 2016-02-16 16:25:50 +01:00
Peter Wu 77e8190b6c cmake: fix symbol visibility issues
libnghttp2.so was missing -fvisibility=hidden. libnghttp2_asio.so on the
other hand had hidden visibility which resulted in no exported symbols
and a broken asio client examples.

Just build a static nghttp2 library to solve this issue.
2016-02-16 16:04:01 +01:00
Peter Wu 1b67b2d33e cmake: improve Spdylay detection
Auto-detect spdylay availability using CMake, making pkg-config
completely optional.
2016-02-16 12:48:36 +01:00
Peter Wu f407f7f406 cmake: add mruby support, fix tests dir
mruby is always invoked now (mirrors the autotools behavior). It could
be optimized though to only trigger the mruby build when the static
library is missing.

Also fix typo in NGHTTP2_TESTS_DIR macro definition (detected when
invoking the Ninja generator).
2016-02-15 23:14:27 +01:00
Peter Wu 474ecc4b47 cmake: add neverbleed support 2016-02-15 10:50:31 +01:00
Peter Wu 8c46d9181f cmake: process tests directory
Split the nghttp2 library into objects and a shared library from those
objects. This is needed because of symbol visibility. An advantage over
the autotools build is that there are no worries about static versus
static library builds.

Test:

    cmake $srcdir
    make nghttpx-unittest main failmalloc
    make test
2016-02-15 01:57:13 +01:00
Peter Wu cc92ebf471 cmake: add auto-detection, improve library search
Add auto-detection to the most important features (app, hpack, etc.).
Move options to a separate file for easier search.

Add cmake-based Libevent, jansson and CUnit search. Move pkg-config
handling for Libev and jemalloc to their cmake files.

Note: duplicates find_package before including CMakeOptions.txt and when
checking for features. Maybe that can be cleaned up later...
2016-02-15 01:12:07 +01:00
Tatsuhiro Tsujikawa aa3373a107 nghttpx: Use ImmutableString for mruby_file 2016-02-14 22:27:59 +09:00
Tatsuhiro Tsujikawa 7aabc6b125 nghttpx: Use ImmutableString for user 2016-02-14 22:21:55 +09:00
Tatsuhiro Tsujikawa 466e4b7a1e nghttpx: Use ImmutableString for conf_path 2016-02-14 22:20:10 +09:00
Tatsuhiro Tsujikawa 76a425226f nghttpx: Use ImmutableString for pid_file 2016-02-14 22:17:10 +09:00
Tatsuhiro Tsujikawa 2b707bff27 nghttpx: Use ImmutableString for log file 2016-02-14 22:17:10 +09:00
Tatsuhiro Tsujikawa 9055323b67 nghttpx: Use ImmutableString for request_header_file and response_header_file 2016-02-14 22:17:10 +09:00
Tatsuhiro Tsujikawa 67804cfc8c nghttpx: Use ImmutableString for ciphers 2016-02-14 22:17:10 +09:00
Tatsuhiro Tsujikawa 2344932b45 nghttpx: Use ImmutableString for dh_param_file 2016-02-14 22:17:10 +09:00
Tatsuhiro Tsujikawa 35ebdd35bc nghttpx: Use ImmutableString for private_key_file 2016-02-14 22:17:10 +09:00
Tatsuhiro Tsujikawa ac81003669 nghttpx: Use ImmutableString for cert_file 2016-02-14 22:17:10 +09:00
Tatsuhiro Tsujikawa c999987baf nghttpx: Use ImmutableString for private_key_file 2016-02-14 22:17:10 +09:00
Tatsuhiro Tsujikawa 529a59d309 nghttpx: Use ImmutableString for tls.client_verify.cacert 2016-02-14 22:17:10 +09:00
Tatsuhiro Tsujikawa 52f6417813 nghttpx: Use ImmutableString for tls.cacert 2016-02-14 22:17:00 +09:00
Tatsuhiro Tsujikawa 660bc389e6 nghttpx: Use ImmutableString for fetch_ocsp_response_file 2016-02-14 21:01:54 +09:00
Tatsuhiro Tsujikawa bfc26e8299 nghttpx: Use ImmutableString to store memcached server host 2016-02-14 20:59:10 +09:00
Tatsuhiro Tsujikawa 49fa914db5 nghttpx: Use StringRef for string parameters in match_downstream_addr_group 2016-02-14 20:48:06 +09:00
Tatsuhiro Tsujikawa 93eabc642b nghttpx: Use StringRef for parameter in Router::match 2016-02-14 19:07:22 +09:00
Tatsuhiro Tsujikawa 2d273f8237 nghttpx: Use StringRef for pattern paramter in Router::add_route 2016-02-14 18:55:53 +09:00
Tatsuhiro Tsujikawa a53f0f0a17 nghttpx: Refactor DownstreamAddrGroup and router API 2016-02-14 18:47:24 +09:00
Tatsuhiro Tsujikawa 1bd98dcf4f nghttpx: Remove user defined ctor/assignment op from DownstreamAddr 2016-02-14 18:31:08 +09:00
Peter Wu 5297136bc0 cmake: use PRIVATE instead of PUBLIC
Avoids leaking compile flags to dependents.
2016-02-13 20:13:43 +01:00
Peter Wu 61bb6428fd cmake: add third-party and src
Remaining work:
 - integrate mruby and neverbleed
 - integrate cunit
2016-02-13 20:13:42 +01:00
Tatsuhiro Tsujikawa 093eb51f8c Update default cipher list 2016-02-14 00:44:50 +09:00
Tatsuhiro Tsujikawa d8c8a4631d nghttpx: Interleave text/html pushed resources with associated resource 2016-02-14 00:28:08 +09:00
Tatsuhiro Tsujikawa eb0c82d91f nghttpx: More log output when resolving addresses for better debugging 2016-02-13 23:21:32 +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 63a13ccb18 src: Add constexpr to StringRef ctors 2016-02-13 19:15:14 +09:00
Tatsuhiro Tsujikawa 72877379ec nghttpx: Deprecate --backend-ipv4 and --backend-ipv6 in favor of --backend-address-family 2016-02-13 19:09:39 +09:00
Tatsuhiro Tsujikawa c0078ab45a nghttpx: Add options to specify address family of memcached connections 2016-02-13 18:46:07 +09:00
Tatsuhiro Tsujikawa 3a41e4dd1a nghttpx: Add encryption support for TLS ticket key retrieval 2016-02-13 18:46:07 +09:00
Tatsuhiro Tsujikawa 3297a303bf nghttpx: Add client auth options for session cache memcached TLS connection 2016-02-13 18:46:07 +09:00
Tatsuhiro Tsujikawa f1580f95d4 nghttpx: Add TLS support for session cache memcached connection 2016-02-13 18:46:07 +09:00
Jay Satiro ca371e3ba9 nghttpx: Refactor blacklisted cipher suite check 2016-02-12 21:46:29 -05:00
Tatsuhiro Tsujikawa 0a1beea13a asio: client: Limit incoming response header field buffer size 2016-02-11 23:20:31 +09:00
Tatsuhiro Tsujikawa ff22862b9d nghttp: Limit incoming header field buffer 2016-02-11 23:20:31 +09:00
Tatsuhiro Tsujikawa b2264ad57e asio: server: Limit incoming request header field buffer size 2016-02-11 23:20:31 +09:00
Tatsuhiro Tsujikawa b0227d4051 nghttpd: Limit request header buffer 2016-02-11 23:20:31 +09:00
Tatsuhiro Tsujikawa 82f942c3a3 nghttpx: Parameterize configuration values for client side TLS context 2016-02-11 18:34:31 +09:00
Tatsuhiro Tsujikawa e4a727f86c nghttpx: Cache TLS client session after initial handshake was done 2016-02-11 17:56:20 +09:00
Tatsuhiro Tsujikawa b624ca6dcd nghttpx: Rename client TLS session cache field 2016-02-11 17:12:57 +09:00
Tatsuhiro Tsujikawa ba4c268172 nghttpx: Single SSL_SESSION cache entry for each address 2016-02-11 17:07:48 +09:00
Tatsuhiro Tsujikawa 00175eac33 nghttpx: Use Address* as a key for client side session cache 2016-02-11 12:40:15 +09:00
Tatsuhiro Tsujikawa fc39f2d9d2 Merge branch 'master' into simple-extensions 2016-02-07 21:09:08 +09:00
Tatsuhiro Tsujikawa 0d806978e6 nghttpx: Set HTTP/1 backend read buffer to 16k 2016-02-07 21:07:27 +09:00
Tatsuhiro Tsujikawa 62c43ce2be nghttpx: Remove rb_ from HTTP/2 backend session 2016-02-07 19:20:17 +09:00
Tatsuhiro Tsujikawa 88eaeb5d1c nghttpx: Use memchunks for HTTP/2 backend 2016-02-07 18:54:44 +09:00
Tatsuhiro Tsujikawa 60c0c2dd56 src: Code cleanup 2016-02-07 18:41:38 +09:00
Tatsuhiro Tsujikawa 6c147aa1c5 nghttpx: Remove unnecessary condition 2016-02-07 18:39:06 +09:00
Tatsuhiro Tsujikawa 2a9b23bfab nghttpx: Store pointer to DownstreamAddr 2016-02-07 18:38:06 +09:00
Tatsuhiro Tsujikawa 4fb4617d20 src: Parameterize CharT 2016-02-07 18:16:47 +09:00
Tatsuhiro Tsujikawa ede0f6aa32 src: Remove verbose const 2016-02-07 18:12:57 +09:00
Tatsuhiro Tsujikawa 4e7271a88f nghttpx: Fix regression which breaks WebSocket upgrade 2016-02-07 17:59:38 +09:00
Tatsuhiro Tsujikawa 6d49110a33 Rename FrontendAddr as UpstreamAddr 2016-02-07 17:51:53 +09:00
Tatsuhiro Tsujikawa 15fa38c72f nghttpx: Rename backend_session_cache_per_worker as downstream_session_cache_per_worker 2016-02-07 17:43:30 +09:00
Tatsuhiro Tsujikawa e7de5e9f6c nghttpx: Rename cl_tls_session as downstream_tls_session 2016-02-07 17:43:30 +09:00
Tatsuhiro Tsujikawa 5c10534b88 nghttpx: Fix crash when reusing cached SSL session 2016-02-07 17:43:30 +09:00
Tatsuhiro Tsujikawa 6806196404 nghttpx: Update doc for HTTP/1 TLS backend connections 2016-02-07 17:43:30 +09:00
Tatsuhiro Tsujikawa 2e38208d74 nghttpx: Fixups for HTTP/1 backend TLS support 2016-02-07 17:43:30 +09:00
Tatsuhiro Tsujikawa cde79052dd nghttpx: Slightly faster version of HTTP/1 backend 2016-02-07 17:43:30 +09:00
Tatsuhiro Tsujikawa e763770f3e nghttpx: Add option to specify maximum number of session cache 2016-02-07 17:43:30 +09:00
Tatsuhiro Tsujikawa 26d49c1dc3 nghttpx: Cache client session 2016-02-07 17:43:30 +09:00
Tatsuhiro Tsujikawa bb4e2f6a24 nghttpx: Add TLS support for HTTP/1 backend 2016-02-07 17:43:30 +09:00
Tatsuhiro Tsujikawa 024d0d09ee nghttpx: Fix unexpected failure due to missing address family 2016-02-06 23:28:04 +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 8741503db1 nghttpx: Add --no-http2-cipher-black-list to allow black listed cipher suite 2016-02-06 17:05:14 +09:00
Tatsuhiro Tsujikawa eec409dba7 nghttpx: Limit header fields from backend 2016-02-06 12:27:01 +09:00
Tatsuhiro Tsujikawa 95ca4f55d5 asio: client: Fix connect timeout does not work, return from cb if session stopped
This change removed client::session::connect_timeout() functon, and
connect timeout should be given to client::session constructor.  This
is required since async operation starts in the constructor.
2016-02-06 11:05:13 +09:00
Tatsuhiro Tsujikawa 35c3b36549 nghttpx: Document special value localhost in Forwarded "by" and "for" params 2016-02-01 23:34:07 +09:00
Tatsuhiro Tsujikawa 03872bfacd nghttpx: Don't quote Forwarded "by" parameter if it is special value "localhost" 2016-02-01 23:31:21 +09:00
Tatsuhiro Tsujikawa 5e9bcbec9a nghttpx: Fix bug that IPv6 address in Forwarded "for" is not quoted-string 2016-02-01 23:29:17 +09:00
Tatsuhiro Tsujikawa aa07fe7fa6 nghttpx: Support multiple frontend addresses
This commit allows nghttpx to listen to multiple address and port pair
by specifying -f option multiple times.
2016-02-01 23:10:29 +09:00
Tatsuhiro Tsujikawa 7a6a59178a Don't taint CXXFLAGS from AX_CXX_COMPILE_STDCXX_11 2016-01-30 18:42:48 +09:00
Tatsuhiro Tsujikawa 4e44fccdcf Fix compile error with gcc-6 which enables C++14 by default 2016-01-30 18:41:27 +09:00
Tatsuhiro Tsujikawa 5659e295b3 nghttpd: Add trailer header field to status responses 2016-01-27 22:47:30 +09:00
Tatsuhiro Tsujikawa 5b195092e1 nghttpd: Add -w and -W options to change window size 2016-01-27 22:34:17 +09:00
Tatsuhiro Tsujikawa 85bb37ab7c Enable ConstructorInitializerAllOnOneLineOrOnePerLine for better diff 2016-01-27 21:14:07 +09:00
Tatsuhiro Tsujikawa 1cfdf386ff src: Faster base64 2016-01-27 15:31:09 +09:00
Tatsuhiro Tsujikawa 6d8fe72174 src: Faster percent encode/deocde 2016-01-27 15:31:09 +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 ad93cea544 nghttpx: Fix possible data loss on backend connection upgrade 2016-01-27 15:26:46 +09:00
Tatsuhiro Tsujikawa 1739b5a0e6 nghttpx: Don't read frontend socket if read watcher is stopped 2016-01-27 15:26:06 +09:00
Tatsuhiro Tsujikawa 2f80c453bb Add C++ compiler flags with --enable-werror, remove -Wall from CPPFLAGS 2016-01-22 22:48:45 +09:00
Tatsuhiro Tsujikawa efc3206ae0 nghttpx: Revert accidental change 2016-01-21 22:14:10 +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 5a3ca7e700 nghttpx: Disallow user defined static obfuscated string for "for" parameter 2016-01-21 21:05:07 +09:00
Tatsuhiro Tsujikawa 9ac3e643d8 Revert "nghttpx: Add --curves option to specify supported elliptic curves"
This reverts commit e278893b64.

SSL_CONF_CTX functions are not working correctly with OpenSSL 1.0.2.
It requires 1.1.0 to make it work.
2016-01-21 19:50:38 +09:00
Tatsuhiro Tsujikawa 7ca2660a29 asio: Stop acceptor on server::http2::stop 2016-01-21 19:15:32 +09:00
Tatsuhiro Tsujikawa e278893b64 nghttpx: Add --curves option to specify supported elliptic curves 2016-01-21 18:23:13 +09:00
Tatsuhiro Tsujikawa 03f7f8cb9c nghttpx: About implicit conversion from ImmutableString and std::string to StringRef
This is required to avoid creation of temporary ImmutableString
like so:

std::string x;
ImmutableString y = ...;
StringRef ref = !x.empty() ? x : y;

First, temporary ImmutableString is created with x since
ImmutableString has constructor to accept std::string.  After
StringRef gets this, the temporary ImmutableString is destroyed, and
ref has dangling pointer.
2016-01-21 17:12:40 +09:00
Tatsuhiro Tsujikawa 2faf9623ce nghttpx: Fix crash with http2 backend 2016-01-21 17:09:50 +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 6377c51f9c Add missing files 2016-01-19 23:31:17 +09:00
Tatsuhiro Tsujikawa db8de490a0 nghttpx: Omit Forwarded for and by parameter if UNIX domain socket is used 2016-01-19 23:26:04 +09:00
Tatsuhiro Tsujikawa acb38b726f nghttpx: Don't quote Forwarded params if it is not required 2016-01-19 22:43:56 +09:00
Tatsuhiro Tsujikawa f44128774c nghttpx: Update doc 2016-01-19 21:01:34 +09:00
Tatsuhiro Tsujikawa 933e0f40bb h2load: Support UNIX domain socket 2016-01-19 19:24:15 +09:00
Tatsuhiro Tsujikawa 3ad9f9e730 nghttpx: Fix compiler warning without --with-mruby 2016-01-19 19:07:13 +09:00
Tatsuhiro Tsujikawa a390bd4ce0 nghttpx: Fix compile error with --with-neverbleed 2016-01-19 19:04:24 +09:00
Tatsuhiro Tsujikawa f3946ae314 nghttpx: Remove assignment of zero values
Because of zero initialization, these assignments are unnecessary.
2016-01-19 17:27:56 +09:00
Tatsuhiro Tsujikawa 2f9946327a nghttpx: Fix bug that --listener-disable-timeout option is not used 2016-01-19 17:03:01 +09:00
Tatsuhiro Tsujikawa 0402481be4 nghttpx: Organize connection related configuration into struct 2016-01-19 16:56:12 +09:00
Tatsuhiro Tsujikawa 35feae3b0c nghttpx: Group up logging related options 2016-01-18 17:26:27 +09:00
Tatsuhiro Tsujikawa a053d10839 nghttpx: Move option handling code to separate function 2016-01-18 17:08:28 +09:00
Tatsuhiro Tsujikawa 16549bb276 nghttpx: Structured configurations for http and http2 2016-01-18 17:00:20 +09:00
Tatsuhiro Tsujikawa f3e1dc7a4f nghttpx: Structured TLS related configurations 2016-01-18 14:21:09 +09:00
Tatsuhiro Tsujikawa b12af8c410 nghttpx: Refactor backend proxy configuration 2016-01-17 22:51:40 +09:00
Tatsuhiro Tsujikawa f5b4fd23da src: Fix compiler error on travis 2016-01-17 22:47:50 +09:00
Tatsuhiro Tsujikawa ee43250015 nghttpx: Remove useless comment 2016-01-17 22:26:13 +09:00
Tatsuhiro Tsujikawa 9f0f5c60ad ImmutableString: Remove std::unique_ptr<char[]> ctor overload 2016-01-17 22:25:10 +09:00
Tatsuhiro Tsujikawa 09de332028 ImmutableString: Less fields 2016-01-17 22:25:10 +09:00
Tatsuhiro Tsujikawa 3d5f5b6a28 nghttpx: Fix compiler warning 2016-01-17 18:27:25 +09:00
Tatsuhiro Tsujikawa eb7b3295d1 ImmutableString, StringRef: Add empty() and operator[]
We won't add operator[] to StringRef.  This is because it may be
undefined if pos == size(), and StringRef's base + len does not point
to the valid region.  This solely depends on the given buffer, so we
cannot do anything to fix.  For workaround, if we need this kind of
operator, we may add it under another name, like char_at(size_type).
2016-01-17 18:09:12 +09:00
Tatsuhiro Tsujikawa 5131b95c2f ImmutableString: Ensure that c_str() returns non-nullptr if it is default constructed 2016-01-17 18:00:36 +09:00
Tatsuhiro Tsujikawa ba543e3895 memchunk: Add noexcept 2016-01-17 17:16:20 +09:00
Tatsuhiro Tsujikawa ef5d981ab1 nghttpx: Simplify 2016-01-17 17:04:16 +09:00
Tatsuhiro Tsujikawa d5efab4993 src: Add inequality operator for StringRef 2016-01-17 16:42:19 +09:00
Tatsuhiro Tsujikawa 919e9eee63 nghttpx: It is enough to check "chunked" in the suffix 2016-01-17 16:34:56 +09:00
Tatsuhiro Tsujikawa e255468bdf nghttpx: Fix tests 2016-01-17 16:33:23 +09:00
Tatsuhiro Tsujikawa 39c0a71065 src: Add tests for ImmutableString and StringRef 2016-01-17 16:32:55 +09:00
Tatsuhiro Tsujikawa 7b2d4b6ae6 nghttpx: Optimize logging further 2016-01-17 15:04:09 +09:00
Tatsuhiro Tsujikawa 4f07db8bcb src: Rename our new string classes 2016-01-17 11:33:45 +09:00
Tatsuhiro Tsujikawa 959d378f2a nghttpx: Optimize accesslog write 2016-01-17 11:19:19 +09:00
Tatsuhiro Tsujikawa 506de55475 src: Less strlen 2016-01-17 01:29:52 +09:00
Tatsuhiro Tsujikawa 045578989c src: Update doc 2016-01-17 01:21:58 +09:00
Tatsuhiro Tsujikawa d16ff1f519 nghttpx: Use StringAdaptor for Config::server_name 2016-01-17 01:15:11 +09:00
Tatsuhiro Tsujikawa 2c7ed01f0c nghttpx: Use std::string for Downstream::backend_tls_sni_name 2016-01-17 01:00:15 +09:00
Tatsuhiro Tsujikawa 34d5382d66 nghttpx: Use VString for DownstreamAddr::host and hostport to remember size 2016-01-17 00:52:41 +09:00
Tatsuhiro Tsujikawa dbbf3a4a10 nghttpx: Refactor TLS hostname match 2016-01-16 23:54:21 +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 7be0217bc0 nghttpx: Simplify xff handling 2016-01-16 16:48:41 +09:00
Tatsuhiro Tsujikawa b202e066fd nghttpx: Don't allow certain characters in host and :scheme header field
For HTTP/2, we do this validation in libnghttp2.  http-parser does
this partially, when it parses URI, but it does not do anything for
Host header field.  libspdylay does not perform anything.  So do some
additional validation for HTTP/1 and SPDY cases.  integration tests
were also added to make sure they work.
2016-01-16 16:00:05 +09:00
Tatsuhiro Tsujikawa 74c77926a8 nghttpx: Refactor and simplify Downstream::rewrite_location_response_header 2016-01-16 12:49:18 +09:00
Tatsuhiro Tsujikawa 25570367b3 nghttpx: Document Forwarded related options 2016-01-16 11:58:02 +09:00
Tatsuhiro Tsujikawa 4c884da222 nghttpx: Reset config when Forwarded related option is used 2016-01-16 11:53:18 +09:00
Tatsuhiro Tsujikawa 41047aece0 nghttpx: Implement Forwarded in HTTP/2 backend 2016-01-16 11:32:36 +09:00
Tatsuhiro Tsujikawa 54f5ea9d6e Update doc 2016-01-16 11:32:36 +09:00
Tatsuhiro Tsujikawa d678c07ddf nghttpx: Allow user to specify static obfuscated value via command-line 2016-01-16 11:32:26 +09:00
Tatsuhiro Tsujikawa 5c3f74b424 nghttpx: Add RFC 7239 Forwarded header field support 2016-01-16 11:32:14 +09:00
Tatsuhiro Tsujikawa 1550d709e0 nghttpx: Use std::mt19937 instead of std::random_device directly 2016-01-15 18:48:14 +09:00
Tatsuhiro Tsujikawa 3c7038dfe1 nghttpx: Simplify
We only change req_.upgrade_request once, so just using else is
suffice.
2016-01-15 00:22:11 +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 698f00596d Update doc 2016-01-15 00:05:56 +09:00
Tatsuhiro Tsujikawa 5a8cf94361 nghttpx: Refactor Downstream::response_sent_bodylen_ 2016-01-14 23:54:28 +09:00
Tatsuhiro Tsujikawa 3218c160be nghttpx: Refactor Downstream::response_datalen_ 2016-01-14 23:49:21 +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 bdef0e0b1a nghttpx: Refactor Downstream::request_bodylen_ 2016-01-14 23:14:58 +09:00
Tatsuhiro Tsujikawa 0a76b45eca nghttpx: Fix bug that key_prev is not updated 2016-01-14 01:05:10 +09:00
Tatsuhiro Tsujikawa 6d6a00f1f5 nghttpx: Return assemble cookie on the fly 2016-01-14 01:05:10 +09:00
Tatsuhiro Tsujikawa 3b8889a2a1 nghttpx: Extract response related fields to Response struct 2016-01-14 01:05:10 +09:00
Tatsuhiro Tsujikawa a7fd37ffdf nghttpx: Remove FieldStore::set_last_{header,trailer}_value
Use FieldStore::append_last_{header,trailer}_value instead.
2016-01-14 01:04:53 +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
Vernon Tang 6fddefe252 shrpx_worker_process: worker_process_event_loop: Fix FD test.
This fixes a crash in nghttpx when running on IPv6 only.
2016-01-12 17:38:17 +00:00
Tatsuhiro Tsujikawa fe8005327a src: Make util::utos_with_unit and utos_with_funit names shorter 2016-01-11 18:12:31 +09:00
Tatsuhiro Tsujikawa 0697de4691 h2load: Improve readability of traffic numbers 2016-01-11 18:06:26 +09:00
Tatsuhiro Tsujikawa 6566ea7d6b nghttpx: Update doc 2016-01-11 17:36:47 +09:00
Tatsuhiro Tsujikawa 0caefe20ef Merge branch 'master' into simple-extensions 2016-01-09 19:08:28 +09:00
Tatsuhiro Tsujikawa b64fc3ac49 nghttpd: Add --no-content-length option to omit content-length in response 2016-01-07 22:51:47 +09:00
Tatsuhiro Tsujikawa 027256d0b1 h2load: Distribute MAX_SAMPLES across workers 2016-01-07 22:41:37 +09:00
Tatsuhiro Tsujikawa 425c794f89 h2load: Rename MAX_STATS as MAX_SAMPLES 2016-01-07 22:21:39 +09:00
Tatsuhiro Tsujikawa acac5ec6ea h2load: Remove "auto" for -m option
Because http/1.1 support, default "auto" behaviour of -m option is not
desirable, since it is used as HTTP pipelining, and it is not used in
practice.
2016-01-06 23:16:53 +09:00
Tatsuhiro Tsujikawa 13bd566eb7 h2load: Remove RequestStat ctor 2016-01-06 23:10:46 +09:00
Tatsuhiro Tsujikawa a52920cec0 h2load: Perform Sampling for client as well 2016-01-06 23:03:37 +09:00
Tatsuhiro Tsujikawa 9cbb8174bb h2load: Refactor systematic sampling method 2016-01-06 22:43:09 +09:00
Tatsuhiro Tsujikawa 23ac0429be h2load: Show progress in rate mode 2016-01-06 00:04:14 +09:00
Tatsuhiro Tsujikawa 7ed26afe75 h2load: Delete Client when it finished 2016-01-06 00:04:14 +09:00
Tatsuhiro Tsujikawa 60bbb5cae0 h2load: Perform sampling for request timings to reduce memory consumption 2016-01-06 00:04:14 +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 848f8fbe54 nghttpx: Don't apply max_header_fields and header_field_buffer limit to response
We modeled max_header_fields and header_field_buffer limit from Apache
configuration directives.  In Apache, they are only applied to request
header fields, while we applied both request and response.  Since
nghttpx is used as reverse proxy and backend server is relatively
"trusted", this commit removes the application to response header
fields.
2016-01-05 16:44:44 +09:00
Tatsuhiro Tsujikawa dd4d549dc1 asio: Rename http2::get_io_services() as http2::io_services()
The naming convention in asio lib does not use get_something.
2015-12-25 21:06:25 +09:00
Tatsuhiro Tsujikawa 486dba8d8a nghttpx: Strict validation for header fields given in configuration 2015-12-25 20:57:24 +09:00
ayanamist 5ec6066fdd header value should not be inp_strlower
http header keys are case-insensitive, but header values are case-sensitive, so it should not be changed.
2015-12-25 11:03:55 +08:00
Tatsuhiro Tsujikawa 8919c8c139 Check initgroups with AC_CHECK_DECLS for cygwin 2015-12-24 21:15:46 +09:00
Tatsuhiro Tsujikawa 5de2c7a8c1 Detect availability of initgroups 2015-12-23 14:21:31 +09:00
Tatsuhiro Tsujikawa 7c5ef0613d asio: Add configurable connect/read timeout for client
This commit includes backward incompatible change, since we change
private field in public API class.
2015-12-23 00:08:55 +09:00
Tatsuhiro Tsujikawa 1ee1122d40 asio: Add configurable tls handshake/read timeout to server 2015-12-23 00:08:16 +09:00
Tatsuhiro Tsujikawa 09bd9c94a3 asio: client: Should call shutdown_socket() on read error 2015-12-22 00:40:22 +09:00
Tatsuhiro Tsujikawa 6c1a76af6e asio: Use std::move for remote_endpoint assignment 2015-12-20 14:00:58 +09:00
Tatsuhiro Tsujikawa dd93b29397 clang-format 2015-12-20 12:48:39 +09:00
Tatsuhiro Tsujikawa e71948d611 Merge branch 'master' of https://github.com/apohl79/nghttp2 into apohl79-master 2015-12-19 23:33:33 +09:00
Tatsuhiro Tsujikawa 5a2d75551d h2load: Remove "(client)" from per-client req/s stat for simplicity 2015-12-19 22:56:10 +09:00
Andreas Pohl 9f2d064d7c libnghttp2_asio: Optimized remote endpoint interface to const ref where possible 2015-12-19 14:08:15 +01:00
Tatsuhiro Tsujikawa 2d2188e77b src: Add 451 status code
https://datatracker.ietf.org/doc/draft-ietf-httpbis-legally-restricted-status/
2015-12-19 18:35:01 +09:00
Andreas Pohl a30dad4f5e libnghttp2_asio: Added access to a requests remote endpoint 2015-12-16 18:38:21 +01:00
Tatsuhiro Tsujikawa ef7d6e8a0c nghttpx: Loose HTTP Upgrade condition 2015-12-16 00:38:30 +09:00
Tatsuhiro Tsujikawa 71012fe83a nghttpx: Add constexpr 2015-12-15 22:47:05 +09:00
Tatsuhiro Tsujikawa 248a64f0b2 Compile with OpenSSL 1.1.0-pre1 2015-12-14 21:12:25 +09:00
Andreas Pohl a4392d4a7f libnghttp2_asio: Make io_service accessors const 2015-12-09 23:11:40 +01:00
Andreas Pohl 924fef1f32 libnghttp2_asio: Added io_service accessors
To allow the asio wrapper to work with boost.fiber it is required
to access the underlying io_service objects.
2015-12-08 15:54:22 +01:00
Tatsuhiro Tsujikawa 9c84f60ba0 Merge branch 'master' into simple-extensions 2015-12-04 23:48:40 +09:00
Tatsuhiro Tsujikawa 7ca9ead36b nghttp: Update doc for default value of -M 2015-12-04 23:08:58 +09:00
Sunpoet Po-Chuan Hsieh 90b5a5856b Fix build when OpenSSL 1.0.2 is not available 2015-12-04 17:38:04 +08:00
Tatsuhiro Tsujikawa a151a44caf Set max number of outgoing concurrent streams to 100 by default
Instead of using nonsensical large value for max outgoing concurrent
streams, use more sensible value, 100.
2015-12-03 23:45:03 +09:00
Tatsuhiro Tsujikawa 6beaf4d9f3 h2load: Add req/s min, max, mean and sd for clients 2015-12-01 23:54:21 +09:00
Tatsuhiro Tsujikawa d1d1c83e56 h2load: Fix broken connection times 2015-12-01 22:29:30 +09:00
Tatsuhiro Tsujikawa cbad05e0de src: Fix compile error with gcc-4.7 2015-12-01 21:21:50 +09:00
Tatsuhiro Tsujikawa ba9e912cf6 src: Rename isAlpha, isDigit, and isHexDigit as is_... 2015-11-28 00:42:51 +09:00
Tatsuhiro Tsujikawa d867fe64e3 src: Rename endsWith as ends_with 2015-11-28 00:42:51 +09:00
Tatsuhiro Tsujikawa de247f7d33 src: Rename startsWith as starts_with 2015-11-28 00:42:51 +09:00
Tatsuhiro Tsujikawa 1ba28bef1f util: Remove unused functions; rename regacy camel-case function names 2015-11-28 00:42:51 +09:00
Tatsuhiro Tsujikawa c0858d8c1a src: Minor optimization for appending single character 2015-11-28 00:03:16 +09:00
Tatsuhiro Tsujikawa 863493766d Fix in_attr_char(); cleanup const char array iteration 2015-11-27 23:54:07 +09:00
Tatsuhiro Tsujikawa ba9e96b829 h2load: Avoid copy of h1 request 2015-11-26 22:04:31 +09:00
Tatsuhiro Tsujikawa bd041bcbb0 h2load: Add --h1 option to force http/1.1 for both http and https URI 2015-11-26 21:33:27 +09:00
Tatsuhiro Tsujikawa 8e06e37375 h2load: Fix crash when dealing connection: close with HTTP/1.1 server 2015-11-26 21:26:00 +09:00
Tatsuhiro Tsujikawa c44ee44cc3 nghttpd: Fix compile error due to incomplete FileEntry 2015-11-23 21:25:12 +09:00
Tatsuhiro Tsujikawa 84e23bff10 h2load: clang-format 2015-11-23 20:05:40 +09:00
Kit Chan 718f7a5f7e h2load goes into infinite loop when timing script file starts with 0.0 in first line 2015-11-23 09:58:38 +00:00
Tatsuhiro Tsujikawa dff2a19950 nghttpx: Don't send RST_STREAM to h2 backend if backend is disconnected state
This avoid establishing HTTP/2 backend connection again w/o pending
request.

See GH-431
2015-11-22 15:49:11 +09:00
Tatsuhiro Tsujikawa c7304317d4 nghttpd: Check validity of cached file descriptor periodically
This commit adds ability to check status of cached file descriptor to
make sure that it can be reused.  We inspect last modification time
and number of hard links.  If last modification is changed from the
last validation time, or number of hard links gets 0, we don't reuse
file descriptor.  We also capped upper limit of the cached file
descriptors.  If the limit is reached, we will close file descriptor
which is least recently used, and its usecount is 0.
2015-11-21 16:05:08 +09:00
Tatsuhiro Tsujikawa 63aa3466e9 nghttpd: Fix crash with CONNECT request 2015-11-21 12:54:04 +09:00
Tatsuhiro Tsujikawa ab1e8305a1 asio: client: call on_error when connection is dropped
When connection is dropped, we get "nonzero" error code ec in
read_socket callback.  We can just call on_error callback if ec is
nonzero.  But there is a problem when we did ordered shutdown.  In
this case, we also get EOF in ec, but we don't want to call on_error
because it is not an error.  To workaround this, we check return value
of should_stop().  If it is true, then we assume that HTTP/2 session
cleanly ended, and we don't call on_error.
2015-11-19 00:04:10 +09:00
Tatsuhiro Tsujikawa 8b4f6f1778 nghttpd: Defered eviction of cached fd using timer
To make use cache fd more robust manner (e.g. among several
connections), eviction of cached file descriptor now takes place using
timer.  The timer is started when there is no handler (no
connections).  The timeout value is hard-coded and 2 seconds.
2015-11-18 23:21:57 +09:00
Tatsuhiro Tsujikawa 8c94341c18 h2load: Override user-agent with -H option
This commit allows user to override user-agent with -H option.  We
also enabled custom header support for http/1.1 requests.  We also did
minor optimizations (std::vector::reserve).
2015-11-18 22:25:02 +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 eb4e402aae Merge branch 'master' into simple-extensions 2015-11-14 22:31:52 +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 c711a80411 src: Fix typo
Apply typo fixes to the original source files in the previous commit
which were done in generated text.
2015-11-09 21:43:25 +09:00
Tatsuhiro Tsujikawa dbbed64146 nghttpx: Fix bug that causes connection failure with backend proxy URI
This is a regression when we introduced SSL/TLS session resumption in
HTTP/2 backend.  Before the introduction of session resumption,
conn_.tls.ssl is always nullptr when connection is made to proxy.  But
we have to keep conn_.tls.ssl to enable session resumption, so our
code breaks when it is reused.  This commit fixes this issue.

See GH-421
2015-11-09 21:35:53 +09:00
Tatsuhiro Tsujikawa 9b18e47671 nghttpx: Use --backend-tls-sni-field to verify certificate hostname 2015-11-08 00:22:44 +09:00
Tatsuhiro Tsujikawa b89f1f5869 asio: ALPN support 2015-11-07 22:53:25 +09:00
Tatsuhiro Tsujikawa eaefce3792 nghttp: Record request method to output it in har correctly 2015-11-07 16:13:06 +09:00
Tatsuhiro Tsujikawa 558934cee5 src: Use nghttp2_session_upgrade2 2015-11-07 16:13:06 +09:00
Tatsuhiro Tsujikawa 6958d0b55d nghttp: Use method given in -H with ":method" in HTTP Upgrade 2015-11-07 11:14:28 +09:00
Tatsuhiro Tsujikawa 7755c2827c nghttpx: Reserve headers vector 2015-11-05 23:47:22 +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 cb73fa1d3b h2load: Return SSL_TLSEXT_ERR_NOACK if there is protocol list overlap in NPN 2015-11-05 21:26:38 +09:00
Tatsuhiro Tsujikawa 0dc7fee713 h2load: Print "space savings" to measure header compression efficiency 2015-11-04 01:04:56 +09:00
Tatsuhiro Tsujikawa be0d0e2995 Rename nghttp2_session_request_allowed as nghttp2_session_check_request_allowed 2015-10-30 22:48:27 +09:00
Tatsuhiro Tsujikawa 5d611d2e24 Merge branch 'master' into simple-extensions 2015-10-29 23:24:34 +09:00
Tatsuhiro Tsujikawa 1e7f0d833e nghttpd: Don't show read error if mime types file is not set by user manually 2015-10-29 23:08:52 +09:00
Tatsuhiro Tsujikawa 1c37abc0dd Add nghttp2_session_request_allowed() API function
This function is useful for the client application to know that there
is a chance that request can be sent.  If this function returns 0,
there is zero chance to make a request.

This commit also set error_code passed to
nghttp2_on_stream_close_callback to NGHTTP2_REFUSED_STREAM if request
is not sent.
2015-10-29 22:53:30 +09:00
Tatsuhiro Tsujikawa ad395f0603 h2load: Handle request submission failure
If request submission is failed, make all remaining requests for that
client fail.
2015-10-29 22:31:03 +09:00
Tatsuhiro Tsujikawa e3878b619f h2load: Update doc 2015-10-29 21:16:47 +09:00
Tatsuhiro Tsujikawa 3641b123f3 h2load: Stream error should be counted toward `errored` 2015-10-29 21:15:22 +09:00
Tatsuhiro Tsujikawa f29ccc9c20 nghttpd: Read /etc/mime.types to set content-type header field
User can change file name using --mime-types-file option.
2015-10-29 00:21:36 +09:00
Tatsuhiro Tsujikawa ecb4a208fb nghttpx: Use ev_feed_event to signal write for HTTP backend
It seems that using ev_feed_event to signal write operation is much
faster than starting watcher.  This is probably due to the fact that
we don't need to wait in event loop.  The same thing cannot be done in
HTTP/2 frontend, since this will raise write operation for each stream
HEADER/DATA write, which leads to very small packets, hurting
performance.  Interestingly, HTTP/1 frontend also suffers the same
performance hit.
2015-10-28 23:26:41 +09:00
Tatsuhiro Tsujikawa d9f73c36c3 nghttpx: Log :authority as $http_host if available 2015-10-28 23:12:16 +09:00
Lucas Pardue 76df93fdf4 h2load: do not overwrite protocol value 2015-10-28 11:04:09 +00:00
Tatsuhiro Tsujikawa 1aa8e8cd9f nghttpx: Simplify add_header 2015-10-28 02:57:31 +09:00
Tatsuhiro Tsujikawa b051ddec2a h2load: Show application protocol with OpenSSL < 1.0.2
This commit also fixes the problem that application protocol is not
shown if cleartext spdy is used.
2015-10-28 02:40:04 +09:00