mirror of
https://gitee.com/openharmony/third_party_nghttp2
synced 2024-11-27 18:10:47 +00:00
Adjust struct/class alignment
This commit is contained in:
parent
58dd118c89
commit
6ea91e57e0
@ -64,8 +64,9 @@ struct Connection {
|
||||
};
|
||||
|
||||
struct Request {
|
||||
/* The gzip stream inflater for the compressed response. */
|
||||
nghttp2_gzip *inflater;
|
||||
char *host;
|
||||
uint16_t port;
|
||||
/* In this program, path contains query component as well. */
|
||||
char *path;
|
||||
/* This is the concatenation of host and port with ":" in
|
||||
@ -73,19 +74,18 @@ struct Request {
|
||||
char *hostport;
|
||||
/* Stream ID for this request. */
|
||||
int32_t stream_id;
|
||||
/* The gzip stream inflater for the compressed response. */
|
||||
nghttp2_gzip *inflater;
|
||||
uint16_t port;
|
||||
};
|
||||
|
||||
struct URI {
|
||||
const char *host;
|
||||
size_t hostlen;
|
||||
uint16_t port;
|
||||
/* In this program, path contains query component as well. */
|
||||
const char *path;
|
||||
size_t pathlen;
|
||||
const char *hostport;
|
||||
size_t hostlen;
|
||||
size_t hostportlen;
|
||||
uint16_t port;
|
||||
};
|
||||
|
||||
/*
|
||||
|
@ -38,9 +38,9 @@
|
||||
#include "comp_helper.h"
|
||||
|
||||
typedef struct {
|
||||
nghttp2_hd_side side;
|
||||
size_t table_size;
|
||||
size_t deflate_table_size;
|
||||
nghttp2_hd_side side;
|
||||
int http1text;
|
||||
int dump_header_table;
|
||||
int no_refset;
|
||||
|
@ -38,8 +38,8 @@
|
||||
#include "comp_helper.h"
|
||||
|
||||
typedef struct {
|
||||
nghttp2_hd_side side;
|
||||
size_t table_size;
|
||||
nghttp2_hd_side side;
|
||||
int dump_header_table;
|
||||
} inflate_config;
|
||||
|
||||
|
@ -616,10 +616,6 @@ typedef struct {
|
||||
* The frame header.
|
||||
*/
|
||||
nghttp2_frame_hd hd;
|
||||
/**
|
||||
* The priority.
|
||||
*/
|
||||
int32_t pri;
|
||||
/**
|
||||
* The name/value pairs.
|
||||
*/
|
||||
@ -628,6 +624,10 @@ typedef struct {
|
||||
* The number of name/value pairs in |nva|.
|
||||
*/
|
||||
size_t nvlen;
|
||||
/**
|
||||
* The priority.
|
||||
*/
|
||||
int32_t pri;
|
||||
nghttp2_headers_category cat;
|
||||
} nghttp2_headers;
|
||||
|
||||
@ -704,10 +704,6 @@ typedef struct {
|
||||
* The frame header.
|
||||
*/
|
||||
nghttp2_frame_hd hd;
|
||||
/**
|
||||
* The promised stream ID
|
||||
*/
|
||||
int32_t promised_stream_id;
|
||||
/**
|
||||
* The name/value pairs.
|
||||
*/
|
||||
@ -716,6 +712,10 @@ typedef struct {
|
||||
* The number of name/value pairs in |nva|.
|
||||
*/
|
||||
size_t nvlen;
|
||||
/**
|
||||
* The promised stream ID
|
||||
*/
|
||||
int32_t promised_stream_id;
|
||||
} nghttp2_push_promise;
|
||||
|
||||
/**
|
||||
@ -1282,6 +1282,10 @@ typedef enum {
|
||||
* Struct to store option values for nghttp2_session.
|
||||
*/
|
||||
typedef struct {
|
||||
/**
|
||||
* :enum:`NGHTTP2_OPT_PEER_MAX_CONCURRENT_STREAMS`
|
||||
*/
|
||||
uint32_t peer_max_concurrent_streams;
|
||||
/**
|
||||
* :enum:`NGHTTP2_OPT_NO_AUTO_STREAM_WINDOW_UPDATE`
|
||||
*/
|
||||
@ -1290,10 +1294,6 @@ typedef struct {
|
||||
* :enum:`NGHTTP2_OPT_NO_AUTO_CONNECTION_WINDOW_UPDATE`
|
||||
*/
|
||||
uint8_t no_auto_connection_window_update;
|
||||
/**
|
||||
* :enum:`NGHTTP2_OPT_PEER_MAX_CONCURRENT_STREAMS`
|
||||
*/
|
||||
uint32_t peer_max_concurrent_streams;
|
||||
} nghttp2_opt_set;
|
||||
|
||||
/**
|
||||
|
@ -66,16 +66,16 @@ typedef enum {
|
||||
*/
|
||||
typedef struct {
|
||||
nghttp2_frame_hd hd;
|
||||
/**
|
||||
* The data to be sent for this DATA frame.
|
||||
*/
|
||||
nghttp2_data_provider data_prd;
|
||||
/**
|
||||
* The flag to indicate whether EOF was reached or not. Initially
|
||||
* |eof| is 0. It becomes 1 after all data were read. This is used
|
||||
* exclusively by nghttp2 library and not in the spec.
|
||||
*/
|
||||
uint8_t eof;
|
||||
/**
|
||||
* The data to be sent for this DATA frame.
|
||||
*/
|
||||
nghttp2_data_provider data_prd;
|
||||
} nghttp2_data;
|
||||
|
||||
int nghttp2_frame_is_data_frame(uint8_t *head);
|
||||
|
@ -118,13 +118,24 @@ typedef struct {
|
||||
size_t deflate_hd_table_bufsize_max;
|
||||
/* The number of effective entry in |hd_table|. */
|
||||
size_t deflate_hd_tablelen;
|
||||
/* The number of entry the |buf_track| contains. */
|
||||
size_t buf_tracklen;
|
||||
/* Holding emitted entry in deflating header block to retain
|
||||
reference count. */
|
||||
nghttp2_hd_entry **emit_set;
|
||||
/* Keep track of allocated buffers in inflation */
|
||||
uint8_t **buf_track;
|
||||
/* Role of this context; deflate or infalte */
|
||||
nghttp2_hd_role role;
|
||||
/* NGHTTP2_HD_SIDE_REQUEST for processing request, otherwise
|
||||
response. */
|
||||
nghttp2_hd_side side;
|
||||
/* The capacity of the |emit_set| */
|
||||
uint16_t emit_set_capacity;
|
||||
/* The number of entry the |emit_set| contains */
|
||||
uint16_t emit_setlen;
|
||||
/* The capacity of |buf_track| */
|
||||
uint16_t buf_track_capacity;
|
||||
/* If inflate/deflate error occurred, this value is set to 1 and
|
||||
further invocation of inflate/deflate will fail with
|
||||
NGHTTP2_ERR_HEADER_COMP. */
|
||||
@ -132,17 +143,6 @@ typedef struct {
|
||||
/* Set to this nonzero to clear reference set on each deflation each
|
||||
time. */
|
||||
uint8_t no_refset;
|
||||
/* Role of this context; deflate or infalte */
|
||||
nghttp2_hd_role role;
|
||||
/* NGHTTP2_HD_SIDE_REQUEST for processing request, otherwise
|
||||
response. */
|
||||
nghttp2_hd_side side;
|
||||
/* Keep track of allocated buffers in inflation */
|
||||
uint8_t **buf_track;
|
||||
/* The capacity of |buf_track| */
|
||||
uint16_t buf_track_capacity;
|
||||
/* The number of entry the |buf_track| contains. */
|
||||
size_t buf_tracklen;
|
||||
} nghttp2_hd_context;
|
||||
|
||||
/*
|
||||
|
@ -37,8 +37,8 @@
|
||||
typedef uint32_t key_type;
|
||||
|
||||
typedef struct nghttp2_map_entry {
|
||||
key_type key;
|
||||
struct nghttp2_map_entry *next;
|
||||
key_type key;
|
||||
} nghttp2_map_entry;
|
||||
|
||||
typedef struct {
|
||||
|
@ -43,18 +43,18 @@ typedef struct {
|
||||
} nghttp2_headers_aux_data;
|
||||
|
||||
typedef struct {
|
||||
int64_t seq;
|
||||
void *frame;
|
||||
void *aux_data;
|
||||
/* Type of |frame|. NGHTTP2_CTRL: nghttp2_frame*, NGHTTP2_DATA:
|
||||
nghttp2_data* */
|
||||
nghttp2_frame_category frame_cat;
|
||||
void *frame;
|
||||
void *aux_data;
|
||||
/* The priority used in priority comparion */
|
||||
int32_t pri;
|
||||
/* The initial priority */
|
||||
int32_t inipri;
|
||||
/* The amount of priority decrement in next time */
|
||||
uint32_t pri_decay;
|
||||
int64_t seq;
|
||||
} nghttp2_outbound_item;
|
||||
|
||||
/*
|
||||
|
@ -81,12 +81,10 @@ typedef enum {
|
||||
|
||||
typedef struct {
|
||||
nghttp2_frame frame;
|
||||
nghttp2_inbound_state state;
|
||||
uint8_t headbuf[NGHTTP2_FRAME_HEAD_LENGTH];
|
||||
/* How many bytes are filled in headbuf */
|
||||
size_t headbufoff;
|
||||
/* Payload for non-DATA frames. */
|
||||
uint8_t *buf;
|
||||
/* How many bytes are filled in headbuf */
|
||||
size_t headbufoff;
|
||||
/* Capacity of buf */
|
||||
size_t bufmax;
|
||||
/* For frames without name/value header block, this is how many
|
||||
@ -100,8 +98,10 @@ typedef struct {
|
||||
/* How many bytes are received for this frame. off <= payloadlen
|
||||
must be fulfilled. */
|
||||
size_t off;
|
||||
nghttp2_inbound_state state;
|
||||
/* Error code */
|
||||
int error_code;
|
||||
uint8_t headbuf[NGHTTP2_FRAME_HEAD_LENGTH];
|
||||
} nghttp2_inbound_frame;
|
||||
|
||||
typedef enum {
|
||||
@ -115,7 +115,37 @@ typedef enum {
|
||||
} nghttp2_goaway_flag;
|
||||
|
||||
struct nghttp2_session {
|
||||
uint8_t server;
|
||||
nghttp2_map /* <nghttp2_stream*> */ streams;
|
||||
/* Queue for outbound frames other than stream-creating HEADERS */
|
||||
nghttp2_pq /* <nghttp2_outbound_item*> */ ob_pq;
|
||||
/* Queue for outbound stream-creating HEADERS frame */
|
||||
nghttp2_pq /* <nghttp2_outbound_item*> */ ob_ss_pq;
|
||||
nghttp2_active_outbound_item aob;
|
||||
nghttp2_inbound_frame iframe;
|
||||
nghttp2_hd_context hd_deflater;
|
||||
nghttp2_hd_context hd_inflater;
|
||||
nghttp2_session_callbacks callbacks;
|
||||
/* Sequence number of outbound frame to maintain the order of
|
||||
enqueue if priority is equal. */
|
||||
int64_t next_seq;
|
||||
/* Buffer used to store inflated name/value pairs in wire format
|
||||
temporarily on pack/unpack. */
|
||||
uint8_t *nvbuf;
|
||||
void *user_data;
|
||||
/* In-flight SETTINGS values. NULL does not necessarily mean there
|
||||
is no in-flight SETTINGS. */
|
||||
nghttp2_settings_entry *inflight_iv;
|
||||
/* The number of entries in |inflight_iv|. -1 if there is no
|
||||
in-flight SETTINGS. */
|
||||
ssize_t inflight_niv;
|
||||
/* The number of outgoing streams. This will be capped by
|
||||
remote_settings[NGHTTP2_SETTINGS_MAX_CONCURRENT_STREAMS]. */
|
||||
size_t num_outgoing_streams;
|
||||
/* The number of incoming streams. This will be capped by
|
||||
local_settings[NGHTTP2_SETTINGS_MAX_CONCURRENT_STREAMS]. */
|
||||
size_t num_incoming_streams;
|
||||
/* The number of bytes allocated for nvbuf */
|
||||
size_t nvbuflen;
|
||||
/* Next Stream ID. Made unsigned int to detect >= (1 << 31). */
|
||||
uint32_t next_stream_id;
|
||||
/* The largest stream ID received so far */
|
||||
@ -127,51 +157,8 @@ struct nghttp2_session {
|
||||
/* Counter of unique ID of PING. Wraps when it exceeds
|
||||
NGHTTP2_MAX_UNIQUE_ID */
|
||||
uint32_t next_unique_id;
|
||||
|
||||
/* Sequence number of outbound frame to maintain the order of
|
||||
enqueue if priority is equal. */
|
||||
int64_t next_seq;
|
||||
|
||||
nghttp2_map /* <nghttp2_stream*> */ streams;
|
||||
/* The number of outgoing streams. This will be capped by
|
||||
remote_settings[NGHTTP2_SETTINGS_MAX_CONCURRENT_STREAMS]. */
|
||||
size_t num_outgoing_streams;
|
||||
/* The number of incoming streams. This will be capped by
|
||||
local_settings[NGHTTP2_SETTINGS_MAX_CONCURRENT_STREAMS]. */
|
||||
size_t num_incoming_streams;
|
||||
|
||||
/* Queue for outbound frames other than stream-creating HEADERS */
|
||||
nghttp2_pq /* <nghttp2_outbound_item*> */ ob_pq;
|
||||
/* Queue for outbound stream-creating HEADERS frame */
|
||||
nghttp2_pq /* <nghttp2_outbound_item*> */ ob_ss_pq;
|
||||
|
||||
nghttp2_active_outbound_item aob;
|
||||
|
||||
nghttp2_inbound_frame iframe;
|
||||
|
||||
/* Buffer used to store inflated name/value pairs in wire format
|
||||
temporarily on pack/unpack. */
|
||||
uint8_t *nvbuf;
|
||||
/* The number of bytes allocated for nvbuf */
|
||||
size_t nvbuflen;
|
||||
|
||||
nghttp2_hd_context hd_deflater;
|
||||
nghttp2_hd_context hd_inflater;
|
||||
|
||||
/* Flags indicating GOAWAY is sent and/or recieved. The flags are
|
||||
composed by bitwise OR-ing nghttp2_goaway_flag. */
|
||||
uint8_t goaway_flags;
|
||||
/* This is the value in GOAWAY frame received from remote endpoint. */
|
||||
int32_t last_stream_id;
|
||||
|
||||
/* Non-zero indicates connection-level flow control on remote side
|
||||
is in effect. This will be disabled when WINDOW_UPDATE with
|
||||
END_FLOW_CONTROL bit set is received. */
|
||||
uint8_t remote_flow_control;
|
||||
/* Non-zero indicates connection-level flow control on local side is
|
||||
in effect. This will be disabled when WINDOW_UPDATE with
|
||||
END_FLOW_CONTROL bit set is sent. */
|
||||
uint8_t local_flow_control;
|
||||
/* Current sender window size. This value is computed against the
|
||||
current initial window size of remote endpoint. */
|
||||
int32_t remote_window_size;
|
||||
@ -187,25 +174,26 @@ struct nghttp2_session {
|
||||
increased/decreased by submitting WINDOW_UPDATE. See
|
||||
nghttp2_submit_window_update(). */
|
||||
int32_t local_window_size;
|
||||
|
||||
/* Settings value received from the remote endpoint. We just use ID
|
||||
as index. The index = 0 is unused. */
|
||||
uint32_t remote_settings[NGHTTP2_SETTINGS_MAX+1];
|
||||
/* Settings value of the local endpoint. */
|
||||
uint32_t local_settings[NGHTTP2_SETTINGS_MAX+1];
|
||||
|
||||
/* In-flight SETTINGS values. NULL does not necessarily mean there
|
||||
is no in-flight SETTINGS. */
|
||||
nghttp2_settings_entry *inflight_iv;
|
||||
/* The number of entries in |inflight_iv|. -1 if there is no
|
||||
in-flight SETTINGS. */
|
||||
ssize_t inflight_niv;
|
||||
|
||||
/* Option flags. This is bitwise-OR of 0 or more of nghttp2_optmask. */
|
||||
uint32_t opt_flags;
|
||||
|
||||
nghttp2_session_callbacks callbacks;
|
||||
void *user_data;
|
||||
/* Nonzero if the session is server side. */
|
||||
uint8_t server;
|
||||
/* Flags indicating GOAWAY is sent and/or recieved. The flags are
|
||||
composed by bitwise OR-ing nghttp2_goaway_flag. */
|
||||
uint8_t goaway_flags;
|
||||
/* Non-zero indicates connection-level flow control on remote side
|
||||
is in effect. This will be disabled when WINDOW_UPDATE with
|
||||
END_FLOW_CONTROL bit set is received. */
|
||||
uint8_t remote_flow_control;
|
||||
/* Non-zero indicates connection-level flow control on local side is
|
||||
in effect. This will be disabled when WINDOW_UPDATE with
|
||||
END_FLOW_CONTROL bit set is sent. */
|
||||
uint8_t local_flow_control;
|
||||
};
|
||||
|
||||
/* Struct used when updating initial window size of each active
|
||||
|
@ -81,19 +81,33 @@ typedef enum {
|
||||
typedef struct {
|
||||
/* Intrusive Map */
|
||||
nghttp2_map_entry map_entry;
|
||||
/* stream ID */
|
||||
int32_t stream_id;
|
||||
nghttp2_stream_state state;
|
||||
/* Use same value in SYN_STREAM frame */
|
||||
uint8_t flags;
|
||||
/* Use same value in SYN_STREAM frame */
|
||||
int32_t pri;
|
||||
/* Bitwise OR of zero or more nghttp2_shut_flag values */
|
||||
uint8_t shut_flags;
|
||||
/* The arbitrary data provided by user for this stream. */
|
||||
void *stream_user_data;
|
||||
/* Deferred DATA frame */
|
||||
nghttp2_outbound_item *deferred_data;
|
||||
/* stream ID */
|
||||
int32_t stream_id;
|
||||
/* Use same value in SYN_STREAM frame */
|
||||
int32_t pri;
|
||||
/* Current remote window size. This value is computed against the
|
||||
current initial window size of remote endpoint. */
|
||||
int32_t remote_window_size;
|
||||
/* Keep track of the number of bytes received without
|
||||
WINDOW_UPDATE. This could be negative after submitting negative
|
||||
value to WINDOW_UPDATE */
|
||||
int32_t recv_window_size;
|
||||
/* The amount of recv_window_size cut using submitting negative
|
||||
value to WINDOW_UPDATE */
|
||||
int32_t recv_reduction;
|
||||
/* window size for local flow control. It is initially set to
|
||||
NGHTTP2_INITIAL_WINDOW_SIZE and could be increased/decreased by
|
||||
submitting WINDOW_UPDATE. See nghttp2_submit_window_update(). */
|
||||
int32_t local_window_size;
|
||||
nghttp2_stream_state state;
|
||||
/* Use same value in SYN_STREAM frame */
|
||||
uint8_t flags;
|
||||
/* Bitwise OR of zero or more nghttp2_shut_flag values */
|
||||
uint8_t shut_flags;
|
||||
/* The flags for defered DATA. Bitwise OR of zero or more
|
||||
nghttp2_deferred_flag values */
|
||||
uint8_t deferred_flags;
|
||||
@ -109,20 +123,6 @@ typedef struct {
|
||||
flow control options off or sending WINDOW_UPDATE with
|
||||
END_FLOW_CONTROL bit set. */
|
||||
uint8_t local_flow_control;
|
||||
/* Current remote window size. This value is computed against the
|
||||
current initial window size of remote endpoint. */
|
||||
int32_t remote_window_size;
|
||||
/* Keep track of the number of bytes received without
|
||||
WINDOW_UPDATE. This could be negative after submitting negative
|
||||
value to WINDOW_UPDATE */
|
||||
int32_t recv_window_size;
|
||||
/* The amount of recv_window_size cut using submitting negative
|
||||
value to WINDOW_UPDATE */
|
||||
int32_t recv_reduction;
|
||||
/* window size for local flow control. It is initially set to
|
||||
NGHTTP2_INITIAL_WINDOW_SIZE and could be increased/decreased by
|
||||
submitting WINDOW_UPDATE. See nghttp2_submit_window_update(). */
|
||||
int32_t local_window_size;
|
||||
} nghttp2_stream;
|
||||
|
||||
void nghttp2_stream_init(nghttp2_stream *stream, int32_t stream_id,
|
||||
|
@ -64,16 +64,16 @@ const std::string NGHTTPD_SERVER = "nghttpd nghttp2/" NGHTTP2_VERSION;
|
||||
} // namespace
|
||||
|
||||
Config::Config()
|
||||
: verbose(false),
|
||||
daemon(false),
|
||||
port(0),
|
||||
: data_ptr(nullptr),
|
||||
on_request_recv_callback(nullptr),
|
||||
data_ptr(nullptr),
|
||||
output_upper_thres(1024*1024),
|
||||
header_table_size(-1),
|
||||
port(0),
|
||||
verbose(false),
|
||||
daemon(false),
|
||||
verify_client(false),
|
||||
no_tls(false),
|
||||
no_flow_control(false),
|
||||
output_upper_thres(1024*1024),
|
||||
header_table_size(-1)
|
||||
no_flow_control(false)
|
||||
{}
|
||||
|
||||
Request::Request(int32_t stream_id)
|
||||
@ -175,10 +175,14 @@ void fill_callback(nghttp2_session_callbacks& callbacks, const Config *config);
|
||||
|
||||
Http2Handler::Http2Handler(Sessions *sessions,
|
||||
int fd, SSL *ssl, int64_t session_id)
|
||||
: session_(nullptr), sessions_(sessions), bev_(nullptr), fd_(fd), ssl_(ssl),
|
||||
session_id_(session_id),
|
||||
: session_id_(session_id),
|
||||
session_(nullptr),
|
||||
sessions_(sessions),
|
||||
bev_(nullptr),
|
||||
ssl_(ssl),
|
||||
settings_timerev_(nullptr),
|
||||
left_connhd_len_(NGHTTP2_CLIENT_CONNECTION_HEADER_LEN),
|
||||
settings_timerev_(nullptr)
|
||||
fd_(fd)
|
||||
{}
|
||||
|
||||
Http2Handler::~Http2Handler()
|
||||
|
@ -48,29 +48,29 @@ namespace nghttp2 {
|
||||
|
||||
struct Config {
|
||||
std::string htdocs;
|
||||
bool verbose;
|
||||
bool daemon;
|
||||
std::string host;
|
||||
uint16_t port;
|
||||
std::string private_key_file;
|
||||
std::string cert_file;
|
||||
nghttp2_on_request_recv_callback on_request_recv_callback;
|
||||
void *data_ptr;
|
||||
nghttp2_on_request_recv_callback on_request_recv_callback;
|
||||
size_t output_upper_thres;
|
||||
ssize_t header_table_size;
|
||||
uint16_t port;
|
||||
bool verbose;
|
||||
bool daemon;
|
||||
bool verify_client;
|
||||
bool no_tls;
|
||||
bool no_flow_control;
|
||||
size_t output_upper_thres;
|
||||
ssize_t header_table_size;
|
||||
Config();
|
||||
};
|
||||
|
||||
class Sessions;
|
||||
|
||||
struct Request {
|
||||
int32_t stream_id;
|
||||
std::vector<std::pair<std::string, std::string>> headers;
|
||||
int file;
|
||||
std::pair<std::string, size_t> response_body;
|
||||
int32_t stream_id;
|
||||
int file;
|
||||
Request(int32_t stream_id);
|
||||
~Request();
|
||||
};
|
||||
@ -118,15 +118,15 @@ public:
|
||||
void remove_settings_timer();
|
||||
void submit_goaway(nghttp2_error_code error_code);
|
||||
private:
|
||||
std::map<int32_t, std::unique_ptr<Request>> id2req_;
|
||||
int64_t session_id_;
|
||||
nghttp2_session *session_;
|
||||
Sessions *sessions_;
|
||||
bufferevent *bev_;
|
||||
int fd_;
|
||||
SSL* ssl_;
|
||||
int64_t session_id_;
|
||||
std::map<int32_t, std::unique_ptr<Request>> id2req_;
|
||||
size_t left_connhd_len_;
|
||||
event *settings_timerev_;
|
||||
size_t left_connhd_len_;
|
||||
int fd_;
|
||||
};
|
||||
|
||||
class HttpServer {
|
||||
|
103
src/nghttp.cc
103
src/nghttp.cc
@ -78,6 +78,19 @@ namespace nghttp2 {
|
||||
|
||||
namespace {
|
||||
struct Config {
|
||||
std::vector<std::pair<std::string, std::string>> headers;
|
||||
std::string certfile;
|
||||
std::string keyfile;
|
||||
std::string datafile;
|
||||
size_t output_upper_thres;
|
||||
ssize_t peer_max_concurrent_streams;
|
||||
ssize_t header_table_size;
|
||||
int32_t pri;
|
||||
int multiply;
|
||||
// milliseconds
|
||||
int timeout;
|
||||
int window_bits;
|
||||
int connection_window_bits;
|
||||
bool null_out;
|
||||
bool remote_name;
|
||||
bool verbose;
|
||||
@ -85,35 +98,22 @@ struct Config {
|
||||
bool stat;
|
||||
bool no_flow_control;
|
||||
bool upgrade;
|
||||
int32_t pri;
|
||||
int multiply;
|
||||
// milliseconds
|
||||
int timeout;
|
||||
std::string certfile;
|
||||
std::string keyfile;
|
||||
int window_bits;
|
||||
int connection_window_bits;
|
||||
std::vector<std::pair<std::string, std::string>> headers;
|
||||
std::string datafile;
|
||||
size_t output_upper_thres;
|
||||
ssize_t peer_max_concurrent_streams;
|
||||
ssize_t header_table_size;
|
||||
Config()
|
||||
: null_out(false),
|
||||
remote_name(false),
|
||||
verbose(false),
|
||||
get_assets(false),
|
||||
stat(false),
|
||||
no_flow_control(false),
|
||||
upgrade(false),
|
||||
: output_upper_thres(1024*1024),
|
||||
peer_max_concurrent_streams(NGHTTP2_INITIAL_MAX_CONCURRENT_STREAMS),
|
||||
header_table_size(-1),
|
||||
pri(NGHTTP2_PRI_DEFAULT),
|
||||
multiply(1),
|
||||
timeout(-1),
|
||||
window_bits(-1),
|
||||
connection_window_bits(-1),
|
||||
output_upper_thres(1024*1024),
|
||||
peer_max_concurrent_streams(NGHTTP2_INITIAL_MAX_CONCURRENT_STREAMS),
|
||||
header_table_size(-1)
|
||||
null_out(false),
|
||||
remote_name(false),
|
||||
verbose(false),
|
||||
get_assets(false),
|
||||
stat(false),
|
||||
no_flow_control(false),
|
||||
upgrade(false)
|
||||
{}
|
||||
};
|
||||
} // namespace
|
||||
@ -248,23 +248,28 @@ namespace {
|
||||
struct Request {
|
||||
// URI without fragment
|
||||
std::string uri;
|
||||
std::string status;
|
||||
http_parser_url u;
|
||||
RequestStat stat;
|
||||
int64_t data_length;
|
||||
int64_t data_offset;
|
||||
nghttp2_gzip *inflater;
|
||||
HtmlParser *html_parser;
|
||||
const nghttp2_data_provider *data_prd;
|
||||
int64_t data_length;
|
||||
int64_t data_offset;
|
||||
int32_t pri;
|
||||
// Recursion level: 0: first entity, 1: entity linked from first entity
|
||||
int level;
|
||||
RequestStat stat;
|
||||
std::string status;
|
||||
Request(const std::string& uri, const http_parser_url &u,
|
||||
const nghttp2_data_provider *data_prd, int64_t data_length,
|
||||
int32_t pri, int level = 0)
|
||||
: uri(uri), u(u),
|
||||
inflater(nullptr), html_parser(nullptr), data_prd(data_prd),
|
||||
data_length(data_length), data_offset(0), pri(pri),
|
||||
: uri(uri),
|
||||
u(u),
|
||||
data_length(data_length),
|
||||
data_offset(0),
|
||||
inflater(nullptr),
|
||||
html_parser(nullptr),
|
||||
data_prd(data_prd),
|
||||
pri(pri),
|
||||
level(level)
|
||||
{}
|
||||
|
||||
@ -422,6 +427,17 @@ enum client_state {
|
||||
|
||||
namespace {
|
||||
struct HttpClient {
|
||||
std::vector<std::unique_ptr<Request>> reqvec;
|
||||
// Map from stream ID to Request object.
|
||||
std::map<int32_t, Request*> streams;
|
||||
// Insert path already added in reqvec to prevent multiple request
|
||||
// for 1 resource.
|
||||
std::set<std::string> path_cache;
|
||||
std::string scheme;
|
||||
std::string hostport;
|
||||
// Used for parse the HTTP upgrade response from server
|
||||
std::unique_ptr<http_parser> htp;
|
||||
SessionStat stat;
|
||||
nghttp2_session *session;
|
||||
const nghttp2_session_callbacks *callbacks;
|
||||
event_base *evbase;
|
||||
@ -430,29 +446,18 @@ struct HttpClient {
|
||||
SSL *ssl;
|
||||
bufferevent *bev;
|
||||
event *settings_timerev;
|
||||
client_state state;
|
||||
std::vector<std::unique_ptr<Request>> reqvec;
|
||||
// Map from stream ID to Request object.
|
||||
std::map<int32_t, Request*> streams;
|
||||
// Insert path already added in reqvec to prevent multiple request
|
||||
// for 1 resource.
|
||||
std::set<std::string> path_cache;
|
||||
// The number of completed requests, including failed ones.
|
||||
size_t complete;
|
||||
std::string scheme;
|
||||
std::string hostport;
|
||||
SessionStat stat;
|
||||
// Used for parse the HTTP upgrade response from server
|
||||
std::unique_ptr<http_parser> htp;
|
||||
// The length of settings_payload
|
||||
size_t settings_payloadlen;
|
||||
client_state state;
|
||||
// The HTTP status code of the response message of HTTP Upgrade.
|
||||
unsigned int upgrade_response_status_code;
|
||||
// true if the response message of HTTP Upgrade request is fully
|
||||
// received. It is not relevant the upgrade succeeds, or not.
|
||||
bool upgrade_response_complete;
|
||||
// The HTTP status code of the response message of HTTP Upgrade.
|
||||
unsigned int upgrade_response_status_code;
|
||||
// SETTINGS payload sent as token68 in HTTP Upgrade
|
||||
uint8_t settings_payload[16];
|
||||
// The length of settings_payload
|
||||
size_t settings_payloadlen;
|
||||
|
||||
HttpClient(const nghttp2_session_callbacks* callbacks,
|
||||
event_base *evbase, SSL_CTX *ssl_ctx)
|
||||
@ -464,11 +469,11 @@ struct HttpClient {
|
||||
ssl(nullptr),
|
||||
bev(nullptr),
|
||||
settings_timerev(nullptr),
|
||||
state(STATE_IDLE),
|
||||
complete(0),
|
||||
upgrade_response_complete(false),
|
||||
settings_payloadlen(0),
|
||||
state(STATE_IDLE),
|
||||
upgrade_response_status_code(0),
|
||||
settings_payloadlen(0)
|
||||
upgrade_response_complete(false)
|
||||
{}
|
||||
|
||||
~HttpClient()
|
||||
|
@ -213,13 +213,13 @@ void upstream_http1_connhd_readcb(bufferevent *bev, void *arg)
|
||||
|
||||
ClientHandler::ClientHandler(bufferevent *bev, int fd, SSL *ssl,
|
||||
const char *ipaddr)
|
||||
: bev_(bev),
|
||||
fd_(fd),
|
||||
ssl_(ssl),
|
||||
ipaddr_(ipaddr),
|
||||
should_close_after_write_(false),
|
||||
: ipaddr_(ipaddr),
|
||||
bev_(bev),
|
||||
http2session_(nullptr),
|
||||
left_connhd_len_(NGHTTP2_CLIENT_CONNECTION_HEADER_LEN)
|
||||
ssl_(ssl),
|
||||
left_connhd_len_(NGHTTP2_CLIENT_CONNECTION_HEADER_LEN),
|
||||
fd_(fd),
|
||||
should_close_after_write_(false)
|
||||
{
|
||||
bufferevent_set_rate_limit(bev_, get_config()->rate_limit_cfg);
|
||||
bufferevent_enable(bev_, EV_READ | EV_WRITE);
|
||||
|
@ -76,18 +76,18 @@ public:
|
||||
int perform_http2_upgrade(HttpsUpstream *http);
|
||||
bool get_http2_upgrade_allowed() const;
|
||||
private:
|
||||
bufferevent *bev_;
|
||||
int fd_;
|
||||
SSL *ssl_;
|
||||
std::set<DownstreamConnection*> dconn_pool_;
|
||||
std::unique_ptr<Upstream> upstream_;
|
||||
std::string ipaddr_;
|
||||
bool should_close_after_write_;
|
||||
std::set<DownstreamConnection*> dconn_pool_;
|
||||
bufferevent *bev_;
|
||||
// Shared HTTP2 session for each thread. NULL if backend is not
|
||||
// HTTP2. Not deleted by this object.
|
||||
Http2Session *http2session_;
|
||||
SSL *ssl_;
|
||||
// The number of bytes of HTTP/2.0 client connection header to read
|
||||
size_t left_connhd_len_;
|
||||
int fd_;
|
||||
bool should_close_after_write_;
|
||||
};
|
||||
|
||||
} // namespace shrpx
|
||||
|
@ -115,89 +115,41 @@ enum shrpx_proto {
|
||||
};
|
||||
|
||||
struct Config {
|
||||
bool verbose;
|
||||
bool daemon;
|
||||
char *host;
|
||||
uint16_t port;
|
||||
char *private_key_file;
|
||||
char *private_key_passwd;
|
||||
char *cert_file;
|
||||
char *dh_param_file;
|
||||
SSL_CTX *default_ssl_ctx;
|
||||
ssl::CertLookupTree *cert_tree;
|
||||
bool verify_client;
|
||||
const char *server_name;
|
||||
char *downstream_host;
|
||||
uint16_t downstream_port;
|
||||
char *downstream_hostport;
|
||||
// The list of (private key file, certificate file) pair
|
||||
std::vector<std::pair<std::string, std::string>> subcerts;
|
||||
sockaddr_union downstream_addr;
|
||||
size_t downstream_addrlen;
|
||||
// binary form of http proxy host and port
|
||||
sockaddr_union downstream_http_proxy_addr;
|
||||
timeval http2_upstream_read_timeout;
|
||||
timeval upstream_read_timeout;
|
||||
timeval upstream_write_timeout;
|
||||
timeval downstream_read_timeout;
|
||||
timeval downstream_write_timeout;
|
||||
timeval downstream_idle_read_timeout;
|
||||
size_t num_worker;
|
||||
size_t http2_max_concurrent_streams;
|
||||
bool http2_proxy;
|
||||
bool http2_bridge;
|
||||
bool client_proxy;
|
||||
bool add_x_forwarded_for;
|
||||
bool no_via;
|
||||
bool accesslog;
|
||||
size_t http2_upstream_window_bits;
|
||||
size_t http2_downstream_window_bits;
|
||||
size_t http2_upstream_connection_window_bits;
|
||||
size_t http2_downstream_connection_window_bits;
|
||||
bool upstream_no_tls;
|
||||
bool downstream_no_tls;
|
||||
char *host;
|
||||
char *private_key_file;
|
||||
char *private_key_passwd;
|
||||
char *cert_file;
|
||||
char *dh_param_file;
|
||||
SSL_CTX *default_ssl_ctx;
|
||||
ssl::CertLookupTree *cert_tree;
|
||||
const char *server_name;
|
||||
char *downstream_host;
|
||||
char *downstream_hostport;
|
||||
char *backend_tls_sni_name;
|
||||
char *pid_file;
|
||||
uid_t uid;
|
||||
gid_t gid;
|
||||
char *conf_path;
|
||||
bool syslog;
|
||||
int syslog_facility;
|
||||
// This member finally decides syslog is used or not
|
||||
bool use_syslog;
|
||||
int backlog;
|
||||
char *ciphers;
|
||||
bool honor_cipher_order;
|
||||
bool client;
|
||||
// true if --client or --client-proxy are enabled.
|
||||
bool client_mode;
|
||||
// downstream protocol; this will be determined by given options.
|
||||
shrpx_proto downstream_proto;
|
||||
bool insecure;
|
||||
char *cacert;
|
||||
bool backend_ipv4;
|
||||
bool backend_ipv6;
|
||||
// true if stderr refers to a terminal.
|
||||
bool tty;
|
||||
// userinfo in http proxy URI, not percent-encoded form
|
||||
char *downstream_http_proxy_userinfo;
|
||||
// host in http proxy URI
|
||||
char *downstream_http_proxy_host;
|
||||
// port in http proxy URI
|
||||
uint16_t downstream_http_proxy_port;
|
||||
// binary form of http proxy host and port
|
||||
sockaddr_union downstream_http_proxy_addr;
|
||||
// actual size of downstream_http_proxy_addr
|
||||
size_t downstream_http_proxy_addrlen;
|
||||
// Rate limit configuration
|
||||
ev_token_bucket_cfg *rate_limit_cfg;
|
||||
size_t read_rate;
|
||||
size_t read_burst;
|
||||
size_t write_rate;
|
||||
size_t write_burst;
|
||||
// Comma delimited list of NPN protocol strings in the order of
|
||||
// preference.
|
||||
char **npn_list;
|
||||
// The number of elements in npn_list
|
||||
size_t npn_list_len;
|
||||
// The list of (private key file, certificate file) pair
|
||||
std::vector<std::pair<std::string, std::string>> subcerts;
|
||||
// Path to file containing CA certificate solely used for client
|
||||
// certificate validation
|
||||
char *verify_client_cacert;
|
||||
@ -205,6 +157,54 @@ struct Config {
|
||||
char *client_cert_file;
|
||||
FILE *http2_upstream_dump_request_header;
|
||||
FILE *http2_upstream_dump_response_header;
|
||||
size_t downstream_addrlen;
|
||||
size_t num_worker;
|
||||
size_t http2_max_concurrent_streams;
|
||||
size_t http2_upstream_window_bits;
|
||||
size_t http2_downstream_window_bits;
|
||||
size_t http2_upstream_connection_window_bits;
|
||||
size_t http2_downstream_connection_window_bits;
|
||||
// actual size of downstream_http_proxy_addr
|
||||
size_t downstream_http_proxy_addrlen;
|
||||
size_t read_rate;
|
||||
size_t read_burst;
|
||||
size_t write_rate;
|
||||
size_t write_burst;
|
||||
// The number of elements in npn_list
|
||||
size_t npn_list_len;
|
||||
// downstream protocol; this will be determined by given options.
|
||||
shrpx_proto downstream_proto;
|
||||
int syslog_facility;
|
||||
int backlog;
|
||||
uid_t uid;
|
||||
gid_t gid;
|
||||
uint16_t port;
|
||||
uint16_t downstream_port;
|
||||
// port in http proxy URI
|
||||
uint16_t downstream_http_proxy_port;
|
||||
bool verbose;
|
||||
bool daemon;
|
||||
bool verify_client;
|
||||
bool http2_proxy;
|
||||
bool http2_bridge;
|
||||
bool client_proxy;
|
||||
bool add_x_forwarded_for;
|
||||
bool no_via;
|
||||
bool accesslog;
|
||||
bool upstream_no_tls;
|
||||
bool downstream_no_tls;
|
||||
bool syslog;
|
||||
// This member finally decides syslog is used or not
|
||||
bool use_syslog;
|
||||
bool honor_cipher_order;
|
||||
bool client;
|
||||
// true if --client or --client-proxy are enabled.
|
||||
bool client_mode;
|
||||
bool insecure;
|
||||
bool backend_ipv4;
|
||||
bool backend_ipv6;
|
||||
// true if stderr refers to a terminal.
|
||||
bool tty;
|
||||
bool http2_no_cookie_crumbling;
|
||||
};
|
||||
|
||||
|
@ -38,30 +38,30 @@ using namespace nghttp2;
|
||||
namespace shrpx {
|
||||
|
||||
Downstream::Downstream(Upstream *upstream, int stream_id, int priority)
|
||||
: upstream_(upstream),
|
||||
: request_bodylen_(0),
|
||||
upstream_(upstream),
|
||||
dconn_(nullptr),
|
||||
response_body_buf_(nullptr),
|
||||
stream_id_(stream_id),
|
||||
priority_(priority),
|
||||
downstream_stream_id_(-1),
|
||||
upgrade_request_(false),
|
||||
upgraded_(false),
|
||||
response_rst_stream_error_code_(NGHTTP2_NO_ERROR),
|
||||
request_state_(INITIAL),
|
||||
request_major_(1),
|
||||
request_minor_(1),
|
||||
chunked_request_(false),
|
||||
request_connection_close_(false),
|
||||
request_expect_100_continue_(false),
|
||||
request_header_key_prev_(false),
|
||||
request_bodylen_(0),
|
||||
response_state_(INITIAL),
|
||||
response_http_status_(0),
|
||||
response_major_(1),
|
||||
response_minor_(1),
|
||||
upgrade_request_(false),
|
||||
upgraded_(false),
|
||||
chunked_request_(false),
|
||||
request_connection_close_(false),
|
||||
request_expect_100_continue_(false),
|
||||
request_header_key_prev_(false),
|
||||
chunked_response_(false),
|
||||
response_connection_close_(false),
|
||||
response_header_key_prev_(false),
|
||||
response_body_buf_(nullptr),
|
||||
response_rst_stream_error_code_(NGHTTP2_NO_ERROR)
|
||||
response_header_key_prev_(false)
|
||||
{}
|
||||
|
||||
Downstream::~Downstream()
|
||||
|
@ -178,47 +178,54 @@ public:
|
||||
|
||||
static const size_t OUTPUT_UPPER_THRES = 64*1024;
|
||||
private:
|
||||
Headers request_headers_;
|
||||
Headers response_headers_;
|
||||
|
||||
std::string request_method_;
|
||||
std::string request_path_;
|
||||
std::string request_http2_scheme_;
|
||||
std::string request_http2_authority_;
|
||||
std::string assembled_request_cookie_;
|
||||
// the length of request body
|
||||
int64_t request_bodylen_;
|
||||
|
||||
Upstream *upstream_;
|
||||
DownstreamConnection *dconn_;
|
||||
// This buffer is used to temporarily store downstream response
|
||||
// body. nghttp2 library reads data from this in the callback.
|
||||
evbuffer *response_body_buf_;
|
||||
|
||||
int32_t stream_id_;
|
||||
int32_t priority_;
|
||||
// stream ID in backend connection
|
||||
int32_t downstream_stream_id_;
|
||||
|
||||
// RST_STREAM error_code from downstream HTTP2 connection
|
||||
nghttp2_error_code response_rst_stream_error_code_;
|
||||
|
||||
int request_state_;
|
||||
int request_major_;
|
||||
int request_minor_;
|
||||
|
||||
int response_state_;
|
||||
unsigned int response_http_status_;
|
||||
int response_major_;
|
||||
int response_minor_;
|
||||
|
||||
// true if the request contains upgrade token (HTTP Upgrade or
|
||||
// CONNECT)
|
||||
bool upgrade_request_;
|
||||
// true if the connection is upgraded (HTTP Upgrade or CONNECT)
|
||||
bool upgraded_;
|
||||
|
||||
int request_state_;
|
||||
std::string request_method_;
|
||||
std::string request_path_;
|
||||
std::string request_http2_scheme_;
|
||||
std::string request_http2_authority_;
|
||||
int request_major_;
|
||||
int request_minor_;
|
||||
bool chunked_request_;
|
||||
bool request_connection_close_;
|
||||
bool request_expect_100_continue_;
|
||||
std::string assembled_request_cookie_;
|
||||
Headers request_headers_;
|
||||
bool request_header_key_prev_;
|
||||
// the length of request body
|
||||
int64_t request_bodylen_;
|
||||
|
||||
int response_state_;
|
||||
unsigned int response_http_status_;
|
||||
int response_major_;
|
||||
int response_minor_;
|
||||
bool chunked_response_;
|
||||
bool response_connection_close_;
|
||||
Headers response_headers_;
|
||||
bool response_header_key_prev_;
|
||||
// This buffer is used to temporarily store downstream response
|
||||
// body. nghttp2 library reads data from this in the callback.
|
||||
evbuffer *response_body_buf_;
|
||||
// RST_STREAM error_code from downstream HTTP2 connection
|
||||
nghttp2_error_code response_rst_stream_error_code_;
|
||||
};
|
||||
|
||||
} // namespace shrpx
|
||||
|
@ -52,15 +52,15 @@ Http2Session::Http2Session(event_base *evbase, SSL_CTX *ssl_ctx)
|
||||
: evbase_(evbase),
|
||||
ssl_ctx_(ssl_ctx),
|
||||
ssl_(nullptr),
|
||||
fd_(-1),
|
||||
session_(nullptr),
|
||||
bev_(nullptr),
|
||||
state_(DISCONNECTED),
|
||||
notified_(false),
|
||||
wrbev_(nullptr),
|
||||
rdbev_(nullptr),
|
||||
flow_control_(false),
|
||||
settings_timerev_(nullptr)
|
||||
settings_timerev_(nullptr),
|
||||
fd_(-1),
|
||||
state_(DISCONNECTED),
|
||||
notified_(false),
|
||||
flow_control_(false)
|
||||
{}
|
||||
|
||||
Http2Session::~Http2Session()
|
||||
|
@ -117,27 +117,27 @@ public:
|
||||
CONNECTED
|
||||
};
|
||||
private:
|
||||
std::set<Http2DownstreamConnection*> dconns_;
|
||||
std::set<StreamData*> streams_;
|
||||
// Used to parse the response from HTTP proxy
|
||||
std::unique_ptr<http_parser> proxy_htp_;
|
||||
event_base *evbase_;
|
||||
// NULL if no TLS is configured
|
||||
SSL_CTX *ssl_ctx_;
|
||||
SSL *ssl_;
|
||||
nghttp2_session *session_;
|
||||
bufferevent *bev_;
|
||||
bufferevent *wrbev_;
|
||||
bufferevent *rdbev_;
|
||||
event *settings_timerev_;
|
||||
// fd_ is used for proxy connection and no TLS connection. For
|
||||
// direct or TLS connection, it may be -1 even after connection is
|
||||
// established. Use bufferevent_getfd(bev_) to get file descriptor
|
||||
// in these cases.
|
||||
int fd_;
|
||||
nghttp2_session *session_;
|
||||
bufferevent *bev_;
|
||||
std::set<Http2DownstreamConnection*> dconns_;
|
||||
std::set<StreamData*> streams_;
|
||||
int state_;
|
||||
bool notified_;
|
||||
bufferevent *wrbev_;
|
||||
bufferevent *rdbev_;
|
||||
bool flow_control_;
|
||||
// Used to parse the response from HTTP proxy
|
||||
std::unique_ptr<http_parser> proxy_htp_;
|
||||
event *settings_timerev_;
|
||||
};
|
||||
|
||||
} // namespace shrpx
|
||||
|
@ -80,12 +80,12 @@ public:
|
||||
int start_settings_timer();
|
||||
void stop_settings_timer();
|
||||
private:
|
||||
ClientHandler *handler_;
|
||||
nghttp2_session *session_;
|
||||
bool flow_control_;
|
||||
DownstreamQueue downstream_queue_;
|
||||
std::unique_ptr<HttpsUpstream> pre_upstream_;
|
||||
ClientHandler *handler_;
|
||||
nghttp2_session *session_;
|
||||
event *settings_timerev_;
|
||||
bool flow_control_;
|
||||
};
|
||||
|
||||
} // namespace shrpx
|
||||
|
@ -46,10 +46,10 @@ ListenHandler::ListenHandler(event_base *evbase, SSL_CTX *sv_ssl_ctx,
|
||||
: evbase_(evbase),
|
||||
sv_ssl_ctx_(sv_ssl_ctx),
|
||||
cl_ssl_ctx_(cl_ssl_ctx),
|
||||
worker_round_robin_cnt_(0),
|
||||
workers_(nullptr),
|
||||
http2session_(nullptr),
|
||||
num_worker_(0),
|
||||
http2session_(nullptr)
|
||||
worker_round_robin_cnt_(0)
|
||||
{}
|
||||
|
||||
ListenHandler::~ListenHandler()
|
||||
|
@ -37,10 +37,10 @@
|
||||
namespace shrpx {
|
||||
|
||||
struct WorkerInfo {
|
||||
int sv[2];
|
||||
SSL_CTX *sv_ssl_ctx;
|
||||
SSL_CTX *cl_ssl_ctx;
|
||||
bufferevent *bev;
|
||||
int sv[2];
|
||||
};
|
||||
|
||||
class Http2Session;
|
||||
@ -59,12 +59,12 @@ private:
|
||||
SSL_CTX *sv_ssl_ctx_;
|
||||
// The backend server SSL_CTX
|
||||
SSL_CTX *cl_ssl_ctx_;
|
||||
unsigned int worker_round_robin_cnt_;
|
||||
WorkerInfo *workers_;
|
||||
size_t num_worker_;
|
||||
// Shared backend HTTP2 session. NULL if multi-threaded. In
|
||||
// multi-threaded case, see shrpx_worker.cc.
|
||||
Http2Session *http2session_;
|
||||
size_t num_worker_;
|
||||
unsigned int worker_round_robin_cnt_;
|
||||
};
|
||||
|
||||
} // namespace shrpx
|
||||
|
@ -83,8 +83,8 @@ int severity_to_syslog_level(int severity)
|
||||
}
|
||||
|
||||
Log::Log(int severity, const char *filename, int linenum)
|
||||
: severity_(severity),
|
||||
filename_(filename),
|
||||
: filename_(filename),
|
||||
severity_(severity),
|
||||
linenum_(linenum)
|
||||
{}
|
||||
|
||||
|
@ -88,10 +88,10 @@ public:
|
||||
return severity >= severity_thres_;
|
||||
}
|
||||
private:
|
||||
int severity_;
|
||||
const char *filename_;
|
||||
int linenum_;
|
||||
std::stringstream stream_;
|
||||
const char *filename_;
|
||||
int severity_;
|
||||
int linenum_;
|
||||
static int severity_thres_;
|
||||
};
|
||||
|
||||
|
@ -372,7 +372,7 @@ uint32_t infer_upstream_rst_stream_status_code
|
||||
|
||||
SpdyUpstream::SpdyUpstream(uint16_t version, ClientHandler *handler)
|
||||
: handler_(handler),
|
||||
session_(0)
|
||||
session_(nullptr)
|
||||
{
|
||||
//handler->set_bev_cb(spdy_readcb, 0, spdy_eventcb);
|
||||
handler->set_upstream_timeouts(&get_config()->http2_upstream_read_timeout,
|
||||
|
@ -68,11 +68,11 @@ public:
|
||||
|
||||
bool get_flow_control() const;
|
||||
private:
|
||||
DownstreamQueue downstream_queue_;
|
||||
ClientHandler *handler_;
|
||||
spdylay_session *session_;
|
||||
bool flow_control_;
|
||||
int32_t initial_window_size_;
|
||||
DownstreamQueue downstream_queue_;
|
||||
bool flow_control_;
|
||||
};
|
||||
|
||||
} // namespace shrpx
|
||||
|
@ -38,9 +38,9 @@ namespace shrpx {
|
||||
class Http2Session;
|
||||
|
||||
struct WorkerEvent {
|
||||
evutil_socket_t client_fd;
|
||||
sockaddr_union client_addr;
|
||||
size_t client_addrlen;
|
||||
evutil_socket_t client_fd;
|
||||
};
|
||||
|
||||
class ThreadEventReceiver {
|
||||
|
@ -43,9 +43,9 @@ using namespace nghttp2;
|
||||
namespace shrpx {
|
||||
|
||||
Worker::Worker(WorkerInfo *info)
|
||||
: fd_(info->sv[1]),
|
||||
sv_ssl_ctx_(info->sv_ssl_ctx),
|
||||
cl_ssl_ctx_(info->cl_ssl_ctx)
|
||||
: sv_ssl_ctx_(info->sv_ssl_ctx),
|
||||
cl_ssl_ctx_(info->cl_ssl_ctx),
|
||||
fd_(info->sv[1])
|
||||
{}
|
||||
|
||||
Worker::~Worker()
|
||||
|
@ -40,10 +40,10 @@ public:
|
||||
~Worker();
|
||||
void run();
|
||||
private:
|
||||
// Channel to the main thread
|
||||
int fd_;
|
||||
SSL_CTX *sv_ssl_ctx_;
|
||||
SSL_CTX *cl_ssl_ctx_;
|
||||
// Channel to the main thread
|
||||
int fd_;
|
||||
};
|
||||
|
||||
void start_threaded_worker(WorkerInfo *info);
|
||||
|
Loading…
Reference in New Issue
Block a user