Commit Graph

2305 Commits

Author SHA1 Message Date
Tatsuhiro Tsujikawa 225b90eefd Use switch-case instead of if 2014-10-10 22:52:47 +09:00
Tatsuhiro Tsujikawa 3931a0b04d Fix bugs found by coverity scan 2014-10-10 22:50:35 +09:00
Tatsuhiro Tsujikawa bcbb2e8649 src: Use fcntl and FD_CLOEXEC if O_CLOEXEC is undefined
We may run into race condition if execve is called at the same time
when fcntl is called.  But we just does this for now to compile
nghttp2 applications under older kernel.
2014-10-08 23:44:38 +09:00
Tatsuhiro Tsujikawa a225bb29df nghttpx: Fix request is sent to backend prematurely with http2 upstream 2014-10-07 00:31:35 +09:00
Tatsuhiro Tsujikawa 7a09feebc3 h2load: Don't use std::future with --disable-threads
Now we don't use std::future with --disable-threads, checking
std::future in configure.ac was removed and building h2load is always
enabled.
2014-10-05 14:25:15 +09:00
Svante Signell df875db989 Avoid PATH_MAX by using getcwd(nullptr, 0) as supported by modern glibc-based OSes. 2014-10-03 21:58:15 +09:00
Tatsuhiro Tsujikawa 4f0d03b4b9 libnghttp2_asio: Move common types and functions to nghttp2::asio_http2 ns 2014-09-28 16:54:00 +09:00
Tatsuhiro Tsujikawa 88d7abcc23 libnghttp2_asio: Add request::run_task to execute task in separate thread 2014-09-28 16:25:45 +09:00
Tatsuhiro Tsujikawa e20d2ba9c1 nghttpx: Don't send x-forwarded-proto if -s or -p is used 2014-09-25 00:41:38 +09:00
Tatsuhiro Tsujikawa c1be28684a libnghttp2_asio: Add request::closed() to indicate that stream has been closed 2014-09-25 00:15:52 +09:00
Tatsuhiro Tsujikawa fd07f5e142 src: Add utility APIs to asio_http2.h; add asio-sv2 example to serve files 2014-09-24 23:05:13 +09:00
Tatsuhiro Tsujikawa 3651467c71 src: Silence compiler warning 2014-09-24 00:57:43 +09:00
Tatsuhiro Tsujikawa 5d0bf4cc84 Add C++ library libnghttp2_asio on top of libnghttp2
The libnghttp2_asio library is C++ library built on top of libnghttp2.
Currently, it has server API and easily create HTTP/2 server using
node.js like API calls.  See the example server source code in
examples/asio-sv.cc.  The library depends on Boost::ASIO library.
2014-09-24 00:45:40 +09:00
Tatsuhiro Tsujikawa 446f8f13aa src: Move libevent related helper functions to libevent_util 2014-09-24 00:45:40 +09:00
Tatsuhiro Tsujikawa a9b74261b6 nghttpd: Rewrite using bufferevent (again) for simplicity 2014-09-19 00:58:32 +09:00
Tatsuhiro Tsujikawa 83309b6391 nghttpx: Reduce epoll_ctl call 2014-09-18 23:56:01 +09:00
Tatsuhiro Tsujikawa 23dd428d65 nghttpx: Reset timeouts when either read or write succeeds
See previous commit message why we need this.
2014-09-18 23:19:28 +09:00
Tatsuhiro Tsujikawa b305495a75 nghttpx: Reset both timeouts when either read or write succeeds
Previously read and write timeouts work independently.  When we are
writing response to the client, read timeout still ticks (e.g., HTTP/2
or tunneled HTTPS connection).  So read timeout may occur during long
download.  This commit fixes this issue.  This commit only fixes the
upstream part.  We need similar fix for the downstream.
2014-09-18 23:03:36 +09:00
Tatsuhiro Tsujikawa 44ac571037 nghttpx: Add more handling situation where response ends before request 2014-09-17 22:53:29 +09:00
Tatsuhiro Tsujikawa 5bff48a15a nghttpx: Call upstream resume_read after sending pending request to backend
With the combination of HTTP/1 upstream and HTTP/2 downstream,
downstream tells SHRPX_NO_BUFFER while connecting to the backend
server.  Previously, we did not call upstream resume_read and upload
was blocked.  This commit now calls upstream resume_read to unblock.
This commit also remove pending output buffer size of Http2Session
when calculating downstream connection's buffer is full.  This is
desirable since we only operate resume_read by stream basis.
2014-09-17 22:36:42 +09:00
Tatsuhiro Tsujikawa e4751a798a Replace auto_delete* with defer 2014-09-16 23:39:38 +09:00
Tatsuhiro Tsujikawa d00d4d647d Compile with android NDK r10b 32bit target
Android does not have _Exit.  We detect this and use _exit instead.
clang-3.4 has an issue around undefined reference to
__atomic_fetch_add_4, so we stick to gcc-4.8 for now.
2014-09-14 21:32:53 +09:00
Tatsuhiro Tsujikawa 901de5fbce Add nghttp2_option_set_recv_client_preface()
By default, nghttp2 library only handles HTTP/2 frames and does not
recognize first 24 bytes of client connection preface. This design
choice is done due to the fact that server may want to detect the
application protocol based on first few bytes on clear text
communication. But for simple servers which only speak HTTP/2, it is
easier for developers if nghttp2 library takes care of client
connection preface.

If this option is used with nonzero val, nghttp2 library checks first
24 bytes client connection preface. If it is not a valid one,
nghttp2_session_recv() and nghttp2_session_mem_recv() will return
error NGHTTP2_ERR_BAD_PREFACE, which is fatal error.
2014-09-13 19:50:44 +09:00
Tatsuhiro Tsujikawa 85f605f20d src: Check availability of ENONET 2014-09-02 01:00:27 +09:00
Tatsuhiro Tsujikawa d8c0d87c90 src: Add missing SETTINGS ID to debug output
SETTINGS_MAX_FRAME_SIZE and SETTINGS_MAX_HEADER_LIST_SIZE are 2
missing SETTINGS IDs and now they are shown correctly.
2014-08-29 00:14:10 +09:00
Tatsuhiro Tsujikawa 8890e593e6 src: Add util::array_size 2014-08-28 00:45:12 +09:00
Tatsuhiro Tsujikawa f8471a5f45 nghttpx: Move --backend-http-proxy-uri to Connections section 2014-08-27 23:37:54 +09:00
Tatsuhiro Tsujikawa f34cbf9b45 tests: Include config.h 2014-08-27 23:36:57 +09:00
Tatsuhiro Tsujikawa a23a705121 nghttpx: Strict integer config validation 2014-08-27 23:36:36 +09:00
Tatsuhiro Tsujikawa 822ec75814 nghttpx: Add --listener-disable-timeout option 2014-08-27 22:34:00 +09:00
Tatsuhiro Tsujikawa 0209b7c083 nghttpx: Fix location rewrite is failed because request headers are empty
Previously we empties request headers after they are sent to
downstream in order to free memory.  But it turns out that we use
request headers when rewriting location header response field.  Also
user reported that request headers are useful to add new features.
This commits defers the deletion of request headers to the point when
response headers are deleted (which is after response headers are sent
to upstream client).
2014-08-27 21:25:25 +09:00
Tatsuhiro Tsujikawa 223242b512 nghttpx: Don't consume response data in downstream on_stream_close_callback
Even after on_stream_close_callback, Http2DownstreamConnection is
still alive and upstream keeps sending response to the client.  The
consumed bytes are processed normally (data_source_read_callback) and
also we have a code to consume all allocated bytes for
Http2DownstreamConnection object when it is deleted.  This means that
we don't need to and should not consume response data in downstream
on_stream_close_callback.  If we do, we may get assertion error in
Http2DownstreamConnection::resume_read().
2014-08-26 22:16:19 +09:00
Tatsuhiro Tsujikawa 82bc7198e6 Change nghttp2_session_get_stream_remote_window_size behavior
Now it returns only stream's available remote window size, without
considering connection level window size.  For connection-level window
size, nghttp2_session_get_remote_window_size() is added by this
commit.  To get old behavior of
nghttp2_session_get_stream_remote_window_size() is use
min(nghttp2_session_get_stream_remote_window_size(),
nghttp2_session_get_remote_window_size()).  The reason of this change
is that it is desirable to know just stream level window size without
taking into connection level window size.  This is useful for
debugging purpose.
2014-08-25 21:44:22 +09:00
Tatsuhiro Tsujikawa 53ee21caa9 Remove nghttp2_on_unknown_frame_recv_callback
It is not used by library for a while.  It could be used to pass
unsupported extension frames to application, but its interface
requires library to buffer entire frame, which we'd like to avoid.
For unsupported extension frames, we will add new callbacks which does
not require buffering if they are required.
2014-08-25 21:24:04 +09:00
Tatsuhiro Tsujikawa 31528b6267 Use uint32_t for HTTP/2 error_code
h2-14 now allows extensions to define new error codes.  To allow
application callback to access such error codes, we uses uint32_t as
error_code type for structs and function parameters.  Previously we
treated unknown error code as INTERNAL_ERROR, but this change removes
this and unknown error code is passed to application callback as is.
2014-08-25 21:24:04 +09:00
Tatsuhiro Tsujikawa ab5b81bee1 Hide nghttp2_session_callbacks details and provide setter like functions
To make it possible to add new callbacks without bumping so name, we
decided to hide details of nghttp2_session_callbacks.  We provide
setter like functions to set individual callback function.
2014-08-25 21:24:04 +09:00
Tatsuhiro Tsujikawa 1673ae2c99 src: Add 308 Permanent Redirect (RFC 7238) 2014-08-24 22:56:48 +09:00
Tatsuhiro Tsujikawa d5da7611fa nghttpx: Remove unused member function and variable 2014-08-24 22:27:10 +09:00
Tatsuhiro Tsujikawa 9ad2c0887e nghttpx: Use _Exit() instead of exit() when execve is failed in child process 2014-08-23 18:15:47 +09:00
Tatsuhiro Tsujikawa d5dcbf6f3b nghttpx: Fix possible flow control issue
Previously we only update consumed flow control window when number of
bytes read in nghttp2 and spdylay callback is 0.  Now we notify
nghttp2 library the consumed bytes even if number of bytes read > 0.
This change also uses newly added spdylay_session_consume() API, so we
require spdylay >= 1.3.0.
2014-08-21 21:22:16 +09:00
Tatsuhiro Tsujikawa 69b9ce6b68 nghttpx: Fix possible deadlock due to exhaustion of send window 2014-08-20 01:39:07 +09:00
Tatsuhiro Tsujikawa c81e87bf37 nghttpx: Fix dereference after null check 2014-08-20 00:17:50 +09:00
Tatsuhiro Tsujikawa 97533c966d nghttpx: Fix gcc compiler warning 2014-08-20 00:09:18 +09:00
Tatsuhiro Tsujikawa d6b495f2a7 nghttpx: Returns 503 if downstream connect fail for https upstream 2014-08-19 23:41:53 +09:00
Tatsuhiro Tsujikawa c7e9fe8154 nghttpx: Implement connection blocker for HTTP/1 backend 2014-08-19 23:36:04 +09:00
Tatsuhiro Tsujikawa fb62a5ed4f nghttpx: Use pointer for worker_config 2014-08-19 22:29:44 +09:00
Tatsuhiro Tsujikawa 345121975a nghttpx: Handle socket creation error 2014-08-19 22:29:44 +09:00
Tatsuhiro Tsujikawa a5dfe24e49 nghttpx: Use std::unique_ptr for DownstreamConnection 2014-08-19 00:20:57 +09:00
Tatsuhiro Tsujikawa 273d9f4f7d nghttpx: Use std::unique_ptr for Downstream object 2014-08-19 00:20:56 +09:00
Tatsuhiro Tsujikawa 500c5eea56 nghttpx: Rename Http2Upstream::add_downstream as add_pending_downstream 2014-08-18 21:38:03 +09:00
Tatsuhiro Tsujikawa 83a39f5b49 nghttpx: Fix stream handling of upgraded request 2014-08-18 21:36:55 +09:00
Tatsuhiro Tsujikawa 2fb675f13c nghttpx: Open default log files for errors occurred while parsing options 2014-08-17 22:37:30 +09:00
Tatsuhiro Tsujikawa eebd1f5492 nghttpx: Add some more info about prohibition of --read-burst=0 2014-08-17 22:31:44 +09:00
Tatsuhiro Tsujikawa 86dd1519b4 nghttpx: Android specific hack for special files for logging
Android lacks /dev/stderr, so directly use /proc/self/fd/2 as default
errorlog-file.  Android does not like O_APPEND for /proc/self/fd/1 and
/proc/self/fd/2, so omit the flag for these paths.
2014-08-17 19:01:51 +09:00
Tatsuhiro Tsujikawa a507fc80b6 Isolate std::future when NOTHREADS is defined and build without SOCK_{NONBLOCK, CLOEXEC} 2014-08-17 18:50:10 +09:00
Tatsuhiro Tsujikawa 49a9ec2cb3 nghttpx: Use int for resonse_rst_stream_error_code_ 2014-08-17 16:36:02 +09:00
Tatsuhiro Tsujikawa 5d2390deba nghttpx: Bring per-connection rate limit back
--read-burst=0 still does not work.  But specifying n > 0 workarounds
this.
2014-08-17 16:17:10 +09:00
Tatsuhiro Tsujikawa 3c056973a1 nghttpx: Ignore SIGCHLD not to create zombie on SIGUSR2 if -D is used 2014-08-17 00:05:24 +09:00
Tatsuhiro Tsujikawa 0e8419ac37 nghttpx: Add backend-connections-per-frontend option
This option limits the number of backend connections per frontend.
This is meaningful for the combination of HTTP/2 and SPDY frontend and
HTTP/1 backend.
2014-08-16 22:24:17 +09:00
Tatsuhiro Tsujikawa da08ba5d50 nghttpx: Reset upstream timer on upgrade 2014-08-15 10:29:46 +09:00
Tatsuhiro Tsujikawa 30fa6d24d0 nghttpx: Rewirte server header field if configured as reverse proxy 2014-08-14 22:45:21 +09:00
Tatsuhiro Tsujikawa f776c50d43 nghttpx: Just record error code when RST_STREAM is received
libnghttp2 will call on_stream_close callback when RST_STREAM is
received.  So we can use on_stream_close callback to handle existing
stream, instead of on_frame_recv callback.
2014-08-14 12:48:30 +09:00
Tatsuhiro Tsujikawa 7b85f6c50d nghttpx: Store errno to a variable temporarly 2014-08-13 22:13:08 +09:00
Tatsuhiro Tsujikawa 21cbf417c8 nghttpx: Use SOCK_NONBLOCK and SOCK_CLOEXEC flag in socketpair to avoid race 2014-08-13 22:09:35 +09:00
Tatsuhiro Tsujikawa ca680c16e3 nghttpx: Chown file to effective user 2014-08-13 01:53:44 +09:00
Tatsuhiro Tsujikawa bf13d91264 nghttpx: Add hot deploy feature
nghttpx supports hot deploy feature using signals.  The host deploy in
nghttpx is multi step process.  First send USR2 signal to nghttpx
process.  It will do fork and execute new executable, using same
command-line arguments and environment variables.  At this point, both
current and new processes can accept requests.  To gracefully shutdown
current process, send QUIT signal to current nghttpx process.  When
all existing frontend connections are done, the current process will
exit.  At this point, only new nghttpx process exists and serves
incoming requests.
2014-08-13 00:43:54 +09:00
Tatsuhiro Tsujikawa 8aa6580d89 nghttpx: Chown log files with --user 2014-08-10 20:58:02 +09:00
Tatsuhiro Tsujikawa 58afce2382 nghttp: Verbose output for received DATA chunk with current received window 2014-08-10 17:18:28 +09:00
Tatsuhiro Tsujikawa 24cfb52b5a nghttpx: Add --no-location-rewrite option
--no-location-rewrite option disallows location header rewrite on
--http2-bridge, --client and default mode.  This option is useful when
connecting nghttpx proxy with --http2-bridge to backend nghttpx with
http2-proxy mode.
2014-08-10 12:39:27 +09:00
Tatsuhiro Tsujikawa 93ed89df5f nghttpx: Make stream timeout disable by default
It might be useful to clean the unused stream out to make up the room
for new streams.  On the other hand, proxy should maintain the
connection between upstream client and downstream server and they have
the timeout for their own.  Proxy just reacts to their decision.
2014-08-10 00:08:44 +09:00
Tatsuhiro Tsujikawa 1a2e50ca08 nghttpx: Lower timeouts 2014-08-09 22:59:31 +09:00
Tatsuhiro Tsujikawa 76703f79fa nghttpx: Add stream level timeout for HTTP/2 and SPDY upstream/downstream 2014-08-09 22:56:27 +09:00
Tatsuhiro Tsujikawa 4c3aa081a0 nghttp: Improve error logging a bit 2014-08-09 00:03:33 +09:00
Tatsuhiro Tsujikawa 88add854ff nghttpx: Treat malformed request as PROTOCOL_ERROR 2014-08-08 23:11:58 +09:00
Tatsuhiro Tsujikawa 704bbbfcaa nghttpx: Fail if :status is not digits on http2 downstream 2014-08-08 23:08:24 +09:00
Tatsuhiro Tsujikawa e217e789de nghttp: Support non-final response and check pseudo headers 2014-08-08 23:03:12 +09:00
Tatsuhiro Tsujikawa d4d56e1846 nghttpd, nghttpx: Check that pseudo headers come before normal headers 2014-08-08 20:52:32 +09:00
Tatsuhiro Tsujikawa d496c42dc9 Revert "nghttpx, nghttpd: Check pseudo header fields come before normal header fields"
This reverts commit cc24b9aaf0.
2014-08-08 20:17:03 +09:00
Tatsuhiro Tsujikawa 76b3ba2832 nghttp: Sort request header fields using http2::name_less 2014-08-08 00:27:04 +09:00
Tatsuhiro Tsujikawa 05f982dcfb src: Sort header fields so that pseudo headers come first 2014-08-07 23:27:13 +09:00
Tatsuhiro Tsujikawa cc24b9aaf0 nghttpx, nghttpd: Check pseudo header fields come before normal header fields 2014-08-07 22:49:34 +09:00
Tatsuhiro Tsujikawa e6695d9ba7 nghttp: Check HTTP header field characters 2014-08-07 22:01:00 +09:00
Tatsuhiro Tsujikawa 9fb2bc8468 src: Remove http2::sort_nva
This function is no longer necessary because 0x00 concatenation rule
is gone.
2014-08-07 21:55:30 +09:00
Tatsuhiro Tsujikawa 3f212a60a5 nghttpx: Fix android build error 2014-08-06 00:23:46 +09:00
Tatsuhiro Tsujikawa 5c61917007 src: Move jemalloc front so that it is surely linked 2014-08-05 22:27:54 +09:00
Tatsuhiro Tsujikawa 455d911f61 src, examples: Call OPENSSL_config() 2014-08-02 10:11:45 +09:00
Tatsuhiro Tsujikawa 7c781bcd1a nghttpx: Issue RST_STREAM instead of returning NGHTTP2_ERR_TEMPORAL_CALLBACKFAILURE
NGHTTP2_ERR_TEMPORAL_CALLBACKFAILURE is not supported in
on_frame_recv_callback.
2014-08-02 00:26:43 +09:00
Tatsuhiro Tsujikawa 2e083352d5 nghttpx: Fix crash on http2 downstream disconnect 2014-07-31 23:34:33 +09:00
Tatsuhiro Tsujikawa 6e027ad830 nghttpd, nghttpx: Check allowed pseudo headers 2014-07-31 23:05:53 +09:00
Tatsuhiro Tsujikawa 9d78167297 nghttpx: Treat unexpected HEADERS as stream error 2014-07-31 23:05:53 +09:00
Tatsuhiro Tsujikawa b8a2bf2675 Remove END_SEGMENT flag 2014-07-31 23:05:53 +09:00
Tatsuhiro Tsujikawa 04b5d1679f nghttpx: Log non-final response headers 2014-07-31 23:05:53 +09:00
Tatsuhiro Tsujikawa 15055c11f9 nghttpx: Support server-wide OPTIONS in http/1 upstream 2014-07-31 23:05:53 +09:00
Tatsuhiro Tsujikawa c859fb8f7c nghttpx: Don't respond DATA frame for HEAD request or 204, 304, 1xx 2014-07-31 23:05:53 +09:00
Tatsuhiro Tsujikawa 079db14d45 Add nghttp2_session_consume() API
Reworked no automatic WINDOW_UPDATE feature.  We added new API
nghttp2_session_consume() which tells the library how many bytes are
consumed by the application.  Instead of submitting WINDOW_UPDATE by
the application, the library is now responsible to submit
WINDOW_UPDATE based on consumed bytes.  This is more reliable method,
since it enables us to properly send WINDOW_UPDATE for stream and
connection individually.  The previous implementation of nghttpx had
broken connection window management.
2014-07-31 23:05:53 +09:00
Tatsuhiro Tsujikawa 9f17bee51d Fix unittest failure 2014-07-31 23:05:53 +09:00
Tatsuhiro Tsujikawa 4f815521ae nghttpx, nghttpd: Support non-final response 2014-07-31 23:05:52 +09:00
Tatsuhiro Tsujikawa af5fd2019d src: Remove 0x00 concatenation for headers
Now concatenating header values with 0x00 as delimiter is not
necessary because HPACK reference set is removed and the order of
header field fed into HPACK encoder is preserved when they are
decoded.
2014-07-31 23:05:52 +09:00
Tatsuhiro Tsujikawa 38bfbffb1b Remove HPACK reference set 2014-07-31 23:05:52 +09:00
Tatsuhiro Tsujikawa 8dc47c6750 Fix resource leaks 2014-07-18 00:31:32 +09:00
Tatsuhiro Tsujikawa 61053653df src: Retry write(2) if errno == EINTR 2014-07-17 23:41:54 +09:00
Tatsuhiro Tsujikawa bb47484667 nghttpx: Log transmission and reception of GOAWAY 2014-07-12 23:30:13 +09:00
Tatsuhiro Tsujikawa c4d2639ed8 nghttpd: Don't shutdown session if pending data is left 2014-07-12 23:17:25 +09:00
Tatsuhiro Tsujikawa 25e18174dd src: Add additional HTTP status codes defined in RFC 6585 2014-07-08 22:41:17 +09:00
Tatsuhiro Tsujikawa a072d719b3 nghttpx: Use 431 instead of 413 2014-07-08 22:37:48 +09:00
Tatsuhiro Tsujikawa 0d1ebd73de nghttpx: Only use thread_local if NOTHREADS is not defined 2014-07-08 21:28:11 +09:00
Tatsuhiro Tsujikawa d3ca003346 Update android-config and fix build warning with android NDK 2014-07-06 23:32:08 +09:00
Tatsuhiro Tsujikawa 9cbedb16d0 nghttpx: Log filename and line number after severity in one line 2014-07-06 19:26:12 +09:00
Tatsuhiro Tsujikawa 9f1c819242 nghttpx: Cleanup create_evlistener 2014-07-06 19:21:18 +09:00
Tatsuhiro Tsujikawa a02624c9ed nghttpx: Use std::shared_ptr to share cached time
To ensure that cached time buffer is not altered while referencing it,
we rely on inerlocking in std::shared_ptr to acheive this.
2014-07-06 13:27:51 +09:00
Tatsuhiro Tsujikawa 933e24d412 nghttpx: Use std::atomic for Config::cached_time 2014-07-05 23:50:32 +09:00
Tatsuhiro Tsujikawa fe2843f9d6 nghttpx: Include pid in errorlog 2014-07-05 22:53:17 +09:00
Tatsuhiro Tsujikawa afdc61a253 nghttpx: Remove S_IROTH when creating log file 2014-07-05 22:41:53 +09:00
Tatsuhiro Tsujikawa 367e764ca3 nghttpx: Log user-agent as "-" if it is empty 2014-07-05 19:48:14 +09:00
Tatsuhiro Tsujikawa 9841f778a9 nghttpx: Do not compile pthread_sigmask if NOTHREADS is defined 2014-07-05 19:43:39 +09:00
Tatsuhiro Tsujikawa bf4042ce98 nghttpx: Cache time for logging 2014-07-05 19:40:30 +09:00
Tatsuhiro Tsujikawa 2e6d5e9bd0 nghttpx: Use %lld instead of PRId64 2014-07-05 18:51:55 +09:00
Tatsuhiro Tsujikawa 0ce848a611 nghttpx: Rewrite logging system
This change rewrites logging system of nghttpx.  Previously access log
and error log are written to stderr or syslog and there was no option
to change stderr to something else.  With this change, file path of
access log and error log can be configured separately and logging to
regular file is now added.  To support rotating log, if SIGUSR1 signal
is received by nghttpx, it closes the current log files and reopen it
with the same name.  The format of access log is changed and has same
look of apache's.  But not all columns are not supported yet.
2014-07-05 18:43:24 +09:00
Tatsuhiro Tsujikawa 57230b4029 nghttpx: Fix regression POST http2 downstream does not work 2014-07-04 02:03:09 +09:00
Tatsuhiro Tsujikawa 3111138ca3 nghttpx: Don't add transfer-encoding to CONNECT request 2014-07-03 23:44:20 +09:00
Tatsuhiro Tsujikawa 0f4d01c25c nghttpx: Pass through NGHTTP2_NO_ERROR from downstream to upstream 2014-07-03 23:00:19 +09:00
Tatsuhiro Tsujikawa f8b872096e nghttpx: Use NGHTTP2_NO_ERROR to close upgraded (tunneled) stream 2014-07-03 22:59:49 +09:00
Tatsuhiro Tsujikawa e18c439a73 nghttp: Add --no-content-length option 2014-07-03 22:48:43 +09:00
Tatsuhiro Tsujikawa 545732fed8 nghttpd: Add --early-response option
This option is testing the client behavior when it gets response
before sending all request.
2014-07-03 22:44:27 +09:00
Tatsuhiro Tsujikawa 4b6f124b7e Add API to check half-closed state for both direction of stream 2014-07-03 21:44:29 +09:00
Tatsuhiro Tsujikawa 119fb05cc2 nghttpx: Call on_response_headers for response header only in http2 downstream 2014-07-03 21:18:01 +09:00
Tatsuhiro Tsujikawa e08df2840c nghttpx: Disallow 2nd message in http downstream 2014-07-03 20:57:07 +09:00
Tatsuhiro Tsujikawa 1ce00f455c nghttpx: Remove requirement of content-length for HTTP2 upstream POST 2014-07-03 19:59:10 +09:00
Tatsuhiro Tsujikawa 9cddb05f54 nghttpx: Use error_reply instead of RST_STREAM for http2 upstream request 2014-07-03 00:12:16 +09:00
Tatsuhiro Tsujikawa 93b3a44fb5 nghttpx: Add ability to Http2Upstream to send RST_STREAM after END_STREAM 2014-07-02 23:56:26 +09:00
Tatsuhiro Tsujikawa acb3d4dcfc nghttpx: Handle connection flow control for DATA not sent to frontend 2014-07-02 23:24:59 +09:00
Tatsuhiro Tsujikawa 797edae4d4 nghttpx: Handle connection flow control for DATA not sent to backend 2014-07-02 23:24:58 +09:00
Tatsuhiro Tsujikawa 4e81a34146 nghttpd: Add --dh-param-file option to support DHE ciphers 2014-06-28 15:43:06 +09:00
Tatsuhiro Tsujikawa 9fec34968b nghttpd: Disable SSL_CTX_set_ecdh_auto for OpenSSL >= 1.0.2 2014-06-28 15:35:10 +09:00
Tatsuhiro Tsujikawa a3334bb21c nghttpd: Use cipher suites recommended by Mozilla 2014-06-28 15:28:19 +09:00
Tatsuhiro Tsujikawa c1be7c734f src: Update status code according to RFC 7231 2014-06-27 23:02:12 +09:00
Tatsuhiro Tsujikawa 303f0f3fcd nghttpx: Return 413 if request header is too large
For now, if request has request body, we'll issue RST_STREAM to inform
the peer to stop sending body.  RST_STREAM may be sent before error
page header or data, so peer may receive RST_STREAM only.
2014-06-27 22:54:33 +09:00
Tatsuhiro Tsujikawa ca87b45fe4 nghttpx: Don't fail backend connection if one of backend request fails 2014-06-27 22:34:54 +09:00
Tatsuhiro Tsujikawa 31d99b3664 nghttp: Adjust header size for CONTINUATION test 2014-06-27 21:16:36 +09:00
Tatsuhiro Tsujikawa 3312df42d2 nghttpx: Use std::unique_ptr for ListenHandler::http2session_ 2014-06-27 00:39:53 +09:00
Tatsuhiro Tsujikawa 68cd12ac29 nghttpx: Use std::vector instead of raw array 2014-06-27 00:26:21 +09:00
Tatsuhiro Tsujikawa 52ff158f34 h2load: Fix failed stream count is added multiple times
The number of failed stream is counted multiple times if several
connection attempts are made.
2014-06-26 23:20:12 +09:00
Tatsuhiro Tsujikawa 479e15469c nghttpx: Add worker-frontend-connections option 2014-06-26 22:55:22 +09:00
Tatsuhiro Tsujikawa ad60a18fb9 Remove BLOCKED frame 2014-06-24 00:22:41 +09:00
Tatsuhiro Tsujikawa 5aba6e6d1b h2load: Set number of request per client explicitly
Previously we do not specify the number of requests each client has to
issue.  The each client corresponds to 1 TCP connection.  If
connection was not accepted by server or not TLS handshake is not
done, we effectively don't use that connection and the requests
supposed to be issued for those connections are done via other
established connections.  If this occurs, servers which do not accept
all connections may gain good benchmark results since they don't have
to pay extra cost to handle all connections (e.g., SSL/TLS handshake).
This change explicitly set the number of requests each client has to
issue so that servers cannot *cheat*.
2014-06-22 15:03:46 +09:00
Tatsuhiro Tsujikawa 1caec7cb16 h2load: Fix memory leak detected by LeakSanitizer 2014-06-20 00:00:06 +09:00
Tatsuhiro Tsujikawa 0cd26d6f3b nghttp: Remove garbage for deprecated per-stream compression which cause leak 2014-06-19 23:35:58 +09:00
Tatsuhiro Tsujikawa 2bfa772472 nghttpx: Update cipher suite list 2014-06-19 23:26:30 +09:00
Tatsuhiro Tsujikawa 133c3d66be nghttpx: Remove TLSv1.0 from default TLS proto list 2014-06-19 23:21:53 +09:00
Tatsuhiro Tsujikawa 266a15ccd3 nghttpx: Remove per-connection rate limit
It looks like setting read-rate and read-burst to 0 makes busy loop.
It seems a bug.  On the other hand, we most likely want per-thread
rate limit rather than per-connection.  So we decided to drop them.
2014-06-19 23:19:14 +09:00
Tatsuhiro Tsujikawa 4ff522764c h2load: Call session->on_write() explicitly in Client::on_connect() 2014-06-19 22:49:38 +09:00
Tatsuhiro Tsujikawa 4ab594b144 nghttpx: Fix connection preface is not read by upstream_http2_connhd_readcb
It seems that if readcb is not set before SSL/TLS handshake, the
incoming data already available when eventcb (BEV_EVENT_CONNECTED
event) is fired is not further notified after setting new readcb.  We
knew this fact and call upstream->on_read() in eventcb, but it is
wrong for HTTP/2.  We have to call upstream_http2_connhd_readcb to
check connection preface.  Otherwise, we consume it by nghttp2 session
and it is treated as unknown frame and connection preface is not
detected properly.
2014-06-19 22:43:54 +09:00
Tatsuhiro Tsujikawa a344a8f566 src: Don't build h2load if std::future is not working 2014-06-18 14:24:45 +09:00
Tatsuhiro Tsujikawa 87360b4f7d nghttpx: Require TLSv.12 for h2 2014-06-18 12:09:30 +09:00
Tatsuhiro Tsujikawa 174e410b93 Use hex in nghttp2_error_code and nghttp2_settings_id 2014-06-18 10:48:31 +09:00
Tatsuhiro Tsujikawa 94b9c3771d nghttpx: Throw away request and response headers when they are done 2014-06-15 17:25:24 +09:00
Tatsuhiro Tsujikawa 041cec2d97 nghttpx: Check error from SSL_set_fd 2014-06-12 23:39:58 +09:00
Tatsuhiro Tsujikawa 25b58d5e22 nghttpx: Code cleanup 2014-06-12 23:37:33 +09:00
Tatsuhiro Tsujikawa 1ee847c21a nghttp: Code cleanup 2014-06-12 22:48:40 +09:00
Tatsuhiro Tsujikawa 1af9a9cee0 nghttpx: Don't stderr log if syslog is used
This change also reverts previous commits and tty is set to false if
syslog is used.
2014-06-12 21:47:00 +09:00
Tatsuhiro Tsujikawa 6a2950aef0 nghttpx: Make tty to false when daemonized 2014-06-12 00:19:46 +09:00
Tatsuhiro Tsujikawa 9b174bf5c9 Fix compile error with -Wshorten-64-to-32
The original patch was contributed by Alexis La Goutte
2014-06-11 23:37:16 +09:00
Tatsuhiro Tsujikawa 21c4931197 nghttpx: Get rid of openssl filter
Libevent Openssl filter is very inconvenient in various respect.  The
most annoying thing is it somehow emits data when SSL_shutdown is
called.  The reason we introduced this filter solution is drop
connection if TLS renegotiation is detected.  This commit implements
renegotiation detection and drop connection without filtering.
2014-06-11 01:16:49 +09:00
Tatsuhiro Tsujikawa 24762db8f5 nghttpx: Drop connection if HTTP/2 security level is not satisfied on backend 2014-06-11 00:19:54 +09:00
Tatsuhiro Tsujikawa 492b42e6e9 nghttpx: Drop connection if HTTP/2 security level is not satisfied on frontend 2014-06-11 00:07:51 +09:00
Tatsuhiro Tsujikawa d6b5824c9c nghttpx: Don't check TLS requirement in ALPN cb cause cipher obj is nullptr
Also don't compare ALPN identifier with streq, since they are just
byte string.
2014-06-10 23:22:52 +09:00
Tatsuhiro Tsujikawa c204861dec nghttpx: Create NPN prefs only once 2014-06-10 23:22:23 +09:00
Tatsuhiro Tsujikawa 7b0ed5d9bd nghttpx: Only allow DHE, ECDHE + AEAD ciphers for HTTP/2
Cipher suites are chosen by DHE and ECDHE ciphers + GCM (AEAD).  Now
default cipher list is the one recommended by Mozilla web site.  The
--honor-cipher-order option is removed and now it is always assumed.
2014-06-10 22:47:22 +09:00
Tatsuhiro Tsujikawa 5f5b5378c9 Merge branch 'master' into h2-13
Conflicts:
	lib/nghttp2_session.c
2014-06-10 21:38:26 +09:00
Tatsuhiro Tsujikawa dacc9b2f1c Separate extension frames from core frames
ALTSVC and BLOCKED frames are now extension frames.  To add new
extension frame without modifying nghttp2_frame union, which causes so
name bump, we separated extension frames from core frames.
nghttp2_frame includes generic nghttp2_extension.  The payload member
of nghttp2_extension will point to the structure of extension frame
payload.  The frame types of extension frames are defined in
nghttp2_ext_frame_type.
2014-06-09 23:16:54 +09:00
Tatsuhiro Tsujikawa de14c02227 nghttpx: Code cleanup 2014-06-08 23:09:44 +09:00
Tatsuhiro Tsujikawa e665123ebe nghttpx: Use nullptr instead of NULL 2014-06-08 23:09:44 +09:00
Tatsuhiro Tsujikawa db8af31e2b nghttpx: Code cleanup 2014-06-08 23:09:44 +09:00
Tatsuhiro Tsujikawa 0fd5b2aa32 nghttpx: Use std::vector for tls_proto_list and npn_list
Now SSL/TLS option mask to disable particular SSL/TLS protocol
versions are pre-calculated and stored in Config.
2014-06-08 23:09:44 +09:00
Tatsuhiro Tsujikawa 1f58be423d nghttpx: Use nullptr instead of 0 2014-06-08 21:05:36 +09:00
Tatsuhiro Tsujikawa 14b818efc8 nghttpx: Use std::unique_ptr<char[]> instead of char* 2014-06-08 21:02:40 +09:00
Tatsuhiro Tsujikawa c46d3dafc6 Remove PAD_HIGH and Pad High field
CONTINUATION now doesn't have padding.
2014-06-07 18:15:36 +09:00
Tatsuhiro Tsujikawa 3db8935e20 Remove per-frame compression 2014-06-07 16:04:43 +09:00
Tatsuhiro Tsujikawa b8ed74c1ec nghttpx: Disable SSL_CTX_set_ecdh_auto() for now 2014-06-06 23:17:32 +09:00
Tatsuhiro Tsujikawa fcec996925 h2load: Use 1 thread if the number of concurrent client is 1 2014-06-06 23:11:08 +09:00
Tatsuhiro Tsujikawa 7cb28e88e2 h2load: Return Stats rather than Worker from std::future 2014-06-06 23:08:32 +09:00
Tatsuhiro Tsujikawa aea4001d73 deflatehd: Fix crash with -t option 2014-06-05 00:59:22 +09:00
Tatsuhiro Tsujikawa 7e217511bf nghttpx: Code cleanup
Mainly make nested code block to rather flat style.
2014-06-01 23:44:32 +09:00
Tatsuhiro Tsujikawa 8c67bbe3a8 src: Avoid copy in evbuffer_pullup()
Previously, we use evbuffer_pullup(buf, -1) to linearize the memory
region and it may cause buffer copy.  To avoid this, we use the return
value of evbuffer_get_contiguous_space() as 2nd parameter.  According
to the libevent manual, by doing so evbuffer_pullup() will not copy or
modify any data in evbuffer.
2014-06-01 21:01:01 +09:00
Tatsuhiro Tsujikawa cc250386df nghttpx: Lower read watermark 2014-06-01 02:32:26 +09:00
Tatsuhiro Tsujikawa 3b7c733246 nghttpx: Fix typo 2014-06-01 02:32:15 +09:00
Tatsuhiro Tsujikawa 7e5567341f nghttpx: Set timeout to underlying bufferevent
Setting write timeout to filter bufferevent does not work as intended.
It timeouts even when there is no data to write.
2014-06-01 02:25:23 +09:00
Tatsuhiro Tsujikawa 7a797b2c11 nghttpx: Reduce socket I/O buffer size 2014-05-29 22:24:15 +09:00
Tatsuhiro Tsujikawa 86ab9f33de nghttpx: Fix regression bug that frame with stream_id = 0 not handled 2014-05-28 00:26:27 +09:00
Tatsuhiro Tsujikawa d844b0acd0 h2load: Use std::async to dispatch parallel jobs 2014-05-26 23:29:28 +09:00
Tatsuhiro Tsujikawa 1fa5852f8f nghttpx: Treat '*' in <HOST> parameter of --frontend as wildcard explicitly
It seems that specifyig '*' to node parameter in getaddrinfo() is
treated as specifying NULL, but it is not documented.  So rather than
relying on this feature, we explicitly treat '*' as "wildcard" address
and specify NULL to node parameter in getaddrinfo().

Now '*,3000' is a default value of --frontend option.  Specyfing '*'
binds all addresses including both IPv4 and IPv6.
2014-05-25 16:15:48 +09:00
Tatsuhiro Tsujikawa ebf0e4d787 nghttpd, nghttpx: Check END_STREAM flag in HEADERS other than request 2014-05-24 15:02:46 +09:00
Tatsuhiro Tsujikawa 672ad82849 nghttpx: Clarify that --npn-list is used in both ALPN and NPN 2014-05-21 21:28:58 +09:00
Tatsuhiro Tsujikawa 896717f5d4 nghttpx: Make --npn-list option work in ALPN
Previously --npn-list option is ignored in ALPN protocol selection
callback.  This change fixes this issue.
2014-05-21 21:16:44 +09:00
Tatsuhiro Tsujikawa 3f80472e0a nghttpx: Minor tweak to buffer size
Simplified when to send WINDOW_UPDATE to the backend, that is we send
WINDOW_UPDATE when input buffer is empty.
2014-05-16 21:42:30 +09:00
Tatsuhiro Tsujikawa 3b5b5ce254 Update http-parser to 8d9e5db981b623fffc93657abacdc80270cbee58 2014-05-16 00:23:03 +09:00
Tatsuhiro Tsujikawa 694cd07f1d nghttpx: Remove Connection: close header field from CONNECT response
It appears that some Android client does not like Connection: close in
200 CONNECT response.  Browsers fine with this header field.  It is
better to remove it.  Squid does not emit it too.
2014-05-15 23:45:17 +09:00
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
Tatsuhiro Tsujikawa d9f5451810 nghttpx: Add SETTINGS ACK timeout to HTTP/2 backend connections 2013-10-31 21:45:17 +09:00
Tatsuhiro Tsujikawa e0fe939951 nghttpx: Add SETTINGS timeout timer to Http2Upstream 2013-10-31 00:44:23 +09:00
Tatsuhiro Tsujikawa 3ea28863e4 nghttpx: Set "dconn_ is null" log in INFO 2013-10-30 01:26:28 +09:00
Tatsuhiro Tsujikawa dfa1194804 Add new API to return effective recv data/win size for connection
Using this feature, connection level flow control is now enabled
in nghttpx.
2013-10-30 00:51:01 +09:00
Tatsuhiro Tsujikawa b75455dd96 nghttpx: Remove recv data length calculation in HTTP/2 code 2013-10-30 00:10:28 +09:00
Tatsuhiro Tsujikawa 6c23c34d77 Add new API to return effective received data length and local window size 2013-10-30 00:07:35 +09:00
Tatsuhiro Tsujikawa 9b6a0e5875 nghttpx: Fix stream hang with request body
The end of request stream is not detected correct place.
Also Downstream::end_upload_data() is not called.
2013-10-30 00:00:58 +09:00
Tatsuhiro Tsujikawa 0ced4741d2 nghttpx: Remove flow control error detection code
Now flow control error detection is handled by the library
2013-10-29 22:46:38 +09:00
Tatsuhiro Tsujikawa 535329779c nghttp: Add --header-table-size option 2013-10-29 21:34:22 +09:00
Tatsuhiro Tsujikawa dc61f705df nghttp, nghttpd: Add SETTINGS timeout handling
SETTINGS timeout is 10 seconds for now.
2013-10-27 23:02:39 +09:00
Tatsuhiro Tsujikawa 5ace898392 Update error code 2013-10-27 19:31:24 +09:00
Tatsuhiro Tsujikawa a46ccdb144 Apply initiated SETTINGS changes on reception of ACK 2013-10-27 19:22:51 +09:00
Tatsuhiro Tsujikawa 2afa9f75f5 src/HttpServer: Fix compile error 2013-10-27 17:00:41 +09:00
Tatsuhiro Tsujikawa 5ca8f147f2 nghttpx: Code cleanup 2013-10-27 16:25:50 +09:00
Tatsuhiro Tsujikawa 67553d47e0 nghttpx: Use :authority and host instead of :host 2013-10-27 16:25:50 +09:00
Tatsuhiro Tsujikawa c4ae19e2a0 nghttp, nghttpd: Use :authority and host instead of :host 2013-10-27 16:25:50 +09:00
Tatsuhiro Tsujikawa 8f8c841df0 Merge branch 'master' into hpack-exp 2013-10-25 22:51:51 +09:00
Tatsuhiro Tsujikawa 896db5b24f API change: Add flags parameter to all submit_* functions
The nghttp2_submit_{request,response} family do not get this change.
2013-10-25 22:50:24 +09:00
Tatsuhiro Tsujikawa b193069110 Merge branch 'master' into hpack-exp 2013-10-23 23:23:51 +09:00
Tatsuhiro Tsujikawa 8c855c5567 src: Use std::vector to store name/value pairs 2013-10-23 23:18:24 +09:00
Tatsuhiro Tsujikawa 5add90489f Protocol ID change for HPACK experiment 2013-10-16 01:19:06 +09:00
Tatsuhiro Tsujikawa e85418f045 Fix local window size adjustments
Now shrinking local window size properly limits the amount of
WINDOW_UPDATE value so that shrinked window is honored.
2013-10-12 17:02:37 +09:00
Tatsuhiro Tsujikawa 2e7edf88bc nghttp: Add -W option to specify connection level window size bits 2013-10-10 22:04:37 +09:00
Tatsuhiro Tsujikawa 154a0014ef nghttp: Fix typo in help message 2013-10-10 21:25:53 +09:00
Tatsuhiro Tsujikawa 6249038cc0 src: Print headers in PUSH_PROMISE 2013-10-10 21:24:54 +09:00
Tatsuhiro Tsujikawa f355187176 nghttpx: Fix missing extension HTTP status code in response 2013-10-02 23:29:44 +09:00
Tatsuhiro Tsujikawa c7ce6d811e src/shrpx_config.cc: Code cleanup 2013-10-02 23:13:25 +09:00
Tatsuhiro Tsujikawa d90e0d4262 src/HtmlParser: Code cleanup 2013-10-02 23:08:47 +09:00
Tatsuhiro Tsujikawa a9ba00914e nghttpx: Log error_code when submitting RST_STREAM 2013-09-30 00:13:04 +09:00
Tatsuhiro Tsujikawa 8e9f08f81d nghttp: Assign different priority according to the resource type 2013-09-29 18:58:46 +09:00
Tatsuhiro Tsujikawa 31ae1fe660 app_helper.cc: Handle NGHTTP2_COMPRESSION_ERROR in strstatus 2013-09-28 22:57:12 +09:00
Tatsuhiro Tsujikawa bfe7a9af00 nghttp: Fix crash if attrs parameter of get_attr() is nullptr 2013-09-26 22:56:26 +09:00
Tatsuhiro Tsujikawa 55b8a0b777 shrpx_http2_upstream: Use std::unique_ptr for pre_upstream_ 2013-09-26 21:46:35 +09:00
Tatsuhiro Tsujikawa 3368c8b378 nghttpx: Fix wrong version ID in Upgrade response header field 2013-09-26 21:46:03 +09:00
Tatsuhiro Tsujikawa c5912341ad nghttpx: Fix crash on upgrade success 2013-09-26 21:39:19 +09:00
Tatsuhiro Tsujikawa 825c1bac6b shrpx_downstream.cc: Utilize std::move 2013-09-24 23:53:55 +09:00
Tatsuhiro Tsujikawa dc0af2e074 shrpx_https_upstream.cc: Code cleanup 2013-09-24 23:39:36 +09:00
Tatsuhiro Tsujikawa a0326b3f2b nghttpx: Handle error from bufferevent_socket_new and event_base_new 2013-09-24 23:17:53 +09:00
Tatsuhiro Tsujikawa 57f5730756 shrpx_http_downstream_connection.cc: Code cleanup 2013-09-24 21:42:50 +09:00
Tatsuhiro Tsujikawa 2572fb6fb4 shrpx.cc: Code cleanup 2013-09-24 21:34:59 +09:00
Tatsuhiro Tsujikawa 991f14846d shrpx_spdy_session.cc: Code cleanup 2013-09-24 21:34:04 +09:00
Tatsuhiro Tsujikawa e1dfc1cdc5 shrpx_spdy_session: Use std::unique_ptr for proxy_htp_ 2013-09-24 21:31:48 +09:00
Tatsuhiro Tsujikawa 769f560586 shrpx_https_upstream: Embed http_parser 2013-09-24 21:31:48 +09:00
Tatsuhiro Tsujikawa 811173f5c8 shrxp_worker.cc: Use std::unique_ptr for ThreadEventReceiver 2013-09-24 21:31:48 +09:00
Tatsuhiro Tsujikawa b459e42ee5 shrpx_ssl.cc: Use std::unique_ptr for ssl_locks 2013-09-24 21:31:48 +09:00
Tatsuhiro Tsujikawa cdbe6acfce shrpx_http_downstream_connection: Embed http_parser 2013-09-24 21:31:48 +09:00
Tatsuhiro Tsujikawa 3c1cad9272 shrpx_client_handler: Use std::unique_ptr for upstream_ 2013-09-24 21:31:47 +09:00
Tatsuhiro Tsujikawa ab39ae849f nghttpx: Add --npn-list option 2013-09-23 20:55:39 +09:00
Tatsuhiro Tsujikawa e5e1e9b76e shrpx_ssl.cc: Another code cleanup 2013-09-23 18:49:39 +09:00
Tatsuhiro Tsujikawa bd55f9cf2a shrxp_ssl.cc: Code cleanup 2013-09-23 18:40:17 +09:00
Tatsuhiro Tsujikawa 7d333f202a HtmlParser: Collect scripts URI as well 2013-09-19 01:19:35 +09:00
Tatsuhiro Tsujikawa 8dcaa08405 Replace steady_clock with monotonic_clock if steady_clock is not available 2013-09-17 22:48:30 +09:00
Tatsuhiro Tsujikawa 0a649e2499 src: Use std::chrono instead of gettimeofday and clock_gettime 2013-09-16 17:36:24 +09:00
Tatsuhiro Tsujikawa 04457aae62 nghttp: Code cleanup 2013-09-16 16:54:11 +09:00
Tatsuhiro Tsujikawa e2ff41c44c nghttp: Use -M as short option for --peer-max-concurrent-streams 2013-09-16 16:44:13 +09:00
Tatsuhiro Tsujikawa b14a97a273 Update .gitignore 2013-09-14 21:18:08 +09:00
Tatsuhiro Tsujikawa 99ba622fed Add NGHTTP2_OPT_PEER_MAX_CONCURRENT_STREAMS option
And utilize it in nghttp to limit initial max concurrent streams.
2013-09-14 19:41:49 +09:00
Tatsuhiro Tsujikawa c5d7d570e3 nghttpx: Code cleanup 2013-09-13 21:27:29 +09:00
Tatsuhiro Tsujikawa c48a1d7516 nghttpx: Add rate limit options 2013-09-13 21:23:55 +09:00
Tatsuhiro Tsujikawa 0f75997839 nghttpx: Share ev_token_bucket_cfg across ClientHandlers 2013-09-13 00:25:24 +09:00
Tatsuhiro Tsujikawa cbef6fd0c6 nghttpx: Replace \r\n with space when constructing HTTP/1 headers 2013-09-11 23:24:32 +09:00
Tatsuhiro Tsujikawa b7e1701f06 nghttp: Fix nghttp2_pack_settings_payload use 2013-09-09 21:25:46 +09:00
Tatsuhiro Tsujikawa 5cd1d4f0d6 Fix clang warnings 2013-09-08 23:16:08 +09:00
Tatsuhiro Tsujikawa 72802b92c5 src: Fix linker error 2013-09-08 16:29:39 +09:00
Tatsuhiro Tsujikawa cc1cfd97e3 src: Archive nghttpx sources into libnghttpx.a to reuse for tests 2013-09-08 15:52:41 +09:00
Tatsuhiro Tsujikawa 588fd3bda7 src, examples: Update .gitignore 2013-09-08 15:33:17 +09:00
Tatsuhiro Tsujikawa 1a05caf847 src: Use util::utos instead of std::to_string
Some platform (e.g., freebsd) does not define _GLIBCXX_USE_C99
and it hides std::to_string functions.
2013-09-08 14:29:18 +09:00
Tatsuhiro Tsujikawa 10f131c9d8 nghttpx: Guard ecdh use with !OPENSSL_NO_EC 2013-09-07 23:37:17 +09:00
Tatsuhiro Tsujikawa c751a6e935 Fix cosmetic errors 2013-09-07 16:38:21 +09:00
Tatsuhiro Tsujikawa 776cff3dc7 src: Use std::unique_ptr for nv 2013-09-07 01:52:46 +09:00
Tatsuhiro Tsujikawa 56f7debad6 nghttpx: Fix resource leak 2013-09-07 01:46:46 +09:00
Tatsuhiro Tsujikawa 92a6549f78 nghttp: Initialize flag to 0 2013-09-07 01:46:20 +09:00
Tatsuhiro Tsujikawa bb7361cd9b nghttp: Code cleanup 2013-09-06 00:18:43 +09:00
Tatsuhiro Tsujikawa 586533be2f nghttpx: Fix CONNECT fail on SPDY upstream 2013-09-05 23:40:48 +09:00
Tatsuhiro Tsujikawa dd4151330e nghttp: Use before_frame_send_callback to check stream_id 2013-09-03 21:27:33 +09:00
Tatsuhiro Tsujikawa d960cf8953 Add const to read-only nghttp2_frame* parameter in callbacks 2013-09-03 21:24:14 +09:00
Tatsuhiro Tsujikawa 2f26b04730 nghttpx: Code cleanup 2013-09-01 00:23:07 +09:00
Tatsuhiro Tsujikawa 9e703170cd nghttpx: Enable --honor-cipher-order automatically when --ciphers is used 2013-08-30 23:02:47 +09:00
Tatsuhiro Tsujikawa aea036c9d4 nghttpx: Support ECDHE and DHE cipher suites
Use --dh-param-file option to specify a file including DH parameters
in PEM format.

For example, you can create DH parameters with 1024 bit key using
following command:

$ openssl dhparam -outform PEM -out dhparam.pem 1024
2013-08-30 22:07:42 +09:00
Tatsuhiro Tsujikawa e818d098ec nghttp: Fix off-by-one error when allocating space for request headers 2013-08-30 21:30:04 +09:00
Tatsuhiro Tsujikawa 59286adc5e Add int return value to nghttp2_on_unknown_frame_recv_callback 2013-08-29 23:10:18 +09:00
Tatsuhiro Tsujikawa db4f519500 Add int return value to nghttp2_on_frame_recv_parse_error_callback 2013-08-29 23:07:07 +09:00
Tatsuhiro Tsujikawa 053c444769 Add int return value to nghttp2_on_request_recv_callback 2013-08-29 23:03:21 +09:00
Tatsuhiro Tsujikawa 81653c1d1b Add int return value to nghttp2_on_stream_close_callback 2013-08-29 22:58:05 +09:00
Tatsuhiro Tsujikawa 5a7f65f1f7 Add int return value to on_data_send_callback 2013-08-29 21:55:04 +09:00
Tatsuhiro Tsujikawa b9d2f9b6b0 Add int return value to on_frame_not_send_callback 2013-08-29 21:51:58 +09:00
Tatsuhiro Tsujikawa d4852b0f11 Add int return value to on_frame_send_callback 2013-08-29 21:48:34 +09:00
Tatsuhiro Tsujikawa a51cdaacfc Add int return value to nghttp2_before_frame_send_callback 2013-08-29 21:45:10 +09:00
Tatsuhiro Tsujikawa 544ac9f61f Add int return value to nghttp2_on_data_recv_callback 2013-08-29 21:41:33 +09:00
Tatsuhiro Tsujikawa 972b47d6af Add int return value to nghttp2_on_data_chunk_recv_callback 2013-08-29 21:39:32 +09:00
Tatsuhiro Tsujikawa fb7d22fcb9 Add int return value to nghttp2_on_invalid_frame_recv_callback 2013-08-29 21:37:26 +09:00
Tatsuhiro Tsujikawa a59cd3be82 Add int return value to nghttp2_on_frame_recv_callback 2013-08-29 21:33:52 +09:00
Tatsuhiro Tsujikawa 6387d18f23 nghttpx: Fix expect header field handling 2013-08-29 00:03:26 +09:00
Tatsuhiro Tsujikawa 400615ca35 nghttpd: Check disallowed headers 2013-08-28 03:14:19 +09:00
Tatsuhiro Tsujikawa 3544bfdbef src: Move pure HTTP code from shrpx_http.cc to http2.cc 2013-08-28 02:47:22 +09:00
Tatsuhiro Tsujikawa 1f3b96e233 nghttpx: Rewrite header handling 2013-08-28 00:09:46 +09:00
Tatsuhiro Tsujikawa 89cd2ff479 nghttpx: Stream error if disallowed header field in HTTP2 is received 2013-08-26 01:25:31 +09:00
Tatsuhiro Tsujikawa 33743ab832 nghttpx: Remove banned header fields in HTTP2 request and response 2013-08-26 01:09:15 +09:00
Tatsuhiro Tsujikawa 4744e90054 nghttpd: Include status code only in :status header field 2013-08-26 00:58:06 +09:00
Tatsuhiro Tsujikawa 4fb1811d18 nghttpx: Include status code only in :status header field in HTTP2 response 2013-08-25 23:28:34 +09:00
Tatsuhiro Tsujikawa 5d7b7a1691 nghttpx: Stream error if mandatory HTTP/2 request header field is missing 2013-08-25 23:21:07 +09:00
Tatsuhiro Tsujikawa 556212a602 nghttpx: Replace \r\n in the header field to SPC in http downstream 2013-08-24 23:27:45 +09:00
Tatsuhiro Tsujikawa e55abcd634 nghttpx: Fix stream hang when http2 downstream CONNECT failed 2013-08-24 01:43:05 +09:00
Tatsuhiro Tsujikawa 2764c55678 src: Code cleanup 2013-08-23 03:33:05 +09:00
Tatsuhiro Tsujikawa 5ae8605883 src: Use std::thread 2013-08-23 03:33:05 +09:00
Tatsuhiro Tsujikawa 47ee8e3c79 src: Code cleanup 2013-08-23 03:33:05 +09:00
Tatsuhiro Tsujikawa 0c9703fa2c Remove NGHTTP2_FLAG_END_FLOW_CONTROL 2013-08-23 03:33:05 +09:00
Tatsuhiro Tsujikawa c38c6cdd09 nghttpx: Fix bug writecb is nullptr for HTTP/1 connection 2013-08-23 03:32:26 +09:00
Tatsuhiro Tsujikawa b2a34c2e5b nghttpx: Fix bug content-length is removed 2013-08-23 02:49:21 +09:00
Tatsuhiro Tsujikawa 358d12a842 nghttpx: Fix bug CONNECT does not work 2013-08-22 21:28:27 +09:00
Tatsuhiro Tsujikawa b8a01f5212 nghttpx: Require content-length in HTTP2 upstream if END_STREAM flag is not set 2013-08-21 01:19:16 +09:00
Tatsuhiro Tsujikawa 823bb6c35e nghttpx: Require content-length in SPDY upstream if FIN flag is not set 2013-08-21 01:05:06 +09:00
Tatsuhiro Tsujikawa 4d51def65f nghttpx: Limit read rate on upstream-end 2013-08-21 01:00:55 +09:00
Tatsuhiro Tsujikawa aa9688b459 nghttpx: Fix possible multiple replies on HTTP2 and SPDY upstreams 2013-08-21 00:56:08 +09:00
Tatsuhiro Tsujikawa ef6ccc0d74 Update .gitignore 2013-08-15 10:41:22 +09:00
Tatsuhiro Tsujikawa 3e1aad60b7 nghttp: Remove --no-tls option and detect TLS requirement using URI scheme 2013-08-12 22:33:51 +09:00
Tatsuhiro Tsujikawa 4fac4eb92d nghttpx: HttpUpstream: Check required request headers strictly
If multiple required headers (e.g., :path) found, return HTTP 400
error.
Fix util::strieq(a,b,n) where boundary of b is not checked in the
loop.
2013-08-11 00:08:44 +09:00
Tatsuhiro Tsujikawa 989d613448 nghttpx: Save pid file after daemon() call 2013-08-10 18:55:18 +09:00
Tatsuhiro Tsujikawa c36fcf1794 src: Print opaque_data_len of GOAWAY 2013-08-10 00:46:00 +09:00
Tatsuhiro Tsujikawa 02a7182ebd src: Create strframetype to handle unknown frame types 2013-08-10 00:42:11 +09:00
Tatsuhiro Tsujikawa 47c1447030 src: Print SETTINGS string name 2013-08-10 00:37:57 +09:00
Tatsuhiro Tsujikawa d194a31e4a src: Use print_frame_hd from print_data_frame 2013-08-10 00:31:59 +09:00
Tatsuhiro Tsujikawa 19377fb3cd Allow disabling auto WINDOW_UPDATE for connection and stream individually
Now NGHTTP2_OPT_NO_AUTO_WINDOW_UPDATE is split into 2 options:
NGHTTP2_OPT_NO_AUTO_STREAM_WINDOW_UPDATE and
NGHTTP2_OPT_NO_AUTO_CONNECTION_WINDOW_UPDATE.
This is preparation for the upcoming removal of END_FLOW_CONTROL
flag. For nghttpx, instead of using END_FLOW_CONTROL to disable
connection-level flow control, increase window size by large
enough value, which is friendly way to current chromium
implementation.
2013-08-09 01:23:39 +09:00
Tatsuhiro Tsujikawa fafec1fdb8 nghttpx: Accept incoming bytes at least initial window size 2013-08-07 21:27:08 +09:00
Tatsuhiro Tsujikawa 7f71e83c52 nghttpd: Use 100 for MAX_CONCURRENT_STREAMS 2013-08-07 01:23:43 +09:00
Tatsuhiro Tsujikawa 07814be5b2 src: HttpServer: Remove unused member variable sfd_ 2013-08-06 23:17:13 +09:00
Tatsuhiro Tsujikawa 2b71598bdf src: Reorder AM_CPPFLAGS and AM_LDFLAGS 2013-08-06 21:24:34 +09:00
Tatsuhiro Tsujikawa 1b95e23bfb Add ax_cxx_compile_stdcxx_11 to check C++11 availability and flags 2013-08-06 21:20:36 +09:00
Tatsuhiro Tsujikawa 168c5ac5b3 HttpServer: Code cleanup 2013-08-06 00:07:51 +09:00
Tatsuhiro Tsujikawa fadbdbae0b nghttp: Add -p option to specify stream priority 2013-08-04 18:55:26 +09:00
Tatsuhiro Tsujikawa 2a311b3102 src: Print flags in DATA 2013-08-04 18:44:11 +09:00
Tatsuhiro Tsujikawa 690349009d nghttp: Call on_read() to process all data in buffer after upgrade succeeded 2013-08-04 18:43:10 +09:00
Tatsuhiro Tsujikawa d4ade2d7d0 nghttpx: Return -1 if dconn_ is nullptr on push_upload_data_chunk 2013-08-03 23:45:28 +09:00
Tatsuhiro Tsujikawa f613f68a13 src: Make window size - 1
To match the -w16 to 65535, which is HTTP/2.0 default initial window
size, decrement 1 from (1 << window_bits).
2013-08-03 19:53:07 +09:00
Tatsuhiro Tsujikawa 6bcfb99cc0 nghttpx: Update help messages 2013-08-03 19:19:04 +09:00
Tatsuhiro Tsujikawa 079f867d68 nghttp: Ignore -u if --no-tls is not given 2013-08-03 19:08:52 +09:00
Tatsuhiro Tsujikawa d1bc3c89a7 nghttpx: Code cleanup 2013-08-03 19:04:44 +09:00
Tatsuhiro Tsujikawa 0150312022 nghttpx: Rename spdy_{upstream,downstream}_no_tls as {upstream,downstream}_no_tls 2013-08-03 19:01:57 +09:00
Tatsuhiro Tsujikawa 564e6b9ffc nghttpx: Rename --{front,back}end-spdy-no-tls as --{front,back}end-no-tls 2013-08-03 18:58:14 +09:00
Tatsuhiro Tsujikawa f620655d08 nghttp, nghttpx: Add HTTP Upgrade from HTTP/1.1 to HTTP/2.0
nghttpx does not perform upgrade if the request has request body.
2013-08-03 18:51:01 +09:00
Tatsuhiro Tsujikawa 5594f0ef0b nghttpx: Preserve upgrade in Connection header field 2013-08-02 00:00:33 +09:00
Tatsuhiro Tsujikawa 8fd1953b21 app_helper: Show flags in hex 2013-08-01 21:42:16 +09:00
Tatsuhiro Tsujikawa 1bbcbd365c shrpx: Cast uint8_t to uint32_t to print its decimal number 2013-08-01 20:33:04 +09:00
Tatsuhiro Tsujikawa fec566aa23 src: Send out data in output buffer before HTTP2/SPDY session tear down 2013-08-01 20:31:29 +09:00
Tatsuhiro Tsujikawa 8cb92fc277 nghttpx: Handle error from Upstream::resume_read in upgrade code 2013-07-31 22:14:25 +09:00
Tatsuhiro Tsujikawa 924b1bd61a Use unmodified http-parser
Handle HTTP Upgrade and CONNECT explicitly
2013-07-31 21:48:37 +09:00
Tatsuhiro Tsujikawa ab56cd4ea3 nghttpx: Fix bug: end marker of chunked encoding is written twice 2013-07-30 21:46:00 +09:00
Tatsuhiro Tsujikawa dc2ed7414c src: Cleanup src builds 2013-07-28 19:50:02 +09:00
Tatsuhiro Tsujikawa 9f9c0cbcd1 nghttpd: Add -F and -f option to disable connection/stream level flow control 2013-07-28 19:29:11 +09:00
Tatsuhiro Tsujikawa 56db10cb5e nghttp: Add -F and -f option to disable connection/stream level flow controls 2013-07-28 19:29:11 +09:00
Tatsuhiro Tsujikawa 60fe0337da app_helper: Print PUSH_PROMISE 2013-07-27 22:37:09 +09:00
Tatsuhiro Tsujikawa f7c0df1235 Remove :version from downstream HTTP/2.0 request 2013-07-27 18:57:33 +09:00
Tatsuhiro Tsujikawa 90b06e8572 nghttpx: Add HTTP/2.0 word in help message 2013-07-26 21:55:08 +09:00
Tatsuhiro Tsujikawa 1fca42ed2b nghttpx: Remove :version from http2 connection 2013-07-26 21:47:53 +09:00
Tatsuhiro Tsujikawa 5ccf647df9 Rename shrpx as nghttpx superficially 2013-07-26 21:42:39 +09:00
Tatsuhiro Tsujikawa 86174f537a shrpx: Send and receive client connection header 2013-07-26 21:35:14 +09:00
Tatsuhiro Tsujikawa 9b27160195 HttpServer: Fix left_connhd_len_ is not updated 2013-07-26 21:34:39 +09:00
Tatsuhiro Tsujikawa 32bd1425b4 shrpx: SPDY support in upstream connection 2013-07-26 20:12:55 +09:00
Tatsuhiro Tsujikawa 41b21f7938 fixup 2013-07-26 19:38:54 +09:00
Tatsuhiro Tsujikawa 18f450fd2a Port shrpx to nghttp2 use 2013-07-26 19:33:25 +09:00
Tatsuhiro Tsujikawa 459a269049 Define HTTP/2.0 protocol version ID 2013-07-26 01:38:04 +09:00
Tatsuhiro Tsujikawa 3cc71a707e Rename nghttp2_headers_category members
Add NGHTTP2_HCAT_PUSH_RESPONSE
2013-07-25 20:57:50 +09:00
Tatsuhiro Tsujikawa cca1d19d3d Fix WINDOW_UPDATE enum value 2013-07-23 02:08:32 +09:00
Tatsuhiro Tsujikawa 57401bfb8d src: Print PRIORITY frame in print_frame() 2013-07-23 00:29:52 +09:00
Tatsuhiro Tsujikawa 42ff5b5c04 Rename nghttp2_ssl as app_helper 2013-07-22 22:12:54 +09:00
Tatsuhiro Tsujikawa ec79d70bd0 Code cleanup 2013-07-22 22:08:52 +09:00
Tatsuhiro Tsujikawa 551ae72f3a Remove spdyd and spdycat 2013-07-22 22:06:31 +09:00
Tatsuhiro Tsujikawa 9e9a7fb160 Add nghttpd and 24 bytes client connection header support 2013-07-22 21:56:19 +09:00
Tatsuhiro Tsujikawa 6bc7e7bd0b Add nghttp client backed by libevent 2013-07-22 00:01:33 +09:00
Tatsuhiro Tsujikawa 94258cd0b8 Move NGHTTP2_PRI_* to nghttp2.h, fix too small pri data type in src 2013-07-20 01:59:43 +09:00
Tatsuhiro Tsujikawa 61bf7c6b02 Integrate new header compression 2013-07-20 00:08:14 +09:00
Tatsuhiro Tsujikawa 257bc1c924 print_frame: Show pri only when NGHTTP2_FLAG_PRIORITY flag set 2013-07-17 01:13:58 +09:00
Tatsuhiro Tsujikawa 307e13375d spdycat: Set on_data_send_callback 2013-07-17 01:10:50 +09:00
Tatsuhiro Tsujikawa 3ed5c78a2c Remove unnecessary indent in DATA frame line 2013-07-16 20:54:01 +09:00
Tatsuhiro Tsujikawa 68c072485c Remove :version existence check in spdyd 2013-07-16 20:53:29 +09:00
Tatsuhiro Tsujikawa 24cab312cf Make spdycat and spdyd barely work 2013-07-16 00:15:04 +09:00
Tatsuhiro Tsujikawa 39e0b06bfc Comment out shrpx build in Makefile for now 2013-07-13 00:45:42 +09:00
Tatsuhiro Tsujikawa 0edce70343 Rebranding nghttp2 2013-07-13 00:43:06 +09:00
Tatsuhiro Tsujikawa 7b59a11480 shrpx: Create default SSL context once 2013-06-21 23:17:46 +09:00
Tatsuhiro Tsujikawa d1b9af0268 shrpx: Fix usage doc 2013-06-09 23:09:49 +09:00
Tatsuhiro Tsujikawa e91b386422 src: Add SRC_LIBS to shrpx_unittest_LDFLAGS 2013-05-03 22:15:07 +09:00
Tatsuhiro Tsujikawa c02fefe063 spdylay_ssl.cc: Cast tv.tv_sec to long int to pass printf 2013-05-03 22:14:16 +09:00
moparisthebest aa13b9b980 Drop priveleges only after listening on possibly priveleged port 2013-04-19 07:58:58 -04:00
moparisthebest 7dfa559bc4 Add --honor-cipher-order option to mitigate BEAST attacks 2013-04-18 14:25:48 -04:00
snnn 4c238c5b36 fix building on mac os x. "error: invalid suffix on literal; C++11 requires a space between literal and identifier" 2013-04-17 14:33:55 +08:00
Tatsuhiro Tsujikawa 34e119fde2 shrpx: Remove useless backend spdy version check
It is unnecessary because spdy version at this point is always valid.
2013-03-29 22:16:50 +09:00
Tatsuhiro Tsujikawa a9f475fb88 spdycat, shrpx: TLS SNI enhancements
shrpx:
* Added an option to set the TLS SNI extension between shrpx and the
  origin on the command line

spdycat:
* If the user set an explicit host header ( using --headers ) use that
  name for the TLS SNI extension.
* Added the handshake completion time to the verbose output
* The gettimeofday call in get_time was using the incorrect structure
  ( I believe )
* In update_html_parser it was submitting the request regardless of
  the return value of add_request.

Patch from Stephen Ludin
2013-03-29 22:06:33 +09:00
Tatsuhiro Tsujikawa bdade00e68 cygwin build fix 2013-03-28 01:25:42 +09:00
Tatsuhiro Tsujikawa 7d709fa3ff shrpx: Support non-TLS SPDY in frontend connection 2013-03-24 21:03:39 +09:00
Tatsuhiro Tsujikawa 7264966bb5 shrpx: Check get_request_state() == MSG_COMPLETE when body is empty 2013-03-08 01:50:46 +09:00
Tatsuhiro Tsujikawa 4461cb24ed shrpx: Fix assertion failure in SpdyDownstreamConnection::attach_stream_data 2013-03-07 21:32:10 +09:00
Tatsuhiro Tsujikawa add067ed7e Provide timegm replacement and android build fix 2013-03-07 21:17:55 +09:00
Tatsuhiro Tsujikawa eddd48b783 shrpx: Don't issue RST_STREAM on downstream tunnel connection EOF
The RST_STREAM will be issued in spdy_data_read_callback.
2013-03-01 20:43:35 +09:00
Tatsuhiro Tsujikawa 2d23ae3741 shrpx: Fix missing delete 2013-03-01 00:07:00 +09:00
Tatsuhiro Tsujikawa cf1cfca51f shrpx: Fix not send RST_STREAM when downstream gets valid EOF 2013-03-01 00:05:57 +09:00
Tatsuhiro Tsujikawa da36fc3953 shrpx: Fix WINDOW_UPDATE may block until SpdyUpstream::send()
spdy_data_read_callback in SpdyDownstreamConnection calls
SpdyUpstream::resume_read() which submits WINDOW_UPDATE, but after
that they are not call SpdyUpstream::send(). This means that if no
pending outgoing data in upstream, then WINDOW_UPDATE is blocked until
SpdyUpstream::send() from somewhere. This change adds
SpdyUpstream::send() to resume_read() so that WINDOW_UPDATE is not
blocked.
2013-02-27 22:55:44 +09:00
Tatsuhiro Tsujikawa 7b3f57cef8 shrpx: Fix blocking upstream RST_STREAM and propagate REFUSED_STREAM
This change fixes upstream RST_STREAM is blocked until
SpdyUpstream::send() is called. Now downstream REFUSED_STREAM is
propagated to upstream client so that client can reset request.  The
RST_STREAM error code when downstream went wrong is changed from
CANCEL to INTERNAL_ERROR.
2013-02-27 22:39:44 +09:00
Tatsuhiro Tsujikawa dbb0df5c5b Remove strerror(3) from code which may run in multi-thread 2013-02-25 22:43:44 +09:00
Tatsuhiro Tsujikawa c487d152b2 shrpx: Add non-TLS SPDY backend connection support
Use --backend-spdy-no-tls to disable TLS on backend SPDY connection.
The SPDY protocol used there must be configured by
--backend-spdy-proto option.
2013-02-22 22:54:54 +09:00
Tatsuhiro Tsujikawa fc26f08af2 shrpx: Fix Proxy-Authorization is alwasy sent even if userinfo is empty
Surprisingly, field_set & UF_USERINFO is nonzero even if userinfo
component is empty string.
2013-02-22 21:23:59 +09:00
Tatsuhiro Tsujikawa 78523c6701 shrpx: Fix backend SPDY connection does not go through proxy 2013-02-22 19:30:15 +09:00
Tatsuhiro Tsujikawa 64fcac48b7 shrpx: Fix bug in building certificate lookup tree 2013-02-16 17:51:38 +09:00
Tatsuhiro Tsujikawa c8167234fa shrpx: Fix bug in certificate lookup 2013-02-16 02:33:16 +09:00
Tatsuhiro Tsujikawa abe5fd1e39 spdycat: Fix -d option in usage 2013-02-14 21:25:46 +09:00
Tatsuhiro Tsujikawa 54d5dda6c4 spdycat: Add --multiply option 2013-02-14 21:24:57 +09:00
Tatsuhiro Tsujikawa 3d2ef18afb spdycat: Fix error handling of spdylay_gzip_inflate() 2013-02-14 21:12:16 +09:00
Tatsuhiro Tsujikawa 291cbc639b shrpx: Use patricia trie for cert lookup 2013-02-14 00:28:55 +09:00
Tatsuhiro Tsujikawa e322af8a6f src: Add missing base64.h 2013-02-11 21:49:04 +09:00
Tatsuhiro Tsujikawa e28f169228 shrpx: More backend EOF handling
Now we set Downstream::set_response_connection_close(true) for
tunneled connections. Also call
Upstream::on_downstream_body_complete() callback when setting
MSG_COMPLETE in SpdySession when RST_STREAM is caught.  Clean up EOF
handling in https_downstream_readcb.
2013-02-11 17:20:52 +09:00
Tatsuhiro Tsujikawa d830e099a6 shrpx: Send pending response data before RST_STREAM in tunnel connection 2013-02-11 02:05:11 +09:00
Tatsuhiro Tsujikawa 734d7bced8 shrpx: Handle downstream response_state == MSG_RESET case in SPDY upstream 2013-02-09 23:20:29 +09:00
Tatsuhiro Tsujikawa 8b6fbbf3a6 shrpx: Update --backend-http-proxy-uri usage 2013-02-09 19:08:02 +09:00
Tatsuhiro Tsujikawa 39df51188c shrpx: Log stream ID when submitting RST_STREAM to downstream 2013-02-09 17:56:44 +09:00
Tatsuhiro Tsujikawa ceba5539a1 shrpx: Fix client mode does not work 2013-02-09 17:45:57 +09:00
Tatsuhiro Tsujikawa 18dc6384d4 shrpx: Remove x-forwarded-proto header from SPDY downstream
SPDY frame has :scheme header field, so x-forwarded-proto is not
necessary.
2013-02-09 17:22:33 +09:00
Tatsuhiro Tsujikawa b43b31c362 shrpx: Remove x-forwarded-spdy header field 2013-02-09 17:21:46 +09:00
Tatsuhiro Tsujikawa 4876412f7d shrpx: Check return value of HttpsUpstream::resume_read()
Currently, resume_read() fails if on_read() returns -1 in case that
evbuffer_add failed, which means, most likely, memory allocation
failure. ClientHandler is marked "should be closed", but if
evbuffer_add is failed, write callback will not be invoked and its
marking is not evaluated. It will eventually be deleted when the
client is disconnected or backend failure though.
2013-02-09 17:03:03 +09:00
Tatsuhiro Tsujikawa 99b687ceca shrpx: Documented --spdy-bridge 2013-02-09 16:55:49 +09:00
Tatsuhiro Tsujikawa cb8b8050b5 shprx: Add --backend-http-proxy-uri option
Specify proxy URI in the form http://[USER:PASS]PROXY:PORT. USER and
PASS are optional and if they exist they must be properly
percent-encoded. This proxy is used when the backend connection is
SPDY. First, make a CONNECT request to the proxy and it connects to
the backend on behalf of shrpx. This forms tunnel. After that, shrpx
performs SSL/TLS handshake with the downstream through the tunnel. The
timeouts when connecting and making CONNECT request can be specified
by --backend-read-timeout and --backend-write-timeout options.
2013-02-09 16:55:39 +09:00
Tatsuhiro Tsujikawa 9ba19df813 shrpx: Add --spdy-bridge option
With --spdy-bridge option, it listens SPDY/HTTPS connections from
front end and forwards them to the backend in SPDY. The usage will be
written later. This change fixes the crash when more than 2
outstanding SpdyDownstreamConnection objects are added to SpdySession
and establishing connection to SPDY backend is failed.
2013-02-08 21:46:58 +09:00
Tatsuhiro Tsujikawa 8925c58d71 shrpx: Send RST_STREAM when downstream becomes stale 2013-02-08 00:22:22 +09:00
Tatsuhiro Tsujikawa 9b4245368a shrpx: Refactor spdy downstream header field handling 2013-02-07 21:53:20 +09:00
Tatsuhiro Tsujikawa c707125839 shrpx: Explicitly hold server SSL_CTX and client SSL_CTX 2013-02-07 21:13:36 +09:00
Tatsuhiro Tsujikawa b18af854af shrpx: Add --subcert option to add additional certificate/private key
This option specifies additional certificate and private key
file. Shrpx will choose certificates based on the hostname indicated
by client using TLS SNI extension. This option can be used multiple
times.
2013-02-06 23:41:28 +09:00
Tatsuhiro Tsujikawa e3401b0159 shrpx: Lowercase x-forwarded-proto 2013-02-01 23:36:08 +09:00
Tatsuhiro Tsujikawa ae0533334c shrpx: Relay Connection: upgrade header field for HTTP/1.1 connections 2013-02-01 23:30:12 +09:00
Tatsuhiro Tsujikawa d9611e65ac spdycat: Send "accept-encoding: gzip, deflate" header field 2013-02-01 00:17:28 +09:00
Tatsuhiro Tsujikawa 2e3cd7d04f spdycat: Output error messages to std::cerr 2013-01-30 21:50:36 +09:00
Tatsuhiro Tsujikawa 37cb94d154 src: Use clock_gettime instead of gettimeofday if available 2013-01-27 17:16:13 +09:00
Tatsuhiro Tsujikawa 09154c61f6 spdycat, spdyd: Color verbose output 2013-01-27 16:27:17 +09:00
Tatsuhiro Tsujikawa 964c0d1005 shrpx: Don't return chunked response for pre-HTTP/1.1 request 2013-01-27 16:20:14 +09:00
Tatsuhiro Tsujikawa 817f35f3e4 spdycat: Free fd and SSL object on error 2013-01-25 23:15:34 +09:00
Tatsuhiro Tsujikawa ac01e48f7a spdycat: Initialize SpdySession::sc 2013-01-25 22:58:07 +09:00
Tatsuhiro Tsujikawa f6c0061117 spdycat: Log if set_tcp_nodelay() failed 2013-01-25 22:58:07 +09:00
Tatsuhiro Tsujikawa f0fc026799 shrpx: Check return value of library functions 2013-01-25 22:58:07 +09:00
Tatsuhiro Tsujikawa 9f28b3056f spdyd: Initialize Config::on_request_recv_callback 2013-01-25 21:37:43 +09:00
Tatsuhiro Tsujikawa 6732219dc7 spdyd: ListenEventHandler creation fix 2013-01-25 21:27:54 +09:00
Tatsuhiro Tsujikawa 5774f8110d shrpx: Fix resource leak 2013-01-25 21:26:03 +09:00
Tatsuhiro Tsujikawa 29bec93eb9 shrpx: Don't run expensive INFO log code
INFO log and its surrounding code are now guarded by
LOG_ENABLED(SEVERITY) macro so that they don't run if log level
threshold is higher. This increases performance because log formatting
is somewhat expensive.
2013-01-21 22:48:08 +09:00
Tatsuhiro Tsujikawa 87c1f07013 shrpx: HttpsUpstream::error_reply() without std::stringstream 2013-01-16 22:51:33 +09:00
Tatsuhiro Tsujikawa c48fb56d3f shrpx: Add content-length header field to SPDY upstream error page
create_error_html() is rewritten without std::stringstream.
2013-01-16 22:47:39 +09:00
Tatsuhiro Tsujikawa dc2fe52e57 shrpx: Add missing \n to help message 2013-01-12 16:42:48 +09:00
Tatsuhiro Tsujikawa ae8e5b7a95 spdycat: Add -d option to POST data 2013-01-11 00:15:45 +09:00
Tatsuhiro Tsujikawa 28489fd6a8 shrpx: Set TCP_NODELAY to downstream sockets 2013-01-11 00:11:41 +09:00
Tatsuhiro Tsujikawa e454cc1301 shrpx: Remove warn log from upstream_{read,write}cb 2013-01-11 00:10:08 +09:00
Tatsuhiro Tsujikawa c306402a20 shrpx: Capitalize header field name in HTTP downstream connection 2013-01-09 22:55:29 +09:00
Tatsuhiro Tsujikawa c45fa16f94 shrpx: Add --no-via option
If --no-via option is given, shrpx does not append to Via header
field. If Via header field is received, it is left unaltered.
2013-01-09 22:03:49 +09:00
Tatsuhiro Tsujikawa 4d1f1f2395 shrpx: Log IP version number when getaddrinfo failed 2013-01-09 22:03:34 +09:00
Tatsuhiro Tsujikawa 6da492c4e8 Remove uri.{cc,h} and use http_parser_parse_url() instead 2013-01-09 00:42:06 +09:00
Tatsuhiro Tsujikawa 633e85246f Include http-parser/http_parser.h locally 2013-01-05 23:21:09 +09:00
Tatsuhiro Tsujikawa 6a4a0e7f8c Remove useless extern "C" 2013-01-05 23:20:18 +09:00
Tatsuhiro Tsujikawa be5066c450 Updated http-parser 2012-12-23 01:13:02 +09:00
Tatsuhiro Tsujikawa 92260ccc81 Add patch for http-parser to handle tunneling connection transparently 2012-12-20 01:05:51 +09:00
Tatsuhiro Tsujikawa 9425f8a45f shrpx: Handle graceful shutdown in SPDY backend 2012-12-17 01:10:45 +09:00
Tatsuhiro Tsujikawa 3ba73db7d7 shrpx: Remove unused function modify_location_header_value 2012-12-14 01:14:42 +09:00
Tatsuhiro Tsujikawa 4d80a26188 spdycat: Log error when no supported SPDY version was negotiated 2012-12-12 23:28:32 +09:00
Tatsuhiro Tsujikawa 8c456674cf shrpx: Remove upstream_spdy_stream and upstream_spdy_stream_close
upstream_response logs more detailed information.
2012-12-09 23:30:11 +09:00
Tatsuhiro Tsujikawa 90eebbc88c shrpx: Log status code, method, path and HTTP version in accesslog 2012-12-09 23:29:43 +09:00
Tatsuhiro Tsujikawa 6ef9b7430d shrpx: Color HTTP headers in console log 2012-12-09 21:36:02 +09:00
Tatsuhiro Tsujikawa 9b1f36d274 shrpx: Color severity level in terminal
Color severity level if stderr refers to a terminal.
2012-12-09 21:02:48 +09:00
Tatsuhiro Tsujikawa bbf6c18575 shrpx: Log format change
Added macros which log messages from the following components are
prefixed with their component name + object pointer address:

ListenHandler: LISTEN
ThreadEventReceiver: THREAD_RECV
Upstream: UPSTREAM
Downstream: DOWNSTREAM
DownstreamConnection: DCONN
SpdySession: DSPDY
2012-12-09 19:15:14 +09:00
Tatsuhiro Tsujikawa 65e965791f shrpx: Replace strncpy + putting null with memcpy in ssl_pem_passwd_cb 2012-12-07 23:42:58 +09:00
Tatsuhiro Tsujikawa 06220f7fdf shrpx: Make is_secure() static 2012-12-07 23:14:20 +09:00
Raul Gutierrez Segales cbf8ccf7d1 [shrpx] read private key's passwd from a file
This avoids the need to provide the password for your
private key interactively.

It can be used via --private-key-passwd-file or private-key-passwd-file
in the given config file. The first line in the file
(without \n) will be treated as the passwd. There isn't
any validation and all lines after the first one (if any)
are ignored.

The security model behind this is a bit simplistic so I
am open to better ideas. Basically your password file
should be root:root (700) and you *should* drop root
and run as an unprivileged user.

If the file exists and a line can be read then a callback
will be set for the SSL ctxt and it'll feed the passwd
when the private key is read (if password is needed).

If the file exists with the wrong permisions it'll be
logged and ignored.
2012-12-03 21:55:32 -08:00
Tatsuhiro Tsujikawa f97110f092 spdycat, spdyd: Support SPDY without SSL/TLS
Use --no-tls option to disable SSL/TLS and specify SPDY protocol
version using -2 or -3.
2012-11-25 21:58:44 +09:00
Tatsuhiro Tsujikawa 50211bc1ad shrpx: Replace "https" with "http" in log message in shrpx_https_upstream.cc 2012-11-23 21:30:57 +09:00
Tatsuhiro Tsujikawa 282b8b567a shrpx: Log upstream https request headers 2012-11-23 21:30:17 +09:00
Tatsuhiro Tsujikawa 8f62441112 src: Rewrite util::stripIter 2012-11-23 21:14:39 +09:00
Tatsuhiro Tsujikawa baf2dc3ddf shrpx: Add --backend-ipv4 and --backend-ipv6 options. 2012-11-23 21:11:01 +09:00
Tatsuhiro Tsujikawa 7a21905312 shrpx: Remove Config ctor and fill all initial values in fill_default_config() 2012-11-22 23:35:10 +09:00
Tatsuhiro Tsujikawa c1332a35a5 shrpx: Add -v, --version option 2012-11-22 23:08:36 +09:00
Tatsuhiro Tsujikawa 774e64d2b4 shrpx: Group up options in -h output 2012-11-22 23:04:27 +09:00
Tatsuhiro Tsujikawa 9c70c1b867 shrpx: Code cleanup 2012-11-22 22:05:52 +09:00
Tatsuhiro Tsujikawa 4349d42988 shrpx: Add usage for <PRIVATE_KEY> <CERT> 2012-11-22 22:00:38 +09:00
Tatsuhiro Tsujikawa 9aa7af2c7f shrpx: Use SNI TLS extension in client mode 2012-11-22 21:51:11 +09:00
Tatsuhiro Tsujikawa d589f4c74c shrpx: Verify backend server's certificate in client mode
The -k, --insecure option is added to skip this verification.  The
system wide trusted CA certificates will be loaded at startup. The
--cacert option is added to specify the trusted CA certificate file.
2012-11-22 21:46:15 +09:00
Tatsuhiro Tsujikawa 8a5db1751e shrpx: Check the length of output buffer in write callback
Possibly because of deferred callback, we may get this callback when
the output buffer is not empty.
2012-11-22 03:13:30 +09:00
Tatsuhiro Tsujikawa 81adb6bc7f shrpx: Implement downstream SPDY flow control 2012-11-21 23:47:48 +09:00
Tatsuhiro Tsujikawa 0bf15a7694 Rename --client-mode as --client and add --client-proxy
With --client-proxy option, shrpx makes sure that the request path is
an absolute URI, otherwise it will return 400 status code.
2012-11-21 22:10:35 +09:00
Tatsuhiro Tsujikawa fa552c6788 shrpx: Share SPDY session among multiple frontend connections per thread
In client mode, now SPDY connection to the backend server is
established per thread.  The frontend connections which belong to the
same thread share the SPDY connection.
2012-11-21 01:29:39 +09:00
Tatsuhiro Tsujikawa ae30e7f71b shrpx: Split request path into SPDY specific headers 2012-11-19 21:40:59 +09:00
Tatsuhiro Tsujikawa bebea5e16a Update http-parser 2012-11-19 02:16:42 +09:00
Tatsuhiro Tsujikawa 542fd6420b Fix recursive HttpsUpstream::on_read() call
Don't call HttpsUpstream::resume_read() from the call tree of
on_read().  Avoid parsing next http data after parse error.
2012-11-19 02:11:46 +09:00
Tatsuhiro Tsujikawa 077275e783 Fix typo SPDY/3 2012-11-19 02:10:58 +09:00
Tatsuhiro Tsujikawa aa07076f29 shrpx: Don't propagate expect: 100-continue to backend 2012-11-18 23:49:41 +09:00
Tatsuhiro Tsujikawa 52c4d26927 shrpx: Deadlock with upload data in clinet mode 2012-11-18 23:48:55 +09:00
Tatsuhiro Tsujikawa 19bf97b3e5 Support x-forwarded-proto and x-forwarded-for in SpdyDownstreamConnection 2012-11-18 23:04:14 +09:00
Tatsuhiro Tsujikawa 026f4ca3a2 Add --client-mode option
With --client-mode option, shrpx now accepts unencrypted HTTP
connections and communicates with backend server in SPDY.  In short,
this is the "reversed" operation mode against normal mode.  This may
be useful for testing purpose because it can sit between HTTP client
and shrpx "normal" mode.
2012-11-18 21:46:07 +09:00
Tatsuhiro Tsujikawa aa64a7f7f5 Don't send response-body for 304 response 2012-11-18 21:22:08 +09:00
Tatsuhiro Tsujikawa 4748443899 shrpx: Log detailed error description in SSL code 2012-11-14 21:14:11 +09:00
Raul Gutierrez Segales 6f6f6ffc41 [shrpx] fix password handling for certs keys
We should only call daemon() after ListenHandler is
instantiated, where  SSL_CTX_use_PrivateKey_file is called,
otherwise we have no stdin/stdout to get the password for
keyfile.
2012-10-27 22:29:27 -07:00
Tatsuhiro Tsujikawa fdc19550fc spdyd: Open file with O_BINARY flag 2012-10-16 22:57:26 +09:00
Tatsuhiro Tsujikawa 22840dbfaf spdycat: Handle timeout in connect and SSL/TLS handshake 2012-10-14 23:39:41 +09:00
Tatsuhiro Tsujikawa a28e1c6e7d Add src/.gitignore and edit examples/.gitignore 2012-10-06 00:01:13 +09:00
Tatsuhiro Tsujikawa 2ea0c1c1b0 Add missing url_parser.c 2012-10-05 23:56:26 +09:00
Tatsuhiro Tsujikawa 9378b74fc3 spdycat: Rewritten time_delta 2012-10-04 23:54:39 +09:00
Tatsuhiro Tsujikawa c0577602d1 shrpx: Made SPDY/3 default protocol in SPDY proxy mode
The reason why we choose SPDY/2 as default for SPDY prxy was due to
Chrome's window update bug. Now its fix is available in Chrome stable,
we make SPDY/3 as default.
2012-10-01 23:01:44 +09:00
Tatsuhiro Tsujikawa e69947a054 Removed trailing spaces 2012-10-01 21:51:24 +09:00
Tatsuhiro Tsujikawa 9d6257a4cc spdycat: Just return in check_response_header if stream_user_data is NULL
We cannot use assert(stream_user_data) because server-pushed stream
does not have stream_user_data.
2012-09-22 16:07:49 +09:00
Tatsuhiro Tsujikawa 00172f827a spdycat: Add missing break after handling -H option 2012-09-22 16:05:20 +09:00
Tatsuhiro Tsujikawa abf2ddc3a6 shrpx: Use request HTTP version in HTTPS upstream response 2012-09-20 22:36:17 +09:00
Tatsuhiro Tsujikawa 5597ee68da shrpx: Use raw pointer for downstream instead of deque 2012-09-20 22:28:40 +09:00
Tatsuhiro Tsujikawa c78e0ca055 shrpx: Log when SPDY stream is closed 2012-09-15 17:27:20 +09:00
Tatsuhiro Tsujikawa 7f481e42b0 shrpx: Add more spdylay callback
The on_ctrl_not_send_callback, on_ctrl_recv_parse_error_callback and
on_unknown_ctrl_recv_callback were added. The latter 2 callbacks are
purely debugging purpose.  In on_ctrl_not_send_callback, If sending
SYN_REPLY failed, issue RST_STREAM to avoid a stream hanging around.
2012-09-15 17:19:58 +09:00
Tatsuhiro Tsujikawa 436b201d6f shrpx: Check request_connection_close_ when deciding closing connection
When deciding whether to close the client connection, check
request_connection_close_ of Downstream in addition of
response_connection_close_. Also we only add "Connection: Keep-Alive"
header to the HTTP/1.0 or HTTP/0.9 clients.
2012-09-13 21:33:35 +09:00
Tatsuhiro Tsujikawa 427b9ebfdb shrpx: Update http-parser 2012-09-11 00:12:23 +09:00
Tatsuhiro Tsujikawa ca415a2a15 Add --enable-src configure option
When --enable-src is given, the programs in src directory will be
built. If --disable-src is given, those programs will not be built. If
none of them are given, --enable-src is assumed.
2012-09-10 21:51:08 +09:00
Tatsuhiro Tsujikawa b0fcd68783 Move spdycat, spdyd and shrpx from examples to src
To distinguish the to-be-installed programs and non-installable
example source code, the former programs, spdycat, spdydyd and shrpx,
were moved to src directory. spdynative was removed from Makefile
because it does not appeal to any users much.
2012-09-10 21:39:51 +09:00