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
769f5605
Commit
769f5605
authored
Sep 24, 2013
by
Tatsuhiro Tsujikawa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
shrpx_https_upstream: Embed http_parser
parent
811173f5
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
9 deletions
+7
-9
src/shrpx_https_upstream.cc
src/shrpx_https_upstream.cc
+6
-8
src/shrpx_https_upstream.h
src/shrpx_https_upstream.h
+1
-1
No files found.
src/shrpx_https_upstream.cc
View file @
769f5605
...
@@ -50,18 +50,16 @@ const size_t SHRPX_HTTPS_MAX_HEADER_LENGTH = 64*1024;
...
@@ -50,18 +50,16 @@ const size_t SHRPX_HTTPS_MAX_HEADER_LENGTH = 64*1024;
HttpsUpstream
::
HttpsUpstream
(
ClientHandler
*
handler
)
HttpsUpstream
::
HttpsUpstream
(
ClientHandler
*
handler
)
:
handler_
(
handler
),
:
handler_
(
handler
),
htp_
(
new
http_parser
()),
current_header_length_
(
0
),
current_header_length_
(
0
),
downstream_
(
0
),
downstream_
(
0
),
ioctrl_
(
handler
->
get_bev
())
ioctrl_
(
handler
->
get_bev
())
{
{
http_parser_init
(
htp_
,
HTTP_REQUEST
);
http_parser_init
(
&
htp_
,
HTTP_REQUEST
);
htp_
->
data
=
this
;
htp_
.
data
=
this
;
}
}
HttpsUpstream
::~
HttpsUpstream
()
HttpsUpstream
::~
HttpsUpstream
()
{
{
delete
htp_
;
delete
downstream_
;
delete
downstream_
;
}
}
...
@@ -244,7 +242,7 @@ namespace {
...
@@ -244,7 +242,7 @@ namespace {
http_parser_settings
htp_hooks
=
{
http_parser_settings
htp_hooks
=
{
htp_msg_begin
,
/*http_cb on_message_begin;*/
htp_msg_begin
,
/*http_cb on_message_begin;*/
htp_uricb
,
/*http_data_cb on_url;*/
htp_uricb
,
/*http_data_cb on_url;*/
0
,
/*http_cb on_status_complete */
nullptr
,
/*http_cb on_status_complete */
htp_hdr_keycb
,
/*http_data_cb on_header_field;*/
htp_hdr_keycb
,
/*http_data_cb on_header_field;*/
htp_hdr_valcb
,
/*http_data_cb on_header_value;*/
htp_hdr_valcb
,
/*http_data_cb on_header_value;*/
htp_hdrs_completecb
,
/*http_cb on_headers_complete;*/
htp_hdrs_completecb
,
/*http_cb on_headers_complete;*/
...
@@ -285,7 +283,7 @@ int HttpsUpstream::on_read()
...
@@ -285,7 +283,7 @@ int HttpsUpstream::on_read()
return
0
;
return
0
;
}
}
size_t
nread
=
http_parser_execute
(
htp_
,
&
htp_hooks
,
size_t
nread
=
http_parser_execute
(
&
htp_
,
&
htp_hooks
,
reinterpret_cast
<
const
char
*>
(
mem
),
reinterpret_cast
<
const
char
*>
(
mem
),
inputlen
);
inputlen
);
evbuffer_drain
(
input
,
nread
);
evbuffer_drain
(
input
,
nread
);
...
@@ -295,7 +293,7 @@ int HttpsUpstream::on_read()
...
@@ -295,7 +293,7 @@ int HttpsUpstream::on_read()
// execution
// execution
downstream
=
get_downstream
();
downstream
=
get_downstream
();
auto
handler
=
get_client_handler
();
auto
handler
=
get_client_handler
();
http_errno
htperr
=
HTTP_PARSER_ERRNO
(
htp_
);
http_errno
htperr
=
HTTP_PARSER_ERRNO
(
&
htp_
);
if
(
htperr
==
HPE_PAUSED
)
{
if
(
htperr
==
HPE_PAUSED
)
{
if
(
downstream
->
get_request_state
()
==
Downstream
::
CONNECT_FAIL
)
{
if
(
downstream
->
get_request_state
()
==
Downstream
::
CONNECT_FAIL
)
{
handler
->
set_should_close_after_write
(
true
);
handler
->
set_should_close_after_write
(
true
);
...
@@ -387,7 +385,7 @@ int HttpsUpstream::resume_read(IOCtrlReason reason, Downstream *downstream)
...
@@ -387,7 +385,7 @@ int HttpsUpstream::resume_read(IOCtrlReason reason, Downstream *downstream)
if
(
ioctrl_
.
resume_read
(
reason
))
{
if
(
ioctrl_
.
resume_read
(
reason
))
{
// Process remaining data in input buffer here because these bytes
// Process remaining data in input buffer here because these bytes
// are not notified by readcb until new data arrive.
// are not notified by readcb until new data arrive.
http_parser_pause
(
htp_
,
0
);
http_parser_pause
(
&
htp_
,
0
);
return
on_read
();
return
on_read
();
}
else
{
}
else
{
return
0
;
return
0
;
...
...
src/shrpx_https_upstream.h
View file @
769f5605
...
@@ -66,7 +66,7 @@ public:
...
@@ -66,7 +66,7 @@ public:
void
reset_current_header_length
();
void
reset_current_header_length
();
private:
private:
ClientHandler
*
handler_
;
ClientHandler
*
handler_
;
http_parser
*
htp_
;
http_parser
htp_
;
size_t
current_header_length_
;
size_t
current_header_length_
;
Downstream
*
downstream_
;
Downstream
*
downstream_
;
IOControl
ioctrl_
;
IOControl
ioctrl_
;
...
...
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