nghttpx: More replacement of spdy with http2
This commit is contained in:
parent
0fcd14300a
commit
b1905c5815
|
@ -94,7 +94,8 @@ std::chrono::steady_clock::time_point get_time();
|
|||
void print_timer();
|
||||
|
||||
// Setting true will print characters with ANSI color escape codes
|
||||
// when printing SPDY frames. This function changes a static variable.
|
||||
// when printing HTTP2 frames. This function changes a static
|
||||
// variable.
|
||||
void set_color_output(bool f);
|
||||
|
||||
} // namespace nghttp2
|
||||
|
|
|
@ -344,15 +344,15 @@ void fill_default_config()
|
|||
mod_config()->private_key_passwd = 0;
|
||||
mod_config()->cert_file = 0;
|
||||
|
||||
// Read timeout for SPDY upstream connection
|
||||
// Read timeout for HTTP2 upstream connection
|
||||
mod_config()->http2_upstream_read_timeout.tv_sec = 180;
|
||||
mod_config()->http2_upstream_read_timeout.tv_usec = 0;
|
||||
|
||||
// Read timeout for non-SPDY upstream connection
|
||||
// Read timeout for non-HTTP2 upstream connection
|
||||
mod_config()->upstream_read_timeout.tv_sec = 180;
|
||||
mod_config()->upstream_read_timeout.tv_usec = 0;
|
||||
|
||||
// Write timeout for SPDY/non-SPDY upstream connection
|
||||
// Write timeout for HTTP2/non-HTTP2 upstream connection
|
||||
mod_config()->upstream_write_timeout.tv_sec = 60;
|
||||
mod_config()->upstream_write_timeout.tv_usec = 0;
|
||||
|
||||
|
|
|
@ -84,7 +84,7 @@ private:
|
|||
bool should_close_after_write_;
|
||||
std::set<DownstreamConnection*> dconn_pool_;
|
||||
// Shared HTTP2 session for each thread. NULL if backend is not
|
||||
// SPDY. Not deleted by this object.
|
||||
// HTTP2. Not deleted by this object.
|
||||
Http2Session *http2session_;
|
||||
// The number of bytes of HTTP/2.0 client connection header to read
|
||||
size_t left_connhd_len_;
|
||||
|
|
|
@ -58,7 +58,7 @@ public:
|
|||
void pause_read(IOCtrlReason reason);
|
||||
int resume_read(IOCtrlReason reason);
|
||||
void force_resume_read();
|
||||
// Set stream ID for downstream SPDY connection.
|
||||
// Set stream ID for downstream HTTP2 connection.
|
||||
void set_downstream_stream_id(int32_t stream_id);
|
||||
int32_t get_downstream_stream_id() const;
|
||||
|
||||
|
@ -213,9 +213,9 @@ private:
|
|||
Headers response_headers_;
|
||||
bool response_header_key_prev_;
|
||||
// This buffer is used to temporarily store downstream response
|
||||
// body. Spdylay reads data from this in the callback.
|
||||
// body. nghttp2 library reads data from this in the callback.
|
||||
evbuffer *response_body_buf_;
|
||||
// RST_STREAM error_code from downstream SPDY connection
|
||||
// RST_STREAM error_code from downstream HTTP2 connection
|
||||
nghttp2_error_code response_rst_stream_error_code_;
|
||||
int32_t recv_window_size_;
|
||||
};
|
||||
|
|
|
@ -45,7 +45,7 @@ using namespace nghttp2;
|
|||
namespace shrpx {
|
||||
|
||||
namespace {
|
||||
const size_t SHRPX_SPDY_UPSTREAM_OUTPUT_UPPER_THRES = 64*1024;
|
||||
const size_t SHRPX_HTTP2_UPSTREAM_OUTPUT_UPPER_THRES = 64*1024;
|
||||
} // namespace
|
||||
|
||||
namespace {
|
||||
|
@ -59,7 +59,7 @@ ssize_t send_callback(nghttp2_session *session,
|
|||
auto bev = handler->get_bev();
|
||||
auto output = bufferevent_get_output(bev);
|
||||
// Check buffer length and return WOULDBLOCK if it is large enough.
|
||||
if(evbuffer_get_length(output) > SHRPX_SPDY_UPSTREAM_OUTPUT_UPPER_THRES) {
|
||||
if(evbuffer_get_length(output) > SHRPX_HTTP2_UPSTREAM_OUTPUT_UPPER_THRES) {
|
||||
return NGHTTP2_ERR_WOULDBLOCK;
|
||||
}
|
||||
|
||||
|
@ -539,7 +539,7 @@ int Http2Upstream::on_read()
|
|||
nghttp2_session_want_write(session_) == 0 &&
|
||||
evbuffer_get_length(bufferevent_get_output(handler_->get_bev())) == 0) {
|
||||
if(LOG_ENABLED(INFO)) {
|
||||
ULOG(INFO, this) << "No more read/write for this SPDY session";
|
||||
ULOG(INFO, this) << "No more read/write for this HTTP2 session";
|
||||
}
|
||||
rv = -1;
|
||||
}
|
||||
|
@ -565,7 +565,7 @@ int Http2Upstream::send()
|
|||
nghttp2_session_want_write(session_) == 0 &&
|
||||
evbuffer_get_length(bufferevent_get_output(handler_->get_bev())) == 0) {
|
||||
if(LOG_ENABLED(INFO)) {
|
||||
ULOG(INFO, this) << "No more read/write for this SPDY session";
|
||||
ULOG(INFO, this) << "No more read/write for this HTTP2 session";
|
||||
}
|
||||
rv = -1;
|
||||
}
|
||||
|
@ -590,7 +590,7 @@ void downstream_readcb(bufferevent *bev, void *ptr)
|
|||
auto downstream = dconn->get_downstream();
|
||||
auto upstream = static_cast<Http2Upstream*>(downstream->get_upstream());
|
||||
if(downstream->get_request_state() == Downstream::STREAM_CLOSED) {
|
||||
// If upstream SPDY stream was closed, we just close downstream,
|
||||
// If upstream HTTP2 stream was closed, we just close downstream,
|
||||
// because there is no consumer now. Downstream connection is also
|
||||
// closed in this case.
|
||||
upstream->remove_downstream(downstream);
|
||||
|
@ -1005,7 +1005,7 @@ int Http2Upstream::on_downstream_body(Downstream *downstream,
|
|||
nghttp2_session_resume_data(session_, downstream->get_stream_id());
|
||||
|
||||
size_t bodylen = evbuffer_get_length(body);
|
||||
if(bodylen > SHRPX_SPDY_UPSTREAM_OUTPUT_UPPER_THRES) {
|
||||
if(bodylen > SHRPX_HTTP2_UPSTREAM_OUTPUT_UPPER_THRES) {
|
||||
downstream->pause_read(SHRPX_NO_BUFFER);
|
||||
}
|
||||
|
||||
|
|
|
@ -422,8 +422,8 @@ void https_downstream_readcb(bufferevent *bev, void *ptr)
|
|||
}
|
||||
}
|
||||
} else if(downstream->get_upgraded()) {
|
||||
// This path is effectively only taken for SPDY downstream
|
||||
// because only SPDY downstream sets response_state to
|
||||
// This path is effectively only taken for HTTP2 downstream
|
||||
// because only HTTP2 downstream sets response_state to
|
||||
// MSG_COMPLETE and this function. For HTTP downstream, EOF
|
||||
// from tunnel connection is handled on
|
||||
// https_downstream_eventcb.
|
||||
|
|
|
@ -64,9 +64,9 @@ namespace shrpx {
|
|||
#define DCLOG(SEVERITY, DCONN) \
|
||||
(Log(SEVERITY, __FILE__, __LINE__) << "[DCONN:" << DCONN << "] ")
|
||||
|
||||
// Downstream SPDY session log
|
||||
#define SSLOG(SEVERITY, SPDY) \
|
||||
(Log(SEVERITY, __FILE__, __LINE__) << "[DSPDY:" << SPDY << "] ")
|
||||
// Downstream HTTP2 session log
|
||||
#define SSLOG(SEVERITY, HTTP2) \
|
||||
(Log(SEVERITY, __FILE__, __LINE__) << "[DHTTP2:" << HTTP2 << "] ")
|
||||
|
||||
enum SeverityLevel {
|
||||
INFO, WARNING, ERROR, FATAL
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Spdylay - SPDY Library
|
||||
* nghttp2 - HTTP/2.0 C Library
|
||||
*
|
||||
* Copyright (c) 2012 Tatsuhiro Tsujikawa
|
||||
*
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Spdylay - SPDY Library
|
||||
* nghttp2 - HTTP/2.0 C Library
|
||||
*
|
||||
* Copyright (c) 2012 Tatsuhiro Tsujikawa
|
||||
*
|
||||
|
|
Loading…
Reference in New Issue