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
ba3db66c
Commit
ba3db66c
authored
Nov 04, 2013
by
Tatsuhiro Tsujikawa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
nghttpx: Replace "spdy" in option name with "http2"
parent
f3d71aa5
Changes
7
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
82 additions
and
81 deletions
+82
-81
src/shrpx.cc
src/shrpx.cc
+37
-37
src/shrpx_config.cc
src/shrpx_config.cc
+22
-21
src/shrpx_config.h
src/shrpx_config.h
+12
-12
src/shrpx_http2_session.cc
src/shrpx_http2_session.cc
+2
-2
src/shrpx_http2_upstream.cc
src/shrpx_http2_upstream.cc
+5
-5
src/shrpx_http_downstream_connection.cc
src/shrpx_http_downstream_connection.cc
+1
-1
src/shrpx_spdy_upstream.cc
src/shrpx_spdy_upstream.cc
+3
-3
No files found.
src/shrpx.cc
View file @
ba3db66c
This diff is collapsed.
Click to expand it.
src/shrpx_config.cc
View file @
ba3db66c
...
...
@@ -60,16 +60,16 @@ const char SHRPX_OPT_BACKEND[] = "backend";
const
char
SHRPX_OPT_FRONTEND
[]
=
"frontend"
;
const
char
SHRPX_OPT_WORKERS
[]
=
"workers"
;
const
char
SHRPX_OPT_
SPDY_MAX_CONCURRENT_STREAMS
[]
=
"spdy
-max-concurrent-streams"
;
SHRPX_OPT_
HTTP2_MAX_CONCURRENT_STREAMS
[]
=
"http2
-max-concurrent-streams"
;
const
char
SHRPX_OPT_LOG_LEVEL
[]
=
"log-level"
;
const
char
SHRPX_OPT_DAEMON
[]
=
"daemon"
;
const
char
SHRPX_OPT_
SPDY_PROXY
[]
=
"spdy
-proxy"
;
const
char
SHRPX_OPT_
SPDY_BRIDGE
[]
=
"spdy
-bridge"
;
const
char
SHRPX_OPT_
HTTP2_PROXY
[]
=
"http2
-proxy"
;
const
char
SHRPX_OPT_
HTTP2_BRIDGE
[]
=
"http2
-bridge"
;
const
char
SHRPX_OPT_CLIENT_PROXY
[]
=
"client-proxy"
;
const
char
SHRPX_OPT_ADD_X_FORWARDED_FOR
[]
=
"add-x-forwarded-for"
;
const
char
SHRPX_OPT_NO_VIA
[]
=
"no-via"
;
const
char
SHRPX_OPT_FRONTEND_
SPDY_READ_TIMEOUT
[]
=
"frontend-spdy
-read-timeout"
;
SHRPX_OPT_FRONTEND_
HTTP2_READ_TIMEOUT
[]
=
"frontend-http2
-read-timeout"
;
const
char
SHRPX_OPT_FRONTEND_READ_TIMEOUT
[]
=
"frontend-read-timeout"
;
const
char
SHRPX_OPT_FRONTEND_WRITE_TIMEOUT
[]
=
"frontend-write-timeout"
;
const
char
SHRPX_OPT_BACKEND_READ_TIMEOUT
[]
=
"backend-read-timeout"
;
...
...
@@ -77,8 +77,9 @@ const char SHRPX_OPT_BACKEND_WRITE_TIMEOUT[] = "backend-write-timeout";
const
char
SHRPX_OPT_ACCESSLOG
[]
=
"accesslog"
;
const
char
SHRPX_OPT_BACKEND_KEEP_ALIVE_TIMEOUT
[]
=
"backend-keep-alive-timeout"
;
const
char
SHRPX_OPT_FRONTEND_SPDY_WINDOW_BITS
[]
=
"frontend-spdy-window-bits"
;
const
char
SHRPX_OPT_BACKEND_SPDY_WINDOW_BITS
[]
=
"backend-spdy-window-bits"
;
const
char
SHRPX_OPT_FRONTEND_HTTP2_WINDOW_BITS
[]
=
"frontend-http2-window-bits"
;
const
char
SHRPX_OPT_BACKEND_HTTP2_WINDOW_BITS
[]
=
"backend-http2-window-bits"
;
const
char
SHRPX_OPT_FRONTEND_NO_TLS
[]
=
"frontend-no-tls"
;
const
char
SHRPX_OPT_BACKEND_NO_TLS
[]
=
"backend-no-tls"
;
const
char
SHRPX_OPT_BACKEND_TLS_SNI_FIELD
[]
=
"backend-tls-sni-field"
;
...
...
@@ -244,8 +245,8 @@ int parse_config(const char *opt, const char *optarg)
}
}
else
if
(
util
::
strieq
(
opt
,
SHRPX_OPT_WORKERS
))
{
mod_config
()
->
num_worker
=
strtol
(
optarg
,
nullptr
,
10
);
}
else
if
(
util
::
strieq
(
opt
,
SHRPX_OPT_
SPDY
_MAX_CONCURRENT_STREAMS
))
{
mod_config
()
->
spdy
_max_concurrent_streams
=
strtol
(
optarg
,
nullptr
,
10
);
}
else
if
(
util
::
strieq
(
opt
,
SHRPX_OPT_
HTTP2
_MAX_CONCURRENT_STREAMS
))
{
mod_config
()
->
http2
_max_concurrent_streams
=
strtol
(
optarg
,
nullptr
,
10
);
}
else
if
(
util
::
strieq
(
opt
,
SHRPX_OPT_LOG_LEVEL
))
{
if
(
Log
::
set_severity_level_by_name
(
optarg
)
==
-
1
)
{
LOG
(
ERROR
)
<<
"Invalid severity level: "
<<
optarg
;
...
...
@@ -253,19 +254,19 @@ int parse_config(const char *opt, const char *optarg)
}
}
else
if
(
util
::
strieq
(
opt
,
SHRPX_OPT_DAEMON
))
{
mod_config
()
->
daemon
=
util
::
strieq
(
optarg
,
"yes"
);
}
else
if
(
util
::
strieq
(
opt
,
SHRPX_OPT_
SPDY
_PROXY
))
{
mod_config
()
->
spdy
_proxy
=
util
::
strieq
(
optarg
,
"yes"
);
}
else
if
(
util
::
strieq
(
opt
,
SHRPX_OPT_
SPDY
_BRIDGE
))
{
mod_config
()
->
spdy
_bridge
=
util
::
strieq
(
optarg
,
"yes"
);
}
else
if
(
util
::
strieq
(
opt
,
SHRPX_OPT_
HTTP2
_PROXY
))
{
mod_config
()
->
http2
_proxy
=
util
::
strieq
(
optarg
,
"yes"
);
}
else
if
(
util
::
strieq
(
opt
,
SHRPX_OPT_
HTTP2
_BRIDGE
))
{
mod_config
()
->
http2
_bridge
=
util
::
strieq
(
optarg
,
"yes"
);
}
else
if
(
util
::
strieq
(
opt
,
SHRPX_OPT_CLIENT_PROXY
))
{
mod_config
()
->
client_proxy
=
util
::
strieq
(
optarg
,
"yes"
);
}
else
if
(
util
::
strieq
(
opt
,
SHRPX_OPT_ADD_X_FORWARDED_FOR
))
{
mod_config
()
->
add_x_forwarded_for
=
util
::
strieq
(
optarg
,
"yes"
);
}
else
if
(
util
::
strieq
(
opt
,
SHRPX_OPT_NO_VIA
))
{
mod_config
()
->
no_via
=
util
::
strieq
(
optarg
,
"yes"
);
}
else
if
(
util
::
strieq
(
opt
,
SHRPX_OPT_FRONTEND_
SPDY
_READ_TIMEOUT
))
{
}
else
if
(
util
::
strieq
(
opt
,
SHRPX_OPT_FRONTEND_
HTTP2
_READ_TIMEOUT
))
{
timeval
tv
=
{
strtol
(
optarg
,
nullptr
,
10
),
0
};
mod_config
()
->
spdy
_upstream_read_timeout
=
tv
;
mod_config
()
->
http2
_upstream_read_timeout
=
tv
;
}
else
if
(
util
::
strieq
(
opt
,
SHRPX_OPT_FRONTEND_READ_TIMEOUT
))
{
timeval
tv
=
{
strtol
(
optarg
,
nullptr
,
10
),
0
};
mod_config
()
->
upstream_read_timeout
=
tv
;
...
...
@@ -283,16 +284,16 @@ int parse_config(const char *opt, const char *optarg)
}
else
if
(
util
::
strieq
(
opt
,
SHRPX_OPT_BACKEND_KEEP_ALIVE_TIMEOUT
))
{
timeval
tv
=
{
strtol
(
optarg
,
nullptr
,
10
),
0
};
mod_config
()
->
downstream_idle_read_timeout
=
tv
;
}
else
if
(
util
::
strieq
(
opt
,
SHRPX_OPT_FRONTEND_
SPDY
_WINDOW_BITS
)
||
util
::
strieq
(
opt
,
SHRPX_OPT_BACKEND_
SPDY
_WINDOW_BITS
))
{
}
else
if
(
util
::
strieq
(
opt
,
SHRPX_OPT_FRONTEND_
HTTP2
_WINDOW_BITS
)
||
util
::
strieq
(
opt
,
SHRPX_OPT_BACKEND_
HTTP2
_WINDOW_BITS
))
{
size_t
*
resp
;
const
char
*
optname
;
if
(
util
::
strieq
(
opt
,
SHRPX_OPT_FRONTEND_
SPDY
_WINDOW_BITS
))
{
resp
=
&
mod_config
()
->
spdy
_upstream_window_bits
;
optname
=
SHRPX_OPT_FRONTEND_
SPDY
_WINDOW_BITS
;
if
(
util
::
strieq
(
opt
,
SHRPX_OPT_FRONTEND_
HTTP2
_WINDOW_BITS
))
{
resp
=
&
mod_config
()
->
http2
_upstream_window_bits
;
optname
=
SHRPX_OPT_FRONTEND_
HTTP2
_WINDOW_BITS
;
}
else
{
resp
=
&
mod_config
()
->
spdy
_downstream_window_bits
;
optname
=
SHRPX_OPT_BACKEND_
SPDY
_WINDOW_BITS
;
resp
=
&
mod_config
()
->
http2
_downstream_window_bits
;
optname
=
SHRPX_OPT_BACKEND_
HTTP2
_WINDOW_BITS
;
}
errno
=
0
;
unsigned
long
int
n
=
strtoul
(
optarg
,
nullptr
,
10
);
...
...
src/shrpx_config.h
View file @
ba3db66c
...
...
@@ -53,23 +53,23 @@ extern const char SHRPX_OPT_SUBCERT[];
extern
const
char
SHRPX_OPT_BACKEND
[];
extern
const
char
SHRPX_OPT_FRONTEND
[];
extern
const
char
SHRPX_OPT_WORKERS
[];
extern
const
char
SHRPX_OPT_
SPDY
_MAX_CONCURRENT_STREAMS
[];
extern
const
char
SHRPX_OPT_
HTTP2
_MAX_CONCURRENT_STREAMS
[];
extern
const
char
SHRPX_OPT_LOG_LEVEL
[];
extern
const
char
SHRPX_OPT_DAEMON
[];
extern
const
char
SHRPX_OPT_
SPDY
_PROXY
[];
extern
const
char
SHRPX_OPT_
SPDY
_BRIDGE
[];
extern
const
char
SHRPX_OPT_
HTTP2
_PROXY
[];
extern
const
char
SHRPX_OPT_
HTTP2
_BRIDGE
[];
extern
const
char
SHRPX_OPT_CLIENT_PROXY
[];
extern
const
char
SHRPX_OPT_ADD_X_FORWARDED_FOR
[];
extern
const
char
SHRPX_OPT_NO_VIA
[];
extern
const
char
SHRPX_OPT_FRONTEND_
SPDY
_READ_TIMEOUT
[];
extern
const
char
SHRPX_OPT_FRONTEND_
HTTP2
_READ_TIMEOUT
[];
extern
const
char
SHRPX_OPT_FRONTEND_READ_TIMEOUT
[];
extern
const
char
SHRPX_OPT_FRONTEND_WRITE_TIMEOUT
[];
extern
const
char
SHRPX_OPT_BACKEND_READ_TIMEOUT
[];
extern
const
char
SHRPX_OPT_BACKEND_WRITE_TIMEOUT
[];
extern
const
char
SHRPX_OPT_ACCESSLOG
[];
extern
const
char
SHRPX_OPT_BACKEND_KEEP_ALIVE_TIMEOUT
[];
extern
const
char
SHRPX_OPT_FRONTEND_
SPDY
_WINDOW_BITS
[];
extern
const
char
SHRPX_OPT_BACKEND_
SPDY
_WINDOW_BITS
[];
extern
const
char
SHRPX_OPT_FRONTEND_
HTTP2
_WINDOW_BITS
[];
extern
const
char
SHRPX_OPT_BACKEND_
HTTP2
_WINDOW_BITS
[];
extern
const
char
SHRPX_OPT_FRONTEND_NO_TLS
[];
extern
const
char
SHRPX_OPT_BACKEND_NO_TLS
[];
extern
const
char
SHRPX_OPT_PID_FILE
[];
...
...
@@ -126,22 +126,22 @@ struct Config {
char
*
downstream_hostport
;
sockaddr_union
downstream_addr
;
size_t
downstream_addrlen
;
timeval
spdy
_upstream_read_timeout
;
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
spdy
_max_concurrent_streams
;
bool
spdy
_proxy
;
bool
spdy
_bridge
;
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
spdy
_upstream_window_bits
;
size_t
spdy
_downstream_window_bits
;
size_t
http2
_upstream_window_bits
;
size_t
http2
_downstream_window_bits
;
bool
upstream_no_tls
;
bool
downstream_no_tls
;
char
*
backend_tls_sni_name
;
...
...
src/shrpx_http2_session.cc
View file @
ba3db66c
...
...
@@ -630,7 +630,7 @@ int Http2Session::submit_window_update(Http2DownstreamConnection *dconn,
int32_t
Http2Session
::
get_initial_window_size
()
const
{
return
(
1
<<
get_config
()
->
spdy
_downstream_window_bits
)
-
1
;
return
(
1
<<
get_config
()
->
http2
_downstream_window_bits
)
-
1
;
}
nghttp2_session
*
Http2Session
::
get_session
()
const
...
...
@@ -1168,7 +1168,7 @@ int Http2Session::on_connect()
entry
[
0
].
settings_id
=
NGHTTP2_SETTINGS_ENABLE_PUSH
;
entry
[
0
].
value
=
0
;
entry
[
1
].
settings_id
=
NGHTTP2_SETTINGS_MAX_CONCURRENT_STREAMS
;
entry
[
1
].
value
=
get_config
()
->
spdy
_max_concurrent_streams
;
entry
[
1
].
value
=
get_config
()
->
http2
_max_concurrent_streams
;
entry
[
2
].
settings_id
=
NGHTTP2_SETTINGS_INITIAL_WINDOW_SIZE
;
entry
[
2
].
value
=
get_initial_window_size
();
...
...
src/shrpx_http2_upstream.cc
View file @
ba3db66c
...
...
@@ -288,8 +288,8 @@ int on_frame_recv_callback
// :authority or host for methods.
if
(
!
http2
::
non_empty_value
(
method
)
||
!
http2
::
non_empty_value
(
scheme
)
||
(
get_config
()
->
spdy
_proxy
&&
!
having_authority
)
||
(
!
get_config
()
->
spdy
_proxy
&&
!
having_authority
&&
!
having_host
)
||
(
get_config
()
->
http2
_proxy
&&
!
having_authority
)
||
(
!
get_config
()
->
http2
_proxy
&&
!
having_authority
&&
!
having_host
)
||
!
http2
::
non_empty_value
(
path
))
{
upstream
->
rst_stream
(
downstream
,
NGHTTP2_PROTOCOL_ERROR
);
return
0
;
...
...
@@ -467,7 +467,7 @@ Http2Upstream::Http2Upstream(ClientHandler *handler)
session_
(
nullptr
),
settings_timerev_
(
nullptr
)
{
handler
->
set_upstream_timeouts
(
&
get_config
()
->
spdy
_upstream_read_timeout
,
handler
->
set_upstream_timeouts
(
&
get_config
()
->
http2
_upstream_read_timeout
,
&
get_config
()
->
upstream_write_timeout
);
nghttp2_session_callbacks
callbacks
;
...
...
@@ -490,7 +490,7 @@ Http2Upstream::Http2Upstream(ClientHandler *handler)
int
val
=
1
;
flow_control_
=
true
;
initial_window_size_
=
(
1
<<
get_config
()
->
spdy
_upstream_window_bits
)
-
1
;
initial_window_size_
=
(
1
<<
get_config
()
->
http2
_upstream_window_bits
)
-
1
;
rv
=
nghttp2_session_set_option
(
session_
,
NGHTTP2_OPT_NO_AUTO_STREAM_WINDOW_UPDATE
,
&
val
,
sizeof
(
val
));
...
...
@@ -503,7 +503,7 @@ Http2Upstream::Http2Upstream(ClientHandler *handler)
// TODO Maybe call from outside?
nghttp2_settings_entry
entry
[
2
];
entry
[
0
].
settings_id
=
NGHTTP2_SETTINGS_MAX_CONCURRENT_STREAMS
;
entry
[
0
].
value
=
get_config
()
->
spdy
_max_concurrent_streams
;
entry
[
0
].
value
=
get_config
()
->
http2
_max_concurrent_streams
;
entry
[
1
].
settings_id
=
NGHTTP2_SETTINGS_INITIAL_WINDOW_SIZE
;
entry
[
1
].
value
=
initial_window_size_
;
...
...
src/shrpx_http_downstream_connection.cc
View file @
ba3db66c
...
...
@@ -127,7 +127,7 @@ int HttpDownstreamConnection::push_request_headers()
}
else
{
hdrs
+=
downstream_
->
get_request_path
();
}
}
else
if
(
get_config
()
->
spdy
_proxy
&&
}
else
if
(
get_config
()
->
http2
_proxy
&&
!
downstream_
->
get_request_http2_scheme
().
empty
()
&&
!
downstream_
->
get_request_http2_authority
().
empty
()
&&
downstream_
->
get_request_path
().
c_str
()[
0
]
==
'/'
)
{
...
...
src/shrpx_spdy_upstream.cc
View file @
ba3db66c
...
...
@@ -357,7 +357,7 @@ SpdyUpstream::SpdyUpstream(uint16_t version, ClientHandler *handler)
session_
(
0
)
{
//handler->set_bev_cb(spdy_readcb, 0, spdy_eventcb);
handler
->
set_upstream_timeouts
(
&
get_config
()
->
spdy
_upstream_read_timeout
,
handler
->
set_upstream_timeouts
(
&
get_config
()
->
http2
_upstream_read_timeout
,
&
get_config
()
->
upstream_write_timeout
);
spdylay_session_callbacks
callbacks
;
...
...
@@ -380,7 +380,7 @@ SpdyUpstream::SpdyUpstream(uint16_t version, ClientHandler *handler)
if
(
version
==
SPDYLAY_PROTO_SPDY3
)
{
int
val
=
1
;
flow_control_
=
true
;
initial_window_size_
=
(
1
<<
get_config
()
->
spdy
_upstream_window_bits
)
-
1
;
initial_window_size_
=
(
1
<<
get_config
()
->
http2
_upstream_window_bits
)
-
1
;
rv
=
spdylay_session_set_option
(
session_
,
SPDYLAY_OPT_NO_AUTO_WINDOW_UPDATE
,
&
val
,
sizeof
(
val
));
...
...
@@ -392,7 +392,7 @@ SpdyUpstream::SpdyUpstream(uint16_t version, ClientHandler *handler)
// TODO Maybe call from outside?
spdylay_settings_entry
entry
[
2
];
entry
[
0
].
settings_id
=
SPDYLAY_SETTINGS_MAX_CONCURRENT_STREAMS
;
entry
[
0
].
value
=
get_config
()
->
spdy
_max_concurrent_streams
;
entry
[
0
].
value
=
get_config
()
->
http2
_max_concurrent_streams
;
entry
[
0
].
flags
=
SPDYLAY_ID_FLAG_SETTINGS_NONE
;
entry
[
1
].
settings_id
=
SPDYLAY_SETTINGS_INITIAL_WINDOW_SIZE
;
...
...
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