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
f755ea38
Commit
f755ea38
authored
Feb 20, 2015
by
Tatsuhiro Tsujikawa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
nghttpx: Simplify HttpsUpstream::on_read
parent
50c4aa06
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
37 deletions
+18
-37
src/shrpx_https_upstream.cc
src/shrpx_https_upstream.cc
+18
-37
No files found.
src/shrpx_https_upstream.cc
View file @
f755ea38
...
...
@@ -224,12 +224,24 @@ int htp_msg_completecb(http_parser *htp) {
if
(
LOG_ENABLED
(
INFO
))
{
ULOG
(
INFO
,
upstream
)
<<
"HTTP request completed"
;
}
auto
handler
=
upstream
->
get_client_handler
();
auto
downstream
=
upstream
->
get_downstream
();
downstream
->
set_request_state
(
Downstream
::
MSG_COMPLETE
);
rv
=
downstream
->
end_upload_data
();
if
(
rv
!=
0
)
{
return
-
1
;
}
if
(
handler
->
get_http2_upgrade_allowed
()
&&
downstream
->
get_http2_upgrade_request
())
{
if
(
handler
->
perform_http2_upgrade
(
upstream
)
!=
0
)
{
return
-
1
;
}
handler
->
signal_write
();
}
// Stop further processing to complete this request
http_parser_pause
(
htp
,
1
);
return
0
;
...
...
@@ -310,56 +322,25 @@ int HttpsUpstream::on_read() {
// execution
downstream
=
get_downstream
();
auto
handler
=
get_client_handler
();
auto
htperr
=
HTTP_PARSER_ERRNO
(
&
htp_
);
if
(
htperr
==
HPE_PAUSED
)
{
assert
(
downstream
);
if
(
downstream
->
get_request_state
()
==
Downstream
::
CONNECT_FAIL
)
{
error_reply
(
503
);
handler_
->
signal_write
();
// Downstream gets deleted after response body is read.
return
0
;
}
assert
(
downstream
->
get_request_state
()
==
Downstream
::
MSG_COMPLETE
);
if
(
downstream
->
get_downstream_connection
()
==
nullptr
)
{
// Error response has already be sent
assert
(
downstream
->
get_response_state
()
==
Downstream
::
MSG_COMPLETE
);
delete_downstream
();
return
0
;
}
if
(
handler
->
get_http2_upgrade_allowed
()
&&
downstream
->
get_http2_upgrade_request
())
{
if
(
handler
->
perform_http2_upgrade
(
this
)
!=
0
)
{
return
-
1
;
}
handler_
->
signal_write
();
return
0
;
}
return
0
;
}
if
(
htperr
!=
HPE_OK
)
{
if
(
downstream
->
get_response_state
()
==
Downstream
::
MSG_COMPLETE
)
{
return
0
;
}
if
(
LOG_ENABLED
(
INFO
))
{
ULOG
(
INFO
,
this
)
<<
"HTTP parse failure: "
<<
"("
<<
http_errno_name
(
htperr
)
<<
") "
<<
http_errno_description
(
htperr
);
}
if
(
downstream
&&
downstream
->
get_response_state
()
!=
Downstream
::
INITIAL
)
{
handler_
->
set_should_close_after_write
(
true
);
handler_
->
signal_write
();
return
0
;
}
unsigned
int
status_code
;
if
(
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