Commit Graph

758 Commits

Author SHA1 Message Date
Tatsuhiro Tsujikawa 2ae1da113e src: Use C++ style comments for C++ source code 2014-05-14 23:22:23 +09:00
Tatsuhiro Tsujikawa 5b4f02dfe0 src: Rewrite util::format_hex 2014-05-14 23:09:33 +09:00
Tatsuhiro Tsujikawa e47b976691 src: Eliminate use of snprintf 2014-05-14 22:39:28 +09:00
Tatsuhiro Tsujikawa be4c75a7e9 src: Use gmtime_r instead of gmtime 2014-05-14 21:23:21 +09:00
Tatsuhiro Tsujikawa 7b9a8acc22 Add HPACK deflation API 2014-05-13 23:42:55 +09:00
Tatsuhiro Tsujikawa d3fa938f1f nghttpd: Fix compiler warning 2014-05-11 21:51:25 +09:00
Tatsuhiro Tsujikawa 74ad10c355 nghttpx: Log :authority for CONNECT request in accesslog 2014-05-10 00:55:15 +09:00
Tatsuhiro Tsujikawa 1bd43e094a nghttp: Remove streams from HttpClient 2014-05-08 00:29:46 +09:00
Tatsuhiro Tsujikawa e8de437d5c Return new stream ID from nghttp2_submit_{request, headers, push_promise}
Previously stream ID was assigned just before HEADERS or PUSH_PROMISE
was serialized and nghttp2_submit_{request, headers, push_promise} did
not return stream ID.  The application has to check assigned stream ID
using before_frame_send_callback.  Now it is apparent that priority is
meant to DATA transfer only.  Also application can reorder the
requests if it wants. Therefore we can assign stream ID in
nghttp2_submit_* functions and return stream ID from them.  With this
change, now application does not have to check stream ID using
before_frame_send_callback and its code will be simplified.
2014-05-07 23:24:07 +09:00
Alexis La Goutte ed63674b88 Fix GCC build with -Werror
timegm.h:30:8: error: C++ style comments are not allowed in ISO C90 [-Werror]
2014-05-06 17:06:40 +02:00
Tatsuhiro Tsujikawa 9228e223fa Remove NGHTTP2_ERR_GZIP error code 2014-05-06 23:42:57 +09:00
Tatsuhiro Tsujikawa 43fb7f707f Fix unittest build error 2014-05-06 23:42:32 +09:00
Tatsuhiro Tsujikawa 4f027c1562 libnghttp2: Remove dependency to zlib
We inherited gzip compression API from spdylay codebase.  In spdylay,
the cost of having such API is almost free because spdylay requires
zlib for header compression.  nghttp2 no longer uses gzip to header
compression.  zlib dependency exists just for gzip compression API,
which is not an essential.  So we decided to move gzip code to under
src and remove zlib dependency from libnghttp2 itself.  As nghttp2
package, we depend on zlib to compile tools under src.
2014-05-06 23:10:50 +09:00
Tatsuhiro Tsujikawa 9125499dd0 src: Implement per-frame DATA compression
Currently, nghttpd server only compresses files whose extensions are
one of .html, .js, .css and .txt.  nghttp advertises its support of
per-frame compression in SETTINGS frame.  To implement this feature,
we added 2 public API: nghttp2_session_get_remote_settings() and
nghttp2_gzip_inflate_finished().
2014-05-03 00:02:17 +09:00
Nicholas Hurley f3f9210dae Add --disable-threads option for configure
This allows users of OS X 10.9 to run nghttpd (and friends) with
threading entirely disabled, to avoid crashes on startup related to
std::mutex.
2014-05-01 17:18:29 -07:00
Tatsuhiro Tsujikawa 660c536275 Extend namelen and valuelen in nghttp2_nv to size_t 2014-04-30 23:08:34 +09:00
Tatsuhiro Tsujikawa abe74f869f Ditto 7730b13e5a 2014-04-30 22:44:51 +09:00
Alexis La Goutte 7730b13e5a Fix Address of stack memory associated with local variable 'flag' is still
referred to by the global variable 'long_options' upon returning to the caller.
This will be a dangling reference

Found by Clang Analyzer
2014-04-30 22:06:42 +09:00
Tatsuhiro Tsujikawa b5d793dee6 app_helper: Remove redundant line separator after frame debug output 2014-04-30 10:01:19 +09:00
Tatsuhiro Tsujikawa 4caddec9ba nghttp: Align NULL separated header fields 2014-04-30 09:56:33 +09:00
Tatsuhiro Tsujikawa bc50062964 nghttp: Fix crash on PUSH_PROMISE 2014-04-29 15:08:57 +09:00
Tatsuhiro Tsujikawa fa8b310cfd nghttpx: Return SSL_TLSEXT_ERR_OK from servername_callback 2014-04-27 23:17:19 +09:00
Tatsuhiro Tsujikawa 6d5f402380 Add nghttp2_adjust_priority_callback
Callback function invoked to adjust priority value for request
HEADERS.

Since the application doesn’t know stream ID when it submits
requests, it may not be able to add correct priority value to HEADERS
frame and forced to use follwing PRIORITY frame. The purpose of this
callback is give the chance to the application to adjust priority
value with the latest information it has just before transmission so
that correct priority is included in HEADERS frame and it doesn’t
have to send additional PRIORITY frame.
2014-04-27 14:48:43 +09:00
Tatsuhiro Tsujikawa a82b7f09c8 nghttpx: Drop HTTP/2 backend connection unless TLSv1.2 or TLSv1.1 was negotiated 2014-04-26 23:00:58 +09:00
Tatsuhiro Tsujikawa 75bfbc94dd nghttpx: Require TLSv1.2 or TLSv1.1 for NPN as well 2014-04-26 22:51:39 +09:00
Tatsuhiro Tsujikawa 6c66bd5c7c ALPN: Do not negotiate HTTP/2 unless TLSv1.2 or TLSv1.1 was used 2014-04-26 22:37:48 +09:00
Tatsuhiro Tsujikawa cd69ed20c3 nghttpx: Select SPDY protocol in ALPN 2014-04-26 19:36:35 +09:00
Tatsuhiro Tsujikawa a8a2236da9 nghttpx: Add --add-response-header option 2014-04-26 14:56:08 +09:00
Tatsuhiro Tsujikawa 293b717b04 nghttp: Fix bug that -H does not allow single letter header name 2014-04-26 14:53:03 +09:00
Tatsuhiro Tsujikawa 078b1de12e nghttp: Fix uninitialized pri_spec 2014-04-25 21:23:47 +09:00
Tatsuhiro Tsujikawa d84d0b8c5c h2load: Check return of nghttp2_submit_request 2014-04-25 21:23:31 +09:00
Tatsuhiro Tsujikawa 052be3296c Implement compressed DATA
The library interface supports compressed DATA.  The library does not
deflate nor inflate data payload.  When sending data, an application
has to compress data and set NGHTTP2_DATA_FLAG_COMPRESSED to
data_flags parameter in nghttp2_data_source_read_callback.  On
receiving, flags parameter in nghttp2_on_data_chunk_recv_callback
includes NGHTTP2_FLAG_COMPRESSED.  An application should check the
flags and inflate data as necessary.  Since compression context is per
frame, when DATA is seen in nghttp2_on_frame_recv_callback, an
application should reset compression context.
2014-04-25 01:27:18 +09:00
Tatsuhiro Tsujikawa 6bb410d603 Implement BLOCKED frame 2014-04-25 00:38:24 +09:00
Tatsuhiro Tsujikawa 2d4b92fc2b Merge branch 'priority' 2014-04-24 23:48:37 +09:00
Tatsuhiro Tsujikawa 80eb988511 h2load: Add -p, --no-tls-proto option to support SPDY without SSL/TLS
Previously h2load supports SPDY only for https URI.  This is because
SPDY has no mechanism to negotiate its protocol version without NPN.
With this change, user can specify the exact protocol version to use
when http URI (without SSL/TLS) is used.
2014-04-21 21:35:45 +09:00
Tatsuhiro Tsujikawa ac86b51e37 Implement simplified dependency based priority 2014-04-15 22:55:07 +09:00
Tatsuhiro Tsujikawa 6326aec089 nghttpx: Return std::unique_ptr from parse_config_str_list 2014-04-08 22:44:30 +09:00
Tatsuhiro Tsujikawa f9f6cdc93d nghttpx: Specify altsvc info in one option and allow multiple occurrences 2014-04-08 22:28:50 +09:00
Tatsuhiro Tsujikawa d998e79549 h2load: Link with timegm 2014-04-06 17:35:00 +09:00
Tatsuhiro Tsujikawa 59c9c4511c nghttpx: Use move to insert crumbled cookies 2014-04-05 23:45:07 +09:00
Tatsuhiro Tsujikawa 5b55874d4d Fix static analysis error 2014-04-05 20:04:09 +09:00
Tatsuhiro Tsujikawa c2bb9c01a6 nghttp: Update doc for -p option and improve error handling for it 2014-04-05 19:15:45 +09:00
Tatsuhiro Tsujikawa 0a527f16f5 nghttpx: Log when connection was upgraded to HTTP/2 2014-04-05 18:59:22 +09:00
Tatsuhiro Tsujikawa 8f23c0c38b Name unnamed union in nghttp2_priority_spec so that we can be C90 compatible 2014-04-05 18:40:44 +09:00
Tatsuhiro Tsujikawa e7ad3633c7 nghttp2_data_source_read_callback: Replace eof with uint32_t *data_flags
Replace int *eof with uint32_t *data_flags so that we can easily
extend functionality if we have to (but we don't do if possible).
2014-04-05 17:59:24 +09:00
Tatsuhiro Tsujikawa d668d2448b Hide session option from public API
To make adding new option easier, we decided to make the details of
option struct private and hide it from public API.  We provide
functions to set individual option value.
2014-04-04 21:57:47 +09:00
Tatsuhiro Tsujikawa 2a49e164c8 nghttpx: Fix crash with HTTP/2 downstream 2014-04-03 19:14:05 +09:00
Tatsuhiro Tsujikawa 22c88af1ab nghttpx: Resume deferred DATA after complete DATA frame arrived on backend
If SPDY or HTTP/2 ustream is used and HTTP/2 downstream is used, only
call {spdylay,nghttp2}_resume_data when complete DATA frame was read
in backend to avoid to transmit too small DATA frame to the upstream.
2014-04-03 18:54:15 +09:00
Tatsuhiro Tsujikawa db6c41a219 nghttpx: Add altsvc related options
To advertise alternative serive, at least --altsvc-port and
--altsvc-protocol-id must be specified.
2014-04-03 13:20:50 +09:00
Tatsuhiro Tsujikawa 1d38df0a31 nghttp: Don't index authorization header field for debugging purpose 2014-04-03 11:33:15 +09:00
Tatsuhiro Tsujikawa b1edb1f3ae Don't index name/value pair bearing NO_INDEX flag when forwarding it 2014-04-03 11:22:11 +09:00
Tatsuhiro Tsujikawa 35a45f9d47 src: Initialize nghttp2_nv flags 2014-04-02 20:37:33 +09:00
Tatsuhiro Tsujikawa c9f90924a9 Add flags parameter to nghttp2_on_header_callback 2014-04-02 02:10:35 +09:00
Tatsuhiro Tsujikawa 24cb90806d Add flags to nghttp2_nv structure
This is preliminary change for upcoming HPACK updates.  The flags are
used to determine the name/value pair is indexable or not.
2014-04-01 23:17:50 +09:00
Tatsuhiro Tsujikawa b143039b60 src: Output debug data in GOAWAY in printable ascii
Non printable ascii is printed as ".".
2014-03-31 23:17:51 +09:00
Tatsuhiro Tsujikawa f011bda377 src: Compile defaltehd and inflatehd with c++
This commit also fixes defaltehd always reports output length is 0.
2014-03-30 22:41:02 +09:00
Tatsuhiro Tsujikawa 34581d830d Define NGHTTP2_CLEARTEXT_PROTO_VERSION_ID
This identifier string is used if HTTP/2 is used over cleartext TCP.
2014-03-30 21:30:47 +09:00
Tatsuhiro Tsujikawa 60a2c260a5 Define NGHTTP2_CLIENT_CONNECTION_PREFACE macro
NGHTTP2_CLIENT_CONNECTION_PREFACE has the same content with
NGHTTP2_CLIENT_CONNECTION_HEADER, which is now obsoleted by
NGHTTP2_CLIENT_CONNECTION_PREFACE.
2014-03-30 21:02:25 +09:00
Tatsuhiro Tsujikawa ab2dc5967d Replace HTTP/2.0 with HTTP/2 2014-03-30 19:26:37 +09:00
Tatsuhiro Tsujikawa bd7d335d9a src: Print padlen first 2014-03-30 01:24:17 +09:00
Tatsuhiro Tsujikawa f7162ab702 Implement dependency based priority 2014-03-30 01:24:16 +09:00
Tatsuhiro Tsujikawa 8ccb6e463d nghttpx: Use raw-string iteral to output help 2014-03-22 22:03:13 +09:00
Tatsuhiro Tsujikawa e4dacb2f6f nghttpd: Use raw-string literal to output help 2014-03-22 21:35:00 +09:00
Tatsuhiro Tsujikawa 0a80b0c1aa nghttpd: Set write timeout for stream blocked by flow controll only
This change also reset read timeout when we have sent HEADERS,
PUSH_PROMISE or DATA.
2014-03-22 00:41:01 +09:00
Tatsuhiro Tsujikawa fac42788bc nghttpd: Rename Request as Stream 2014-03-21 23:26:53 +09:00
Tatsuhiro Tsujikawa 464fef7c6e nghttpd: Add HTTP/2 stream read/write timeout 2014-03-21 23:07:20 +09:00
Tatsuhiro Tsujikawa 334656b704 nghttpx: Announce 2.0 in via header field 2014-03-21 19:25:46 +09:00
Tatsuhiro Tsujikawa ba5d9d3352 nghttpx: Add x-forwarded-proto header field to downstream HTTP/2 request 2014-03-21 18:57:57 +09:00
Tatsuhiro Tsujikawa c048ac5eff nghttpd: Avoid to use bufferevent for connection 2014-03-18 00:09:59 +09:00
Tatsuhiro Tsujikawa fbfa3adc42 h2load: traffic bytes data should be based on all traffic 2014-03-16 19:36:41 +09:00
Tatsuhiro Tsujikawa 775d07ace4 EvbufferBuffer: Optimize a bit 2014-03-15 16:23:12 +09:00
Tatsuhiro Tsujikawa fef01a3c39 nghttpd: Honor server's cipher preferece order 2014-03-15 16:11:30 +09:00
Tatsuhiro Tsujikawa a7eb6502a9 src: Use large transmission buffer to reduce SSL/TLS overhead 2014-03-15 16:10:42 +09:00
Tatsuhiro Tsujikawa a457d2a138 h2load, nghttp: Use SNI field for non-numeric host 2014-03-15 15:32:38 +09:00
Tatsuhiro Tsujikawa 843ecd8cc1 h2load: Support multiple URIs
Supplying multiple URIs can simulate more real life situation on
server side.  For example, we can supply URIs of html, css and js and
benchmark the server.  The -m option is updated so that it defaults to
the number of supplied URIs.
2014-03-14 23:15:01 +09:00
Tatsuhiro Tsujikawa 7ffa594d4c nghttp: Use raw-literal string for help output 2014-03-14 01:53:28 +09:00
Tatsuhiro Tsujikawa 136d997596 h2load: Support -W option for SPDY, if the value >= 16 2014-03-14 01:40:41 +09:00
Tatsuhiro Tsujikawa 2b7627f70c h2load: Use raw-string literal for help output 2014-03-14 01:06:47 +09:00
Tatsuhiro Tsujikawa 0620052f50 src: Use std::numeric_limits<>::max() instead of INT64_MAX 2014-03-14 00:54:10 +09:00
Tatsuhiro Tsujikawa d07bb1ddff Rework outbound frame buffers 2014-03-13 22:11:02 +09:00
Tatsuhiro Tsujikawa 358b4386d3 Introduce nghttp2_buf to ease buffer management 2014-03-11 01:47:38 +09:00
Tatsuhiro Tsujikawa d074cb611f nghttpx: Add rate limit per worker thread
The existing options --{read,write}-{rate,burst} are per connection.
The new options --worker-{read,write}-{rate,burst} are per worker
thread, which is overall rate limit of all connections worker handles.
2014-03-09 14:53:28 +09:00
Tatsuhiro Tsujikawa 7f18eced0b src: Use jemalloc if available 2014-03-05 21:38:33 +09:00
Tatsuhiro Tsujikawa 27e161dc31 src: Add EvbufferBuffer class to simplify the code base 2014-03-05 00:23:33 +09:00
Tatsuhiro Tsujikawa 3ca4539f99 nghttpd: Only emit content-encoding: gzip when error-gzip is on 2014-03-04 23:37:42 +09:00
Tatsuhiro Tsujikawa ddfa93ff5b nghttpx: Make socketpair in internal use non-block 2014-03-04 23:34:48 +09:00
Tatsuhiro Tsujikawa a61ca763df nghttpd: Add -e option to toggle gzipped error response 2014-03-04 23:29:30 +09:00
Tatsuhiro Tsujikawa caeeba681f nghttpd: Add multi threading support 2014-03-04 23:14:26 +09:00
Tatsuhiro Tsujikawa d4ea2418d8 nghttpx: Use LibsslGlobalLock 2014-03-04 21:33:43 +09:00
Tatsuhiro Tsujikawa 73f55e7b7a h2load: Fix crash with multi threading 2014-03-04 21:32:57 +09:00
Tatsuhiro Tsujikawa 13be30e582 Update src/.gitignore 2014-03-04 01:16:42 +09:00
Tatsuhiro Tsujikawa 5cfb51c881 h2load: Support parellel native threads execution with -t option 2014-03-04 01:12:11 +09:00
Tatsuhiro Tsujikawa f3183efe04 nghttpd: Emit protocol id error only when verbose output is enabled 2014-03-03 23:51:46 +09:00
Tatsuhiro Tsujikawa b5341ebac6 nghttpd: More SSL_CTX options and support EDCHE cipher 2014-03-03 23:49:13 +09:00
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 3d211e1cfd h2load: Fix compiler warning 2014-03-03 00:53:31 +09:00
Tatsuhiro Tsujikawa 1337fa8bfe src: Add h2load, benchmarking tool for HTTP/2 and SPDY 2014-03-02 23:45:47 +09:00
Tatsuhiro Tsujikawa c1e1a1be5a nghttpx: Cast uint8_t to uint32_t to display it as numeric value 2014-03-02 23:22:28 +09:00
Tatsuhiro Tsujikawa a85455ed0b src: Zero clear http_parser_url struct 2014-02-27 22:11:31 +09:00
Tatsuhiro Tsujikawa 227a48cea1 src: Move http_parser_url related functions to util 2014-02-27 21:53:52 +09:00
Tatsuhiro Tsujikawa 13cc3f2fe9 src, python: Only produce header_table_size when it is changed 2014-02-25 23:55:06 +09:00
Tatsuhiro Tsujikawa 9cc7f9fb36 nghttp: Wait for pushed resources to complete
The statistics of pushed resources are also calculated.
2014-02-25 01:16:47 +09:00
Tatsuhiro Tsujikawa d1c1deaf03 Add promised_stream_user_data parameter to nghttp2_submit_push_promise
This is very useful to associate application specific data to promised
stream.

nghttp2_nv_array_copy now does not complain the header field is large.
2014-02-25 00:26:12 +09:00
Tatsuhiro Tsujikawa 86aa905c10 nghttpx: Code cleanup 2014-02-22 11:26:32 +09:00
Tatsuhiro Tsujikawa fc25143418 Remove END_PUSH_PROMISE in favor of END_HEADERS 2014-02-21 21:23:51 +09:00
Tatsuhiro Tsujikawa 659c3b0aa0 nghttpx: Initialize response_htp_ with 0 2014-02-20 21:30:25 +09:00
Tatsuhiro Tsujikawa bbc09b005b nghttpd: Use nghttp2_session_mem_recv and nghttp2_session_mem_send 2014-02-19 23:27:53 +09:00
Tatsuhiro Tsujikawa 1e1e77ad5e nghttp: Use nghttp2_session_mem_recv and nghttp2_session_mem_send 2014-02-19 23:27:52 +09:00
Tatsuhiro Tsujikawa cdf5d5402b nghttpx: Code cleanup 2014-02-19 23:11:26 +09:00
Tatsuhiro Tsujikawa 3c96041c43 nghttpx: Fix typo 2014-02-19 22:53:33 +09:00
Tatsuhiro Tsujikawa 6320bd8926 nghttpx: Fix priority bits 2014-02-19 22:52:00 +09:00
Tatsuhiro Tsujikawa 649586fff6 Add nghttp2_session_mem_send() API function
This function behaves like nghttp2_session_send(), but it does not
use nghttp2_send_callback to send data. Instead, it returns the
serialized data to trasmit and its length to the caller.
2014-02-18 23:23:11 +09:00
Tatsuhiro Tsujikawa f5342494f4 src: Format help message and add --version to make man page generation easier 2014-02-16 19:39:41 +09:00
Tatsuhiro Tsujikawa 1fd5fdd54a src: Remove redundant SETTINGS_ENABLE_PUSH from server side 2014-02-16 16:05:26 +09:00
Tatsuhiro Tsujikawa 7504d89f9b src: Add at most N bytes as padding if --padding option is used 2014-02-15 16:40:32 +09:00
Tatsuhiro Tsujikawa fd88c6160d HPACK post -05 updates
* Use 1 Huffman code table for both request and response
* Remove complicated deflater side table size management
* Add encoding context update
* Fix memory leak in inflater
2014-02-13 23:22:52 +09:00
Tatsuhiro Tsujikawa cd3eae3dd2 src: Fix select_padding_callback which returns value greater than max_payload 2014-02-11 19:19:00 +09:00
Tatsuhiro Tsujikawa c280cc7c4d nghttpx: Add --padding option for debugging purpose 2014-02-11 17:23:22 +09:00
Tatsuhiro Tsujikawa 39fe7a5cfa Don't set select_padding_callback if padding_boundary is 0 or not set 2014-02-11 16:48:27 +09:00
Tatsuhiro Tsujikawa 78d202ac30 Callback based padding from application
Now previous padding options are removed and instead we added
select_padding_callback to select padding length for each frame
by application. If this callback is not implemented by application,
no padding is added.

This change also fixes the broken session_detect_idle_stream()
if stream_id is our side.
2014-02-11 15:28:44 +09:00
Tatsuhiro Tsujikawa 118ed09da5 Allow disabling padding 2014-02-09 23:53:53 +09:00
Tatsuhiro Tsujikawa 68b5ffc1dc Rename padding related names 2014-02-09 21:46:15 +09:00
Tatsuhiro Tsujikawa ce53d7bd9e src: Don't output priority if NGHTTP2_FLAG_PRIORITY is not set 2014-02-09 21:34:28 +09:00
Tatsuhiro Tsujikawa c7c283f3a9 nghttpx: Add --frontend-frame-debug option to debug HTTP/2 frame in upstream
The output format is the same one with nghttp/nghttpd. The output
is made into stderr to make it sync with logging.
2014-02-09 18:47:26 +09:00
Tatsuhiro Tsujikawa 1db2195389 Implement padding for HEADERS and CONTINUATION 2014-02-09 15:17:26 +09:00
Tatsuhiro Tsujikawa be9d5efa4c nghttp: Add --continuation option to test CONTINUATION 2014-02-08 00:23:18 +09:00
Tatsuhiro Tsujikawa 814d0f76f3 Implement DATA frame padding 2014-02-08 00:23:18 +09:00
Tatsuhiro Tsujikawa c79adf6997 Remove flow control disabling feature 2014-02-06 00:23:20 +09:00
Tatsuhiro Tsujikawa 8be17f077a Add nghttp2_check_header_name and nghttp2_check_header_value APIs
These are promoted to public API from src/http2.h
2014-02-01 19:31:50 +09:00
Tatsuhiro Tsujikawa e186e01933 Replace on_end_headers_callback with on_begin_headers_callback
Previously, there is inconsistency when on_frame_recv_callback
is called between HEADERS/PUSH_PROMISE and the other frames.
For former case, it is called before header block, in latter
case, it is called after whole frame is received. To make it
consistent, we call on_frame_recv_callback for HEADERS/PUSH_PROMISE
after its frame is fully received. Since on_frame_recv_callback
can signal the end of header block, we replaced on_end_headers_callback
with on_begin_headers_callback, which is called when the reception
of the header block is started.
2014-01-29 21:23:13 +09:00
Tatsuhiro Tsujikawa ff475104ab nghttpx: Fix runtime errors due to uninitialized values 2014-01-29 00:59:12 +09:00
Tatsuhiro Tsujikawa 878afd7df1 nghttp: Fix bad handling of addrinfo 2014-01-28 01:40:00 +09:00
Tatsuhiro Tsujikawa 864789ca65 nghttpx: Limit the maximum header block size (again) 2014-01-28 01:17:54 +09:00
Tatsuhiro Tsujikawa ce434d56a7 src: Print header emission with stream_id
Since all headers are not always longer available on one
nghttp2_session_mem_recv call, received headers may be interleaved
with transmission log of the other frames. To make it clear that
each header belongs to which stream, each header is printed with
stream_id.
2014-01-28 00:20:48 +09:00
Tatsuhiro Tsujikawa a3082b7c1e Remove nghttp2_on_data_recv_callback and nghttp2_on_data_send_callback
nghttp2_data is added to nghttp2_frame union. When DATA is
received, nghttp2_on_frame_recv_callback is called. When DATA is
sent, nghttp2_on_frame_send_callback is called.
2014-01-27 22:16:05 +09:00
Tatsuhiro Tsujikawa fbffd2c923 nghttpx: Limit the number of receiving headers 2014-01-27 00:45:36 +09:00
Tatsuhiro Tsujikawa 545f24bc1b Remove nghttp2_on_frame_recv_parse_error_callback 2014-01-26 23:23:07 +09:00
Tatsuhiro Tsujikawa 6e6127037b src: Fix compiler warning 2014-01-26 23:13:02 +09:00
Tatsuhiro Tsujikawa 9314e30987 Support transmission of CONTINUATION, change nghttp2_frame_hd
The maximum frame size including header block is still limited
to NGHTTP2_HD_MAX_BUFFER_LENGTH, which is 32KB.
2014-01-26 23:10:33 +09:00
Tatsuhiro Tsujikawa e7fc2951b8 nghttp2_hd: Define dedicated struct for HPACK deflater and inflater 2014-01-26 17:53:04 +09:00
Tatsuhiro Tsujikawa 8317559090 nghttp2_hd: Implement stream header inflater
This stream inflater can inflate incoming header block in streaming
fashion. Currently, we buffer up single name/value pair, but we chose
far more smaller buffer size than HTTP/2 frame size.
2014-01-25 18:24:15 +09:00
Tatsuhiro Tsujikawa a8e4da8058 deflatehd: Fix wire is not written if length is 0 2014-01-24 21:54:00 +09:00
Tatsuhiro Tsujikawa 1f4577adb9 nghttp: Use getaddrnfo directly instead of using evdns_base
evdns_base uses /etc/resolve.conf for *nix like systems,
but all platforms don't have the file (e.g., android device).
For such platforms, address resolution fails.
To fix this problem we use getaddrinfo() directly.
2014-01-23 00:29:09 +09:00
Tatsuhiro Tsujikawa 9cd90bcff2 nghttp: Fix host to connect when SSL/TLS is used 2014-01-22 21:55:30 +09:00
Tatsuhiro Tsujikawa be71e1f11c nghttp: Update doc 2014-01-21 23:24:13 +09:00
Tatsuhiro Tsujikawa 72aef67cca nghttp: Replace build-in headers completely with -H option 2014-01-20 21:54:03 +09:00
Tatsuhiro Tsujikawa 16497d91c1 nghttpx: Call upstream_writecb when underlying bufferevent buffer gets empty 2014-01-19 23:32:07 +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 660e1ec44d nghttpx: Move backend outbuf threshold to each downstream type 2014-01-19 18:07:50 +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 6f5e1662c6 nghttpx: Handle error from Downstream::resume_read() 2014-01-19 14:42:42 +09:00
Tatsuhiro Tsujikawa becc206ba9 nghttpx: Don't show warning WINDOW_UPDATE failure for HTTP/1 downstream 2014-01-19 00:38:11 +09:00
Tatsuhiro Tsujikawa 4ed4efc241 nghttpx: Disable TLS renegotiation 2014-01-18 19:53:52 +09:00
Tatsuhiro Tsujikawa 8f3d4fdeec nghttpx: Remove deprecated evbuffer_setcb, send WU before buffer gets empty 2014-01-18 18:39:25 +09:00
Tatsuhiro Tsujikawa 0872ce27f4 nghttpx: Use nghttp2_session_mem_recv instead of nghttp2_session_recv 2014-01-18 16:50:52 +09:00
Tatsuhiro Tsujikawa 50dd7ada50 nghttpx: Code cleanup 2014-01-18 16:32:22 +09:00
Tatsuhiro Tsujikawa 59ff0b2f77 nghttpx: Propagate upstream priority change to downstream 2014-01-18 16:12:03 +09:00
Tatsuhiro Tsujikawa 68b5204f29 src: Set errno = 0 before calling strtol 2014-01-18 15:32:50 +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 8fdc37ab13 src: Don't show option candidates if full-match or single prefix-match 2014-01-13 23:51:10 +09:00
Tatsuhiro Tsujikawa a54c5bef54 src: Must suffix-match at least 3 characters to be a option candidate 2014-01-13 23:29:10 +09:00
Tatsuhiro Tsujikawa 8c6f3d1054 nghttpx: Set our own default cipher list 2014-01-13 23:01:22 +09:00
Tatsuhiro Tsujikawa 59c10ea4c2 src: Make the cost of suffix matched option 0 2014-01-12 22:02:19 +09:00
Tatsuhiro Tsujikawa c3949b0d7f Fix compiler warning 2014-01-11 17:49:33 +09:00
Tatsuhiro Tsujikawa da9bbb58fb HPACK tools: Use JSON data format used in hpack-test-case
The input and output data format now use same JSON format used in
hpack-test-case.
2014-01-11 17:02:14 +09:00
Tatsuhiro Tsujikawa 0e9390d5ad Move http-parser to third-party dir and fix `make distcheck` 2014-01-11 00:36:20 +09:00
Tatsuhiro Tsujikawa 505d607b22 src: Update .gitignore 2014-01-10 23:22:23 +09:00
Tatsuhiro Tsujikawa 9dcd6b003d Refactor configure options
--enable-src is renamed as --enable-app. Fix build failure if
libxml2 is not available.
2014-01-10 23:19:36 +09:00
Tatsuhiro Tsujikawa 0f1dea4f42 Move HPACK tools from hdtest to src 2014-01-10 21:53:48 +09:00
Tatsuhiro Tsujikawa 25a6596e77 nghttpx: Call Http2Session::disconnect() if initiate_connection() failed
This will clean up resources allocated in initiate_connection()
properly.
2014-01-10 21:32:39 +09:00
Tatsuhiro Tsujikawa 8721631287 nghttp: Fix port checking to share connection 2014-01-10 00:59:14 +09:00
Tatsuhiro Tsujikawa 88d31ada75 src: Handle PUSH_PROMISE from client and request HEADERS from server
They are just RST_STREAMed for now
2014-01-09 23:47:21 +09:00
Tatsuhiro Tsujikawa 90ea7ba92a src: Add command-line option guess 2014-01-09 01:27:56 +09:00
Tatsuhiro Tsujikawa a15fc5fbb4 nghttpx: Send acceptable list of CAs when client cert auth is enabled 2014-01-09 00:07:51 +09:00
Tatsuhiro Tsujikawa c36ce28f69 src: Call SSL_set_shutdown(ssl, SSL_RECEIVED_SHUTDOWN) 2014-01-08 23:32:47 +09:00
Tatsuhiro Tsujikawa dacfecf41a lib, src, hdtest: Ensure that config.h is included 2014-01-08 23:30:02 +09:00
Tatsuhiro Tsujikawa ecc4290d3d nghttp: Fix crash on plain HTTP 2014-01-08 02:15:46 +09:00
Tatsuhiro Tsujikawa c531e691fc src: Use SSLv23_method for tests 2014-01-06 16:07:18 +09:00
Tatsuhiro Tsujikawa f2e830309e src: Add test for shrpx_config 2014-01-06 16:06:02 +09:00
Tatsuhiro Tsujikawa 7ce3065f32 nghttpx: Add --tls-proto-list option to enable SSL/TLS protocol selectively 2014-01-02 13:08:54 +09:00
Tatsuhiro Tsujikawa 3e21bed4f9 nghttpx: Make parse_config_npn_list generic 2014-01-02 13:08:54 +09:00
Tatsuhiro Tsujikawa 20877b1107 nghttpx: Don't allow application protocol not listed in --npn-list option 2014-01-02 00:53:07 +09:00
Tatsuhiro Tsujikawa 78e5149495 src: Support ALPN
Requires unreleased OpenSSL >= 1.0.2
2014-01-02 00:15:08 +09:00
Tatsuhiro Tsujikawa f0d7323902 nghttpx: Use SSL_CTX_set_ecdh_auto for OpenSSL >= 1.0.2 2014-01-01 23:26:00 +09:00
Tatsuhiro Tsujikawa 73866124f3 nghttp: Untabify 2013-12-31 11:15:58 +09:00
David Weekly 19e187cd92 More useful warning on NPN negotiation failure due to draft version mismatch 2013-12-31 00:12:21 +00:00
Tatsuhiro Tsujikawa 1c43cdbbc8 nghttpx: Don't rewrite location if proxy mode is used 2013-12-28 17:02:43 +09:00
Tatsuhiro Tsujikawa c0726036b1 nghttpd: Use -1 as backlog 2013-12-27 00:02:43 +09:00
Tatsuhiro Tsujikawa ad369ec299 nghttpx: Use -1 as default value of --backlog 2013-12-26 21:39:00 +09:00
Tatsuhiro Tsujikawa 9cb8754d09 Rename nghttp2_session_fail_session as nghttp2_session_terminate_session 2013-12-26 00:23:07 +09:00
Tatsuhiro Tsujikawa 5bb1c653ef src: Omit \r\n sanitization on header value
This is because nghttp2 and spdylay now don't allow \r\n in header
value. Require spdylay >= 1.2.3.
2013-12-26 00:08:42 +09:00
Tatsuhiro Tsujikawa 04e496d7bd nghttpd: Use nghttp2_session_fail_session instead of nghttp2_submit_goaway 2013-12-25 00:40:57 +09:00
Tatsuhiro Tsujikawa f8356dd037 nghttp: Use nghttp2_session_fail_session instead of nghttp2_submit_goaway 2013-12-25 00:28:58 +09:00
Tatsuhiro Tsujikawa 53271e1e52 nghttp: Close fd on disconnect 2013-12-22 19:23:01 +09:00
Tatsuhiro Tsujikawa c4539046be nghttpx: No string copy if no cookie crumbling occurs 2013-12-22 15:42:12 +09:00
Tatsuhiro Tsujikawa 2af9a37643 src: Code cleanup 2013-12-22 15:33:37 +09:00
Tatsuhiro Tsujikawa e955598923 nghttpx: Remove downstream_port from location rewrite code 2013-12-21 18:35:53 +09:00
Tatsuhiro Tsujikawa 9afebcb229 nghttpx: Ignore port when rewriting location header 2013-12-21 18:26:11 +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 bb70cdf6ad src: Rename verbose callback functions 2013-12-20 23:48:56 +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 873d457dd2 nghttpx: Fix log message 2013-12-20 22:44:30 +09:00
Tatsuhiro Tsujikawa ff2eb0de81 Update doc 2013-12-16 21:17:25 +09:00
Tatsuhiro Tsujikawa 7222f63dbd Revert 3c57327274
It may violate draft-09 section 8.1.3.1. Proxy should perseve
host header field.
2013-12-16 21:14:31 +09:00
Tatsuhiro Tsujikawa 3c57327274 nghttpx: Remove host if :authority is available on HTTP2 downstream request 2013-12-15 18:09:56 +09:00
Tatsuhiro Tsujikawa f4ae707bf2 Revert 0b7b95923e 2013-12-13 21:46:41 +09:00
Tatsuhiro Tsujikawa 0b7b95923e nghttp: Adjust relative priority with -a 2013-12-11 23:26:55 +09:00
Tatsuhiro Tsujikawa 09ba2e8c78 nghttp: Ensure that all settings can be encoded in settings_payload 2013-12-09 21:12:09 +09:00
Tatsuhiro Tsujikawa c3a361fb52 nghttpd: Create Request object in hd_before_frame_send_callback
This is pathological case, but we may get RST_STREAM to the promised
stream while we are sending PUSH_PROMISE. To handle this case,
instantiate Request object before transmission.
2013-12-09 00:22:01 +09:00
Tatsuhiro Tsujikawa ed1d7cdea4 nghttpd: Fix allow_push is not used 2013-12-09 00:04:54 +09:00
Tatsuhiro Tsujikawa 47f53940da nghttpd: Add -p, --push option to configure server push
The option syntax is <PATH>=<PUSH_PATH,...>.
Push resources PUSH_PATHs when PATH is requested. This option can be used
repeatedly to specify multiple push configurations. For example,
  -p/=/foo.png -p/doc=/bar.css
PATH and PUSH_PATHs are relative to document root.
2013-12-09 00:00:12 +09:00
Tatsuhiro Tsujikawa 658b7d0727 src: Replace MAKE_NV macros with function templates 2013-12-08 22:31:43 +09:00
Tatsuhiro Tsujikawa 6c77cec270 Remove nghttp2_submit_* API functions which has char **nv parameter
The nghttp2_submit_{request,response}2 functions are renamed as
nghttp2_submit_{request, response}.
2013-12-08 21:39:43 +09:00
Tatsuhiro Tsujikawa baa2272b0a src: Concatenate header fields with same name by NULL as delimiter
cookie and set-cookie are treated specially and won't be concatenated.
2013-12-07 00:32:14 +09:00
Tatsuhiro Tsujikawa 6ea91e57e0 Adjust struct/class alignment 2013-12-06 23:17:38 +09:00
Tatsuhiro Tsujikawa e596385fc0 src: Split NULL-separated values 2013-12-05 21:54:36 +09:00
Tatsuhiro Tsujikawa 1f0dfd4316 nghttpx: Update doc 2013-12-01 20:55:16 +09:00
Tatsuhiro Tsujikawa 93ad48fe6c nghttpx: Update usage 2013-11-29 22:59:49 +09:00
Tatsuhiro Tsujikawa d1049f389f nghttpx: Use nghttp2_submit_{request, response}2 API 2013-11-28 21:36:04 +09:00
Tatsuhiro Tsujikawa 679a389bd3 nghttpx: Code cleanup 2013-11-26 22:57:29 +09:00
Tatsuhiro Tsujikawa bbebc4ad8d nghttpx: Fix crash on CONNECT or downstream failure 2013-11-21 02:06:28 +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 53b3fba05b nghttpx: Add --http2-no-cookie-crumbling option 2013-11-18 00:03:55 +09:00
Tatsuhiro Tsujikawa faedc4381d nghttpx: Add options to dump HTTP headers in HTTP/2.0 upstream 2013-11-17 23:52:19 +09:00
Tatsuhiro Tsujikawa e14baf134c nghttpx: Implement cookie crumbling 2013-11-16 21:15:55 +09:00
Tatsuhiro Tsujikawa 0c669898a4 nghttp: Allow multiple same headers in -H 2013-11-16 21:13:09 +09:00
Tatsuhiro Tsujikawa a255e4efa6 nghttpx: Use same priority in frontend and backend HTTP2 2013-11-16 15:41:24 +09:00
Tatsuhiro Tsujikawa 81cf484124 Don't DIE when establishing backend HTTP2 connection failed 2013-11-16 01:31:32 +09:00
Tatsuhiro Tsujikawa d946b06e51 src/http-parser: Update to latest HEAD 2013-11-14 23:53:48 +09:00
Tatsuhiro Tsujikawa 40347487c9 Don't sort headers in library code
Remove sorting headers from library code. The application must sort
them if necessary. nghttpx and nghttpd do the sorting of the headers
in stable way if names are equal.
2013-11-13 23:56:02 +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 b405b4bc9f src: Fix token68 decoding 2013-11-09 16:18:01 +09:00
Tatsuhiro Tsujikawa 2ae788eddd Replace nghttp2_set_option with nghttp2_session_{client,server}_new2
nghttp2_session_client_new2 and nghttp2_session_server_new2 take
additional parameters which specifies session options.
nghttp2_set_option is somewhat crumsy because of type checking.
Now we use nghttp2_opt_set, which specifies individual options with
types. We changed the value of nghttp2_opt, so this change will
require re-compile.
2013-11-08 00:12:39 +09:00
Tatsuhiro Tsujikawa e684b8149b nghttpd: Fix -c option 2013-11-06 23:32:32 +09:00
Tatsuhiro Tsujikawa be5d08647e nghttpd: Add -c, --header-table-size option 2013-11-05 23:44:20 +09:00
Tatsuhiro Tsujikawa b1905c5815 nghttpx: More replacement of spdy with http2 2013-11-04 18:22:29 +09:00
Tatsuhiro Tsujikawa 0fcd14300a nghttpx: Rename PROTO_SPDY with PROTO_HTTP2 for backend protocol name 2013-11-04 18:15:56 +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 a483105e11 nghttpx: Set read/write timeout for HTTP/2 backend as well 2013-11-04 17:22:52 +09:00
Tatsuhiro Tsujikawa 69967aeef8 nghttpx: Add --client-private-key-file and --client-cert-file options 2013-11-02 23:34:25 +09:00
Tatsuhiro Tsujikawa 5bb7066474 nghttpx: Add --verify-client-cacert option
Using --cacert to load certificate for client certificate authentication
is problematic since, --cacert is also used for client mode.
This commit adds --verify-client-cacert option which specify the CA
certficate file used only for client certificate validation.
This change also removes the default certficate load function for
client certificate validation.
2013-11-02 21:41:05 +09:00
Tatsuhiro Tsujikawa 41208950ec nghttpx: Disable push in HTTP/2 backend 2013-11-02 16:59:59 +09:00
Tatsuhiro Tsujikawa 02acfd7d70 nghttpx: Add --verify-client option
This option requires client certificate and successful verification.
Use --cacert option to add CA certificates as necessary.
2013-11-02 01:10:18 +09:00
Tatsuhiro Tsujikawa 1835bda02e nghttp, nghttpd: Add --color option to force colored log output 2013-11-01 23:06:53 +09:00