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
8c1e8635
Commit
8c1e8635
authored
Jul 14, 2015
by
Tatsuhiro Tsujikawa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
nghttpx: Refactor option name lookup
parent
27da08ee
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
854 additions
and
255 deletions
+854
-255
gennghttpxfun.py
gennghttpxfun.py
+117
-0
gentokenlookup.py
gentokenlookup.py
+7
-7
src/shrpx_config.cc
src/shrpx_config.cc
+730
-248
No files found.
gennghttpxfun.py
0 → 100755
View file @
8c1e8635
#!/usr/bin/env python
from
gentokenlookup
import
gentokenlookup
OPTIONS
=
[
"private-key-file"
,
"private-key-passwd-file"
,
"certificate-file"
,
"dh-param-file"
,
"subcert"
,
"backend"
,
"frontend"
,
"workers"
,
"http2-max-concurrent-streams"
,
"log-level"
,
"daemon"
,
"http2-proxy"
,
"http2-bridge"
,
"client-proxy"
,
"add-x-forwarded-for"
,
"strip-incoming-x-forwarded-for"
,
"no-via"
,
"frontend-http2-read-timeout"
,
"frontend-read-timeout"
,
"frontend-write-timeout"
,
"backend-read-timeout"
,
"backend-write-timeout"
,
"stream-read-timeout"
,
"stream-write-timeout"
,
"accesslog-file"
,
"accesslog-syslog"
,
"accesslog-format"
,
"errorlog-file"
,
"errorlog-syslog"
,
"backend-keep-alive-timeout"
,
"frontend-http2-window-bits"
,
"backend-http2-window-bits"
,
"frontend-http2-connection-window-bits"
,
"backend-http2-connection-window-bits"
,
"frontend-no-tls"
,
"backend-no-tls"
,
"backend-tls-sni-field"
,
"pid-file"
,
"user"
,
"syslog-facility"
,
"backlog"
,
"ciphers"
,
"client"
,
"insecure"
,
"cacert"
,
"backend-ipv4"
,
"backend-ipv6"
,
"backend-http-proxy-uri"
,
"read-rate"
,
"read-burst"
,
"write-rate"
,
"write-burst"
,
"worker-read-rate"
,
"worker-read-burst"
,
"worker-write-rate"
,
"worker-write-burst"
,
"npn-list"
,
"tls-proto-list"
,
"verify-client"
,
"verify-client-cacert"
,
"client-private-key-file"
,
"client-cert-file"
,
"frontend-http2-dump-request-header"
,
"frontend-http2-dump-response-header"
,
"http2-no-cookie-crumbling"
,
"frontend-frame-debug"
,
"padding"
,
"altsvc"
,
"add-request-header"
,
"add-response-header"
,
"worker-frontend-connections"
,
"no-location-rewrite"
,
"no-host-rewrite"
,
"backend-http1-connections-per-host"
,
"backend-http1-connections-per-frontend"
,
"listener-disable-timeout"
,
"tls-ticket-key-file"
,
"rlimit-nofile"
,
"backend-request-buffer"
,
"backend-response-buffer"
,
"no-server-push"
,
"backend-http2-connections-per-worker"
,
"fetch-ocsp-response-file"
,
"ocsp-update-interval"
,
"no-ocsp"
,
"header-field-buffer"
,
"max-header-fields"
,
"include"
,
"conf"
,
]
LOGVARS
=
[
"remote_addr"
,
"time_local"
,
"time_iso8601"
,
"request"
,
"status"
,
"body_bytes_sent"
,
"remote_port"
,
"server_port"
,
"request_time"
,
"pid"
,
"alpn"
,
"ssl_cipher"
,
"ssl_protocol"
,
"ssl_session_id"
,
"ssl_session_reused"
,
]
if
__name__
==
'__main__'
:
gentokenlookup
(
OPTIONS
,
'SHRPX_OPTID'
,
value_type
=
'char'
,
comp_fun
=
'util::strieq_l'
)
gentokenlookup
(
LOGVARS
,
'SHRPX_LOGF'
,
value_type
=
'char'
,
comp_fun
=
'util::strieq_l'
)
gentokenlookup.py
View file @
8c1e8635
...
...
@@ -33,10 +33,10 @@ enum {'''
{}_MAXIDX,
}};'''
.
format
(
prefix
)
def
gen_index_header
(
tokens
,
prefix
):
def
gen_index_header
(
tokens
,
prefix
,
value_type
,
comp_fun
):
print
'''
\
int lookup_token(const
uint8_t *name, size_t namelen)
{
switch (namelen) {
'''
int lookup_token(const
{} *name, size_t namelen) {
{
switch (namelen) {
{'''
.
format
(
value_type
)
b
=
build_header
(
tokens
)
for
size
in
sorted
(
b
.
keys
()):
ents
=
b
[
size
]
...
...
@@ -50,9 +50,9 @@ int lookup_token(const uint8_t *name, size_t namelen) {
case '{}':'''
.
format
(
c
)
for
k
in
headers
:
print
'''
\
if (
util::streq_l
("{}", name, {})) {{
if (
{}
("{}", name, {})) {{
return {};
}}'''
.
format
(
k
[:
-
1
],
size
-
1
,
to_enum_hd
(
k
,
prefix
))
}}'''
.
format
(
comp_fun
,
k
[:
-
1
],
size
-
1
,
to_enum_hd
(
k
,
prefix
))
print
'''
\
break;'''
print
'''
\
...
...
@@ -63,7 +63,7 @@ int lookup_token(const uint8_t *name, size_t namelen) {
return -1;
}'''
def
gentokenlookup
(
tokens
,
prefix
):
def
gentokenlookup
(
tokens
,
prefix
,
value_type
=
'uint8_t'
,
comp_fun
=
'util::streq_l'
):
gen_enum
(
tokens
,
prefix
)
print
''
gen_index_header
(
tokens
,
prefix
)
gen_index_header
(
tokens
,
prefix
,
value_type
,
comp_fun
)
src/shrpx_config.cc
View file @
8c1e8635
This diff is collapsed.
Click to expand it.
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