Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
nghttp2
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
nghttp2
Commits
851cbd49
Commit
851cbd49
authored
Jun 04, 2016
by
Tatsuhiro Tsujikawa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
nghttpx: Only parse backend option for API request for now
parent
8288f571
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
163 additions
and
141 deletions
+163
-141
src/shrpx_api_downstream_connection.cc
src/shrpx_api_downstream_connection.cc
+14
-2
src/shrpx_config.cc
src/shrpx_config.cc
+6
-139
src/shrpx_config.h
src/shrpx_config.h
+143
-0
No files found.
src/shrpx_api_downstream_connection.cc
View file @
851cbd49
...
...
@@ -191,8 +191,20 @@ int APIDownstreamConnection::end_upload_data() {
return
0
;
}
if
(
parse_config
(
&
config
,
StringRef
{
first
,
eq
},
StringRef
{
eq
+
1
,
eol
},
include_set
)
!=
0
)
{
auto
opt
=
StringRef
{
first
,
eq
};
auto
optval
=
StringRef
{
eq
+
1
,
eol
};
auto
optid
=
option_lookup_token
(
opt
.
c_str
(),
opt
.
size
());
switch
(
optid
)
{
case
SHRPX_OPTID_BACKEND
:
break
;
default:
first
=
++
eol
;
continue
;
}
if
(
parse_config
(
&
config
,
optid
,
opt
,
optval
,
include_set
)
!=
0
)
{
send_reply
(
400
,
error_body
);
return
0
;
}
...
...
src/shrpx_config.cc
View file @
851cbd49
...
...
@@ -904,142 +904,6 @@ int parse_error_page(std::vector<ErrorPage> &error_pages, const StringRef &opt,
}
}
// namespace
// generated by gennghttpxfun.py
enum
{
SHRPX_OPTID_ACCEPT_PROXY_PROTOCOL
,
SHRPX_OPTID_ACCESSLOG_FILE
,
SHRPX_OPTID_ACCESSLOG_FORMAT
,
SHRPX_OPTID_ACCESSLOG_SYSLOG
,
SHRPX_OPTID_ADD_FORWARDED
,
SHRPX_OPTID_ADD_REQUEST_HEADER
,
SHRPX_OPTID_ADD_RESPONSE_HEADER
,
SHRPX_OPTID_ADD_X_FORWARDED_FOR
,
SHRPX_OPTID_ALTSVC
,
SHRPX_OPTID_API_MAX_REQUEST_BODY
,
SHRPX_OPTID_BACKEND
,
SHRPX_OPTID_BACKEND_ADDRESS_FAMILY
,
SHRPX_OPTID_BACKEND_CONNECTIONS_PER_FRONTEND
,
SHRPX_OPTID_BACKEND_CONNECTIONS_PER_HOST
,
SHRPX_OPTID_BACKEND_HTTP_PROXY_URI
,
SHRPX_OPTID_BACKEND_HTTP1_CONNECTIONS_PER_FRONTEND
,
SHRPX_OPTID_BACKEND_HTTP1_CONNECTIONS_PER_HOST
,
SHRPX_OPTID_BACKEND_HTTP1_TLS
,
SHRPX_OPTID_BACKEND_HTTP2_CONNECTION_WINDOW_BITS
,
SHRPX_OPTID_BACKEND_HTTP2_CONNECTIONS_PER_WORKER
,
SHRPX_OPTID_BACKEND_HTTP2_MAX_CONCURRENT_STREAMS
,
SHRPX_OPTID_BACKEND_HTTP2_SETTINGS_TIMEOUT
,
SHRPX_OPTID_BACKEND_HTTP2_WINDOW_BITS
,
SHRPX_OPTID_BACKEND_IPV4
,
SHRPX_OPTID_BACKEND_IPV6
,
SHRPX_OPTID_BACKEND_KEEP_ALIVE_TIMEOUT
,
SHRPX_OPTID_BACKEND_NO_TLS
,
SHRPX_OPTID_BACKEND_READ_TIMEOUT
,
SHRPX_OPTID_BACKEND_REQUEST_BUFFER
,
SHRPX_OPTID_BACKEND_RESPONSE_BUFFER
,
SHRPX_OPTID_BACKEND_TLS
,
SHRPX_OPTID_BACKEND_TLS_SNI_FIELD
,
SHRPX_OPTID_BACKEND_WRITE_TIMEOUT
,
SHRPX_OPTID_BACKLOG
,
SHRPX_OPTID_CACERT
,
SHRPX_OPTID_CERTIFICATE_FILE
,
SHRPX_OPTID_CIPHERS
,
SHRPX_OPTID_CLIENT
,
SHRPX_OPTID_CLIENT_CERT_FILE
,
SHRPX_OPTID_CLIENT_PRIVATE_KEY_FILE
,
SHRPX_OPTID_CLIENT_PROXY
,
SHRPX_OPTID_CONF
,
SHRPX_OPTID_DAEMON
,
SHRPX_OPTID_DH_PARAM_FILE
,
SHRPX_OPTID_ERROR_PAGE
,
SHRPX_OPTID_ERRORLOG_FILE
,
SHRPX_OPTID_ERRORLOG_SYSLOG
,
SHRPX_OPTID_FASTOPEN
,
SHRPX_OPTID_FETCH_OCSP_RESPONSE_FILE
,
SHRPX_OPTID_FORWARDED_BY
,
SHRPX_OPTID_FORWARDED_FOR
,
SHRPX_OPTID_FRONTEND
,
SHRPX_OPTID_FRONTEND_FRAME_DEBUG
,
SHRPX_OPTID_FRONTEND_HTTP2_CONNECTION_WINDOW_BITS
,
SHRPX_OPTID_FRONTEND_HTTP2_DUMP_REQUEST_HEADER
,
SHRPX_OPTID_FRONTEND_HTTP2_DUMP_RESPONSE_HEADER
,
SHRPX_OPTID_FRONTEND_HTTP2_MAX_CONCURRENT_STREAMS
,
SHRPX_OPTID_FRONTEND_HTTP2_READ_TIMEOUT
,
SHRPX_OPTID_FRONTEND_HTTP2_SETTINGS_TIMEOUT
,
SHRPX_OPTID_FRONTEND_HTTP2_WINDOW_BITS
,
SHRPX_OPTID_FRONTEND_NO_TLS
,
SHRPX_OPTID_FRONTEND_READ_TIMEOUT
,
SHRPX_OPTID_FRONTEND_WRITE_TIMEOUT
,
SHRPX_OPTID_HEADER_FIELD_BUFFER
,
SHRPX_OPTID_HOST_REWRITE
,
SHRPX_OPTID_HTTP2_BRIDGE
,
SHRPX_OPTID_HTTP2_MAX_CONCURRENT_STREAMS
,
SHRPX_OPTID_HTTP2_NO_COOKIE_CRUMBLING
,
SHRPX_OPTID_HTTP2_PROXY
,
SHRPX_OPTID_INCLUDE
,
SHRPX_OPTID_INSECURE
,
SHRPX_OPTID_LISTENER_DISABLE_TIMEOUT
,
SHRPX_OPTID_LOG_LEVEL
,
SHRPX_OPTID_MAX_HEADER_FIELDS
,
SHRPX_OPTID_MAX_REQUEST_HEADER_FIELDS
,
SHRPX_OPTID_MAX_RESPONSE_HEADER_FIELDS
,
SHRPX_OPTID_MRUBY_FILE
,
SHRPX_OPTID_NO_HOST_REWRITE
,
SHRPX_OPTID_NO_HTTP2_CIPHER_BLACK_LIST
,
SHRPX_OPTID_NO_KQUEUE
,
SHRPX_OPTID_NO_LOCATION_REWRITE
,
SHRPX_OPTID_NO_OCSP
,
SHRPX_OPTID_NO_SERVER_PUSH
,
SHRPX_OPTID_NO_VIA
,
SHRPX_OPTID_NPN_LIST
,
SHRPX_OPTID_OCSP_UPDATE_INTERVAL
,
SHRPX_OPTID_PADDING
,
SHRPX_OPTID_PID_FILE
,
SHRPX_OPTID_PRIVATE_KEY_FILE
,
SHRPX_OPTID_PRIVATE_KEY_PASSWD_FILE
,
SHRPX_OPTID_READ_BURST
,
SHRPX_OPTID_READ_RATE
,
SHRPX_OPTID_REQUEST_HEADER_FIELD_BUFFER
,
SHRPX_OPTID_RESPONSE_HEADER_FIELD_BUFFER
,
SHRPX_OPTID_RLIMIT_NOFILE
,
SHRPX_OPTID_STREAM_READ_TIMEOUT
,
SHRPX_OPTID_STREAM_WRITE_TIMEOUT
,
SHRPX_OPTID_STRIP_INCOMING_FORWARDED
,
SHRPX_OPTID_STRIP_INCOMING_X_FORWARDED_FOR
,
SHRPX_OPTID_SUBCERT
,
SHRPX_OPTID_SYSLOG_FACILITY
,
SHRPX_OPTID_TLS_DYN_REC_IDLE_TIMEOUT
,
SHRPX_OPTID_TLS_DYN_REC_WARMUP_THRESHOLD
,
SHRPX_OPTID_TLS_PROTO_LIST
,
SHRPX_OPTID_TLS_SESSION_CACHE_MEMCACHED
,
SHRPX_OPTID_TLS_SESSION_CACHE_MEMCACHED_ADDRESS_FAMILY
,
SHRPX_OPTID_TLS_SESSION_CACHE_MEMCACHED_CERT_FILE
,
SHRPX_OPTID_TLS_SESSION_CACHE_MEMCACHED_PRIVATE_KEY_FILE
,
SHRPX_OPTID_TLS_SESSION_CACHE_MEMCACHED_TLS
,
SHRPX_OPTID_TLS_TICKET_KEY_CIPHER
,
SHRPX_OPTID_TLS_TICKET_KEY_FILE
,
SHRPX_OPTID_TLS_TICKET_KEY_MEMCACHED
,
SHRPX_OPTID_TLS_TICKET_KEY_MEMCACHED_ADDRESS_FAMILY
,
SHRPX_OPTID_TLS_TICKET_KEY_MEMCACHED_CERT_FILE
,
SHRPX_OPTID_TLS_TICKET_KEY_MEMCACHED_INTERVAL
,
SHRPX_OPTID_TLS_TICKET_KEY_MEMCACHED_MAX_FAIL
,
SHRPX_OPTID_TLS_TICKET_KEY_MEMCACHED_MAX_RETRY
,
SHRPX_OPTID_TLS_TICKET_KEY_MEMCACHED_PRIVATE_KEY_FILE
,
SHRPX_OPTID_TLS_TICKET_KEY_MEMCACHED_TLS
,
SHRPX_OPTID_USER
,
SHRPX_OPTID_VERIFY_CLIENT
,
SHRPX_OPTID_VERIFY_CLIENT_CACERT
,
SHRPX_OPTID_WORKER_FRONTEND_CONNECTIONS
,
SHRPX_OPTID_WORKER_READ_BURST
,
SHRPX_OPTID_WORKER_READ_RATE
,
SHRPX_OPTID_WORKER_WRITE_BURST
,
SHRPX_OPTID_WORKER_WRITE_RATE
,
SHRPX_OPTID_WORKERS
,
SHRPX_OPTID_WRITE_BURST
,
SHRPX_OPTID_WRITE_RATE
,
SHRPX_OPTID_MAXIDX
,
};
namespace
{
// generated by gennghttpxfun.py
int
option_lookup_token
(
const
char
*
name
,
size_t
namelen
)
{
switch
(
namelen
)
{
...
...
@@ -1785,15 +1649,18 @@ int option_lookup_token(const char *name, size_t namelen) {
}
return
-
1
;
}
}
// namespace
int
parse_config
(
Config
*
config
,
const
StringRef
&
opt
,
const
StringRef
&
optarg
,
std
::
set
<
StringRef
>
&
included_set
)
{
auto
optid
=
option_lookup_token
(
opt
.
c_str
(),
opt
.
size
());
return
parse_config
(
config
,
optid
,
opt
,
optarg
,
included_set
);
}
int
parse_config
(
Config
*
config
,
int
optid
,
const
StringRef
&
opt
,
const
StringRef
&
optarg
,
std
::
set
<
StringRef
>
&
included_set
)
{
char
host
[
NI_MAXHOST
];
uint16_t
port
;
auto
optid
=
option_lookup_token
(
opt
.
c_str
(),
opt
.
size
());
switch
(
optid
)
{
case
SHRPX_OPTID_BACKEND
:
{
auto
addr_end
=
std
::
find
(
std
::
begin
(
optarg
),
std
::
end
(
optarg
),
';'
);
...
...
src/shrpx_config.h
View file @
851cbd49
...
...
@@ -689,6 +689,144 @@ const Config *get_config();
Config
*
mod_config
();
void
create_config
();
// generated by gennghttpxfun.py
enum
{
SHRPX_OPTID_ACCEPT_PROXY_PROTOCOL
,
SHRPX_OPTID_ACCESSLOG_FILE
,
SHRPX_OPTID_ACCESSLOG_FORMAT
,
SHRPX_OPTID_ACCESSLOG_SYSLOG
,
SHRPX_OPTID_ADD_FORWARDED
,
SHRPX_OPTID_ADD_REQUEST_HEADER
,
SHRPX_OPTID_ADD_RESPONSE_HEADER
,
SHRPX_OPTID_ADD_X_FORWARDED_FOR
,
SHRPX_OPTID_ALTSVC
,
SHRPX_OPTID_API_MAX_REQUEST_BODY
,
SHRPX_OPTID_BACKEND
,
SHRPX_OPTID_BACKEND_ADDRESS_FAMILY
,
SHRPX_OPTID_BACKEND_CONNECTIONS_PER_FRONTEND
,
SHRPX_OPTID_BACKEND_CONNECTIONS_PER_HOST
,
SHRPX_OPTID_BACKEND_HTTP_PROXY_URI
,
SHRPX_OPTID_BACKEND_HTTP1_CONNECTIONS_PER_FRONTEND
,
SHRPX_OPTID_BACKEND_HTTP1_CONNECTIONS_PER_HOST
,
SHRPX_OPTID_BACKEND_HTTP1_TLS
,
SHRPX_OPTID_BACKEND_HTTP2_CONNECTION_WINDOW_BITS
,
SHRPX_OPTID_BACKEND_HTTP2_CONNECTIONS_PER_WORKER
,
SHRPX_OPTID_BACKEND_HTTP2_MAX_CONCURRENT_STREAMS
,
SHRPX_OPTID_BACKEND_HTTP2_SETTINGS_TIMEOUT
,
SHRPX_OPTID_BACKEND_HTTP2_WINDOW_BITS
,
SHRPX_OPTID_BACKEND_IPV4
,
SHRPX_OPTID_BACKEND_IPV6
,
SHRPX_OPTID_BACKEND_KEEP_ALIVE_TIMEOUT
,
SHRPX_OPTID_BACKEND_NO_TLS
,
SHRPX_OPTID_BACKEND_READ_TIMEOUT
,
SHRPX_OPTID_BACKEND_REQUEST_BUFFER
,
SHRPX_OPTID_BACKEND_RESPONSE_BUFFER
,
SHRPX_OPTID_BACKEND_TLS
,
SHRPX_OPTID_BACKEND_TLS_SNI_FIELD
,
SHRPX_OPTID_BACKEND_WRITE_TIMEOUT
,
SHRPX_OPTID_BACKLOG
,
SHRPX_OPTID_CACERT
,
SHRPX_OPTID_CERTIFICATE_FILE
,
SHRPX_OPTID_CIPHERS
,
SHRPX_OPTID_CLIENT
,
SHRPX_OPTID_CLIENT_CERT_FILE
,
SHRPX_OPTID_CLIENT_PRIVATE_KEY_FILE
,
SHRPX_OPTID_CLIENT_PROXY
,
SHRPX_OPTID_CONF
,
SHRPX_OPTID_DAEMON
,
SHRPX_OPTID_DH_PARAM_FILE
,
SHRPX_OPTID_ERROR_PAGE
,
SHRPX_OPTID_ERRORLOG_FILE
,
SHRPX_OPTID_ERRORLOG_SYSLOG
,
SHRPX_OPTID_FASTOPEN
,
SHRPX_OPTID_FETCH_OCSP_RESPONSE_FILE
,
SHRPX_OPTID_FORWARDED_BY
,
SHRPX_OPTID_FORWARDED_FOR
,
SHRPX_OPTID_FRONTEND
,
SHRPX_OPTID_FRONTEND_FRAME_DEBUG
,
SHRPX_OPTID_FRONTEND_HTTP2_CONNECTION_WINDOW_BITS
,
SHRPX_OPTID_FRONTEND_HTTP2_DUMP_REQUEST_HEADER
,
SHRPX_OPTID_FRONTEND_HTTP2_DUMP_RESPONSE_HEADER
,
SHRPX_OPTID_FRONTEND_HTTP2_MAX_CONCURRENT_STREAMS
,
SHRPX_OPTID_FRONTEND_HTTP2_READ_TIMEOUT
,
SHRPX_OPTID_FRONTEND_HTTP2_SETTINGS_TIMEOUT
,
SHRPX_OPTID_FRONTEND_HTTP2_WINDOW_BITS
,
SHRPX_OPTID_FRONTEND_NO_TLS
,
SHRPX_OPTID_FRONTEND_READ_TIMEOUT
,
SHRPX_OPTID_FRONTEND_WRITE_TIMEOUT
,
SHRPX_OPTID_HEADER_FIELD_BUFFER
,
SHRPX_OPTID_HOST_REWRITE
,
SHRPX_OPTID_HTTP2_BRIDGE
,
SHRPX_OPTID_HTTP2_MAX_CONCURRENT_STREAMS
,
SHRPX_OPTID_HTTP2_NO_COOKIE_CRUMBLING
,
SHRPX_OPTID_HTTP2_PROXY
,
SHRPX_OPTID_INCLUDE
,
SHRPX_OPTID_INSECURE
,
SHRPX_OPTID_LISTENER_DISABLE_TIMEOUT
,
SHRPX_OPTID_LOG_LEVEL
,
SHRPX_OPTID_MAX_HEADER_FIELDS
,
SHRPX_OPTID_MAX_REQUEST_HEADER_FIELDS
,
SHRPX_OPTID_MAX_RESPONSE_HEADER_FIELDS
,
SHRPX_OPTID_MRUBY_FILE
,
SHRPX_OPTID_NO_HOST_REWRITE
,
SHRPX_OPTID_NO_HTTP2_CIPHER_BLACK_LIST
,
SHRPX_OPTID_NO_KQUEUE
,
SHRPX_OPTID_NO_LOCATION_REWRITE
,
SHRPX_OPTID_NO_OCSP
,
SHRPX_OPTID_NO_SERVER_PUSH
,
SHRPX_OPTID_NO_VIA
,
SHRPX_OPTID_NPN_LIST
,
SHRPX_OPTID_OCSP_UPDATE_INTERVAL
,
SHRPX_OPTID_PADDING
,
SHRPX_OPTID_PID_FILE
,
SHRPX_OPTID_PRIVATE_KEY_FILE
,
SHRPX_OPTID_PRIVATE_KEY_PASSWD_FILE
,
SHRPX_OPTID_READ_BURST
,
SHRPX_OPTID_READ_RATE
,
SHRPX_OPTID_REQUEST_HEADER_FIELD_BUFFER
,
SHRPX_OPTID_RESPONSE_HEADER_FIELD_BUFFER
,
SHRPX_OPTID_RLIMIT_NOFILE
,
SHRPX_OPTID_STREAM_READ_TIMEOUT
,
SHRPX_OPTID_STREAM_WRITE_TIMEOUT
,
SHRPX_OPTID_STRIP_INCOMING_FORWARDED
,
SHRPX_OPTID_STRIP_INCOMING_X_FORWARDED_FOR
,
SHRPX_OPTID_SUBCERT
,
SHRPX_OPTID_SYSLOG_FACILITY
,
SHRPX_OPTID_TLS_DYN_REC_IDLE_TIMEOUT
,
SHRPX_OPTID_TLS_DYN_REC_WARMUP_THRESHOLD
,
SHRPX_OPTID_TLS_PROTO_LIST
,
SHRPX_OPTID_TLS_SESSION_CACHE_MEMCACHED
,
SHRPX_OPTID_TLS_SESSION_CACHE_MEMCACHED_ADDRESS_FAMILY
,
SHRPX_OPTID_TLS_SESSION_CACHE_MEMCACHED_CERT_FILE
,
SHRPX_OPTID_TLS_SESSION_CACHE_MEMCACHED_PRIVATE_KEY_FILE
,
SHRPX_OPTID_TLS_SESSION_CACHE_MEMCACHED_TLS
,
SHRPX_OPTID_TLS_TICKET_KEY_CIPHER
,
SHRPX_OPTID_TLS_TICKET_KEY_FILE
,
SHRPX_OPTID_TLS_TICKET_KEY_MEMCACHED
,
SHRPX_OPTID_TLS_TICKET_KEY_MEMCACHED_ADDRESS_FAMILY
,
SHRPX_OPTID_TLS_TICKET_KEY_MEMCACHED_CERT_FILE
,
SHRPX_OPTID_TLS_TICKET_KEY_MEMCACHED_INTERVAL
,
SHRPX_OPTID_TLS_TICKET_KEY_MEMCACHED_MAX_FAIL
,
SHRPX_OPTID_TLS_TICKET_KEY_MEMCACHED_MAX_RETRY
,
SHRPX_OPTID_TLS_TICKET_KEY_MEMCACHED_PRIVATE_KEY_FILE
,
SHRPX_OPTID_TLS_TICKET_KEY_MEMCACHED_TLS
,
SHRPX_OPTID_USER
,
SHRPX_OPTID_VERIFY_CLIENT
,
SHRPX_OPTID_VERIFY_CLIENT_CACERT
,
SHRPX_OPTID_WORKER_FRONTEND_CONNECTIONS
,
SHRPX_OPTID_WORKER_READ_BURST
,
SHRPX_OPTID_WORKER_READ_RATE
,
SHRPX_OPTID_WORKER_WRITE_BURST
,
SHRPX_OPTID_WORKER_WRITE_RATE
,
SHRPX_OPTID_WORKERS
,
SHRPX_OPTID_WRITE_BURST
,
SHRPX_OPTID_WRITE_RATE
,
SHRPX_OPTID_MAXIDX
,
};
// Looks up token for given option name |name| of length |namelen|.
int
option_lookup_token
(
const
char
*
name
,
size_t
namelen
);
// Parses option name |opt| and value |optarg|. The results are
// stored into the object pointed by |config|. This function returns 0
// if it succeeds, or -1. The |included_set| contains the all paths
...
...
@@ -697,6 +835,11 @@ void create_config();
int
parse_config
(
Config
*
config
,
const
StringRef
&
opt
,
const
StringRef
&
optarg
,
std
::
set
<
StringRef
>
&
included_set
);
// Similar to parse_config() above, but additional |optid| which
// should be the return value of option_lookup_token(opt).
int
parse_config
(
Config
*
config
,
int
optid
,
const
StringRef
&
opt
,
const
StringRef
&
optarg
,
std
::
set
<
StringRef
>
&
included_set
);
// Loads configurations from |filename| and stores them in statically
// allocated Config object. This function returns 0 if it succeeds, or
// -1. See parse_config() for |include_set|.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment