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
f3551871
Commit
f3551871
authored
Oct 02, 2013
by
Tatsuhiro Tsujikawa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
nghttpx: Fix missing extension HTTP status code in response
parent
c7ce6d81
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
24 additions
and
23 deletions
+24
-23
src/http2.cc
src/http2.cc
+2
-2
src/http2.h
src/http2.h
+1
-1
src/shrpx_accesslog.cc
src/shrpx_accesslog.cc
+6
-6
src/shrpx_accesslog.h
src/shrpx_accesslog.h
+1
-1
src/shrpx_http.cc
src/shrpx_http.cc
+2
-2
src/shrpx_http.h
src/shrpx_http.h
+1
-1
src/shrpx_https_upstream.cc
src/shrpx_https_upstream.cc
+2
-2
src/shrpx_https_upstream.h
src/shrpx_https_upstream.h
+1
-1
src/shrpx_spdy_upstream.cc
src/shrpx_spdy_upstream.cc
+7
-6
src/shrpx_spdy_upstream.h
src/shrpx_spdy_upstream.h
+1
-1
No files found.
src/http2.cc
View file @
f3551871
...
...
@@ -30,7 +30,7 @@ namespace nghttp2 {
namespace
http2
{
const
char
*
get_status_string
(
int
status_code
)
std
::
string
get_status_string
(
unsigned
int
status_code
)
{
switch
(
status_code
)
{
case
100
:
return
"100 Continue"
;
...
...
@@ -74,7 +74,7 @@ const char* get_status_string(int status_code)
case
503
:
return
"503 Service Unavailable"
;
case
504
:
return
"504 Gateway Timeout"
;
case
505
:
return
"505 HTTP Version Not Supported"
;
default:
return
""
;
default:
return
util
::
utos
(
status_code
)
;
}
}
...
...
src/http2.h
View file @
f3551871
...
...
@@ -38,7 +38,7 @@ namespace nghttp2 {
namespace
http2
{
const
char
*
get_status_string
(
int
status_code
);
std
::
string
get_status_string
(
unsigned
int
status_code
);
void
capitalize
(
std
::
string
&
s
,
size_t
offset
);
...
...
src/shrpx_accesslog.cc
View file @
f3551871
...
...
@@ -64,7 +64,7 @@ void upstream_connect(const std::string& client_ip)
}
namespace
{
const
char
*
status_code_color
(
int
status_code
)
const
char
*
status_code_color
(
unsigned
int
status_code
)
{
if
(
status_code
<=
199
)
{
return
"
\033
[1;36m"
;
...
...
@@ -82,13 +82,13 @@ const char* status_code_color(int status_code)
}
}
// namespace
void
upstream_response
(
const
std
::
string
&
client_ip
,
int
status_code
,
void
upstream_response
(
const
std
::
string
&
client_ip
,
unsigned
int
status_code
,
Downstream
*
downstream
)
{
char
datestr
[
64
];
get_datestr
(
datestr
);
if
(
downstream
)
{
fprintf
(
stderr
,
"%s%s [%s] %
d
%s %d
\"
%s %s HTTP/%u.%u
\"\n
"
,
fprintf
(
stderr
,
"%s%s [%s] %
u
%s %d
\"
%s %s HTTP/%u.%u
\"\n
"
,
get_config
()
->
tty
?
status_code_color
(
status_code
)
:
""
,
client_ip
.
c_str
(),
datestr
,
status_code
,
...
...
@@ -100,7 +100,7 @@ void upstream_response(const std::string& client_ip, int status_code,
downstream
->
get_request_minor
());
fflush
(
stderr
);
if
(
get_config
()
->
use_syslog
)
{
syslog
(
LOG_INFO
,
"%s %
d
%d
\"
%s %s HTTP/%u.%u
\"\n
"
,
syslog
(
LOG_INFO
,
"%s %
u
%d
\"
%s %s HTTP/%u.%u
\"\n
"
,
client_ip
.
c_str
(),
status_code
,
downstream
->
get_stream_id
(),
...
...
@@ -110,13 +110,13 @@ void upstream_response(const std::string& client_ip, int status_code,
downstream
->
get_request_minor
());
}
}
else
{
fprintf
(
stderr
,
"%s%s [%s] %
d
%s 0
\"
-
\"\n
"
,
fprintf
(
stderr
,
"%s%s [%s] %
u
%s 0
\"
-
\"\n
"
,
get_config
()
->
tty
?
status_code_color
(
status_code
)
:
""
,
client_ip
.
c_str
(),
datestr
,
status_code
,
get_config
()
->
tty
?
"
\033
[0m"
:
""
);
if
(
get_config
()
->
use_syslog
)
{
syslog
(
LOG_INFO
,
"%s %
d
0
\"
-
\"\n
"
,
client_ip
.
c_str
(),
status_code
);
syslog
(
LOG_INFO
,
"%s %
u
0
\"
-
\"\n
"
,
client_ip
.
c_str
(),
status_code
);
}
fflush
(
stderr
);
}
...
...
src/shrpx_accesslog.h
View file @
f3551871
...
...
@@ -34,7 +34,7 @@ namespace shrpx {
class
Downstream
;
void
upstream_connect
(
const
std
::
string
&
client_ip
);
void
upstream_response
(
const
std
::
string
&
client_ip
,
int
status_code
,
void
upstream_response
(
const
std
::
string
&
client_ip
,
unsigned
int
status_code
,
Downstream
*
downstream
);
}
// namespace shrpx
...
...
src/shrpx_http.cc
View file @
f3551871
...
...
@@ -35,11 +35,11 @@ namespace shrpx {
namespace
http
{
std
::
string
create_error_html
(
int
status_code
)
std
::
string
create_error_html
(
unsigned
int
status_code
)
{
std
::
string
res
;
res
.
reserve
(
512
);
const
char
*
status
=
http2
::
get_status_string
(
status_code
);
auto
status
=
http2
::
get_status_string
(
status_code
);
res
+=
"<html><head><title>"
;
res
+=
status
;
res
+=
"</title></head><body><h1>"
;
...
...
src/shrpx_http.h
View file @
f3551871
...
...
@@ -33,7 +33,7 @@ namespace shrpx {
namespace
http
{
std
::
string
create_error_html
(
int
status_code
);
std
::
string
create_error_html
(
unsigned
int
status_code
);
std
::
string
create_via_header_value
(
int
major
,
int
minor
);
...
...
src/shrpx_https_upstream.cc
View file @
f3551871
...
...
@@ -544,7 +544,7 @@ void https_downstream_eventcb(bufferevent *bev, short events, void *ptr)
}
}
if
(
downstream
->
get_response_state
()
==
Downstream
::
INITIAL
)
{
int
status
;
unsigned
int
status
;
if
(
events
&
BEV_EVENT_TIMEOUT
)
{
status
=
504
;
}
else
{
...
...
@@ -565,7 +565,7 @@ void https_downstream_eventcb(bufferevent *bev, short events, void *ptr)
}
}
// namespace
int
HttpsUpstream
::
error_reply
(
int
status_code
)
int
HttpsUpstream
::
error_reply
(
unsigned
int
status_code
)
{
auto
html
=
http
::
create_error_html
(
status_code
);
std
::
string
header
;
...
...
src/shrpx_https_upstream.h
View file @
f3551871
...
...
@@ -53,7 +53,7 @@ public:
void
delete_downstream
();
Downstream
*
get_downstream
()
const
;
Downstream
*
pop_downstream
();
int
error_reply
(
int
status_code
);
int
error_reply
(
unsigned
int
status_code
);
virtual
void
pause_read
(
IOCtrlReason
reason
);
virtual
int
resume_read
(
IOCtrlReason
reason
,
Downstream
*
downstream
);
...
...
src/shrpx_spdy_upstream.cc
View file @
f3551871
...
...
@@ -636,7 +636,7 @@ void spdy_downstream_eventcb(bufferevent *bev, short events, void *ptr)
if
(
downstream
->
get_response_state
()
==
Downstream
::
HEADER_COMPLETE
)
{
upstream
->
rst_stream
(
downstream
,
SPDYLAY_INTERNAL_ERROR
);
}
else
{
int
status
;
unsigned
int
status
;
if
(
events
&
BEV_EVENT_TIMEOUT
)
{
status
=
504
;
}
else
{
...
...
@@ -725,7 +725,7 @@ ssize_t spdy_data_read_callback(spdylay_session *session,
}
}
// namespace
int
SpdyUpstream
::
error_reply
(
Downstream
*
downstream
,
int
status_code
)
int
SpdyUpstream
::
error_reply
(
Downstream
*
downstream
,
unsigned
int
status_code
)
{
int
rv
;
std
::
string
html
=
http
::
create_error_html
(
status_code
);
...
...
@@ -743,9 +743,9 @@ int SpdyUpstream::error_reply(Downstream *downstream, int status_code)
data_prd
.
read_callback
=
spdy_data_read_callback
;
std
::
string
content_length
=
util
::
utos
(
html
.
size
());
std
::
string
status_string
=
http2
::
get_status_string
(
status_code
);
const
char
*
nv
[]
=
{
":status"
,
http2
::
get_status_string
(
status_code
),
":status"
,
status_string
.
c_str
(
),
":version"
,
"http/1.1"
,
"content-type"
,
"text/html; charset=UTF-8"
,
"server"
,
get_config
()
->
server_name
,
...
...
@@ -814,9 +814,10 @@ int SpdyUpstream::on_downstream_header_complete(Downstream *downstream)
auto
nv
=
util
::
make_unique
<
const
char
*
[]
>
(
nheader
*
2
+
6
+
1
);
size_t
hdidx
=
0
;
std
::
string
via_value
;
nv
[
hdidx
++
]
=
":status"
;
nv
[
hdidx
++
]
=
http2
::
get_status_string
std
::
string
status_string
=
http2
::
get_status_string
(
downstream
->
get_response_http_status
());
nv
[
hdidx
++
]
=
":status"
;
nv
[
hdidx
++
]
=
status_string
.
c_str
();
nv
[
hdidx
++
]
=
":version"
;
nv
[
hdidx
++
]
=
"HTTP/1.1"
;
for
(
Headers
::
const_iterator
i
=
downstream
->
get_response_headers
().
begin
();
...
...
src/shrpx_spdy_upstream.h
View file @
f3551871
...
...
@@ -56,7 +56,7 @@ public:
int
rst_stream
(
Downstream
*
downstream
,
int
status_code
);
int
window_update
(
Downstream
*
downstream
);
int
error_reply
(
Downstream
*
downstream
,
int
status_code
);
int
error_reply
(
Downstream
*
downstream
,
unsigned
int
status_code
);
virtual
void
pause_read
(
IOCtrlReason
reason
);
virtual
int
resume_read
(
IOCtrlReason
reason
,
Downstream
*
downstream
);
...
...
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