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
b9f41e34
Commit
b9f41e34
authored
Jan 20, 2015
by
Tatsuhiro Tsujikawa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
nghttpx: Return error when downstream HTTP/1 connection attempt failed
parent
ca7288ae
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
46 additions
and
1 deletion
+46
-1
integration-tests/nghttpx_test.go
integration-tests/nghttpx_test.go
+38
-0
src/shrpx_http_downstream_connection.cc
src/shrpx_http_downstream_connection.cc
+6
-1
src/shrpx_https_upstream.cc
src/shrpx_https_upstream.cc
+2
-0
No files found.
integration-tests/nghttpx_test.go
View file @
b9f41e34
...
...
@@ -69,6 +69,25 @@ func TestH1H1MultipleRequestCL(t *testing.T) {
}
}
func
TestH1H1ConnectFailure
(
t
*
testing
.
T
)
{
st
:=
newServerTester
(
nil
,
t
,
noopHandler
)
defer
st
.
Close
()
// shutdown backend server to simulate backend connect failure
st
.
ts
.
Close
()
res
,
err
:=
st
.
http1
(
requestParam
{
name
:
"TestH1H1ConnectFailure"
,
})
if
err
!=
nil
{
t
.
Fatalf
(
"Error st.http2() = %v"
,
err
)
}
want
:=
502
if
got
:=
res
.
status
;
got
!=
want
{
t
.
Errorf
(
"status: %v; want %v"
,
got
,
want
)
}
}
func
TestH2H1PlainGET
(
t
*
testing
.
T
)
{
st
:=
newServerTester
(
nil
,
t
,
noopHandler
)
defer
st
.
Close
()
...
...
@@ -305,6 +324,25 @@ func TestH2H1InvalidRequestCL(t *testing.T) {
}
}
func
TestH2H1ConnectFailure
(
t
*
testing
.
T
)
{
st
:=
newServerTester
(
nil
,
t
,
noopHandler
)
defer
st
.
Close
()
// shutdown backend server to simulate backend connect failure
st
.
ts
.
Close
()
res
,
err
:=
st
.
http2
(
requestParam
{
name
:
"TestH2H1ConnectFailure"
,
})
if
err
!=
nil
{
t
.
Fatalf
(
"Error st.http2() = %v"
,
err
)
}
want
:=
502
if
got
:=
res
.
status
;
got
!=
want
{
t
.
Errorf
(
"status: %v; want %v"
,
got
,
want
)
}
}
func
TestH2H2MultipleResponseCL
(
t
*
testing
.
T
)
{
st
:=
newServerTester
([]
string
{
"--http2-bridge"
},
t
,
func
(
w
http
.
ResponseWriter
,
r
*
http
.
Request
)
{
w
.
Header
()
.
Add
(
"content-length"
,
"1"
)
...
...
src/shrpx_http_downstream_connection.cc
View file @
b9f41e34
...
...
@@ -95,7 +95,9 @@ void connectcb(struct ev_loop *loop, ev_io *w, int revents) {
auto
upstream
=
downstream
->
get_upstream
();
auto
handler
=
upstream
->
get_client_handler
();
if
(
dconn
->
on_connect
()
!=
0
)
{
delete
handler
;
if
(
upstream
->
downstream_error
(
dconn
,
Downstream
::
EVENT_ERROR
)
!=
0
)
{
delete
handler
;
}
return
;
}
writecb
(
loop
,
w
,
revents
);
...
...
@@ -747,6 +749,9 @@ end:
int
HttpDownstreamConnection
::
on_connect
()
{
if
(
!
util
::
check_socket_connected
(
fd_
))
{
if
(
LOG_ENABLED
(
INFO
))
{
DLOG
(
INFO
,
this
)
<<
"downstream connect failed"
;
}
return
-
1
;
}
...
...
src/shrpx_https_upstream.cc
View file @
b9f41e34
...
...
@@ -560,6 +560,8 @@ int HttpsUpstream::downstream_error(DownstreamConnection *dconn, int events) {
return
-
1
;
}
handler_
->
set_should_close_after_write
(
true
);
unsigned
int
status
;
if
(
events
&
Downstream
::
EVENT_TIMEOUT
)
{
status
=
504
;
...
...
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