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
0288093c
Commit
0288093c
authored
Apr 21, 2019
by
Tatsuhiro Tsujikawa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix llhttp_get_error_pos usage
It returns NULL if return value is HPE_OK.
parent
a3a03481
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
21 additions
and
10 deletions
+21
-10
src/h2load_http1_session.cc
src/h2load_http1_session.cc
+5
-2
src/nghttp.cc
src/nghttp.cc
+5
-3
src/shrpx_http_downstream_connection.cc
src/shrpx_http_downstream_connection.cc
+6
-3
src/shrpx_https_upstream.cc
src/shrpx_https_upstream.cc
+5
-2
No files found.
src/h2load_http1_session.cc
View file @
0288093c
...
@@ -203,8 +203,11 @@ int Http1Session::submit_request() {
...
@@ -203,8 +203,11 @@ int Http1Session::submit_request() {
int
Http1Session
::
on_read
(
const
uint8_t
*
data
,
size_t
len
)
{
int
Http1Session
::
on_read
(
const
uint8_t
*
data
,
size_t
len
)
{
auto
htperr
=
auto
htperr
=
llhttp_execute
(
&
htp_
,
reinterpret_cast
<
const
char
*>
(
data
),
len
);
llhttp_execute
(
&
htp_
,
reinterpret_cast
<
const
char
*>
(
data
),
len
);
auto
nread
=
static_cast
<
size_t
>
(
auto
nread
=
htperr
==
HPE_OK
reinterpret_cast
<
const
uint8_t
*>
(
llhttp_get_error_pos
(
&
htp_
))
-
data
);
?
len
:
static_cast
<
size_t
>
(
reinterpret_cast
<
const
uint8_t
*>
(
llhttp_get_error_pos
(
&
htp_
))
-
data
);
if
(
client_
->
worker
->
config
->
verbose
)
{
if
(
client_
->
worker
->
config
->
verbose
)
{
std
::
cout
.
write
(
reinterpret_cast
<
const
char
*>
(
data
),
nread
);
std
::
cout
.
write
(
reinterpret_cast
<
const
char
*>
(
data
),
nread
);
...
...
src/nghttp.cc
View file @
0288093c
...
@@ -1035,9 +1035,11 @@ int HttpClient::on_upgrade_read(const uint8_t *data, size_t len) {
...
@@ -1035,9 +1035,11 @@ int HttpClient::on_upgrade_read(const uint8_t *data, size_t len) {
auto
htperr
=
auto
htperr
=
llhttp_execute
(
htp
.
get
(),
reinterpret_cast
<
const
char
*>
(
data
),
len
);
llhttp_execute
(
htp
.
get
(),
reinterpret_cast
<
const
char
*>
(
data
),
len
);
auto
nread
=
static_cast
<
size_t
>
(
auto
nread
=
htperr
==
HPE_OK
reinterpret_cast
<
const
uint8_t
*>
(
llhttp_get_error_pos
(
htp
.
get
()))
-
?
len
data
);
:
static_cast
<
size_t
>
(
reinterpret_cast
<
const
uint8_t
*>
(
llhttp_get_error_pos
(
htp
.
get
()))
-
data
);
if
(
config
.
verbose
)
{
if
(
config
.
verbose
)
{
std
::
cout
.
write
(
reinterpret_cast
<
const
char
*>
(
data
),
nread
);
std
::
cout
.
write
(
reinterpret_cast
<
const
char
*>
(
data
),
nread
);
...
...
src/shrpx_http_downstream_connection.cc
View file @
0288093c
...
@@ -1402,9 +1402,12 @@ int HttpDownstreamConnection::process_input(const uint8_t *data,
...
@@ -1402,9 +1402,12 @@ int HttpDownstreamConnection::process_input(const uint8_t *data,
auto
htperr
=
llhttp_execute
(
&
response_htp_
,
auto
htperr
=
llhttp_execute
(
&
response_htp_
,
reinterpret_cast
<
const
char
*>
(
data
),
datalen
);
reinterpret_cast
<
const
char
*>
(
data
),
datalen
);
auto
nproc
=
static_cast
<
size_t
>
(
auto
nproc
=
reinterpret_cast
<
const
uint8_t
*>
(
llhttp_get_error_pos
(
&
response_htp_
))
-
htperr
==
HPE_OK
data
);
?
datalen
:
static_cast
<
size_t
>
(
reinterpret_cast
<
const
uint8_t
*>
(
llhttp_get_error_pos
(
&
response_htp_
))
-
data
);
if
(
htperr
!=
HPE_OK
&&
if
(
htperr
!=
HPE_OK
&&
(
!
downstream_
->
get_upgraded
()
||
htperr
!=
HPE_PAUSED_UPGRADE
))
{
(
!
downstream_
->
get_upgraded
()
||
htperr
!=
HPE_PAUSED_UPGRADE
))
{
...
...
src/shrpx_https_upstream.cc
View file @
0288093c
...
@@ -629,8 +629,11 @@ int HttpsUpstream::on_read() {
...
@@ -629,8 +629,11 @@ int HttpsUpstream::on_read() {
auto
htperr
=
llhttp_execute
(
&
htp_
,
reinterpret_cast
<
const
char
*>
(
rb
->
pos
()),
auto
htperr
=
llhttp_execute
(
&
htp_
,
reinterpret_cast
<
const
char
*>
(
rb
->
pos
()),
rb
->
rleft
());
rb
->
rleft
());
auto
nread
=
reinterpret_cast
<
const
uint8_t
*>
(
llhttp_get_error_pos
(
&
htp_
))
-
auto
nread
=
rb
->
pos
();
htperr
==
HPE_OK
?
rb
->
rleft
()
:
reinterpret_cast
<
const
uint8_t
*>
(
llhttp_get_error_pos
(
&
htp_
))
-
rb
->
pos
();
rb
->
drain
(
nread
);
rb
->
drain
(
nread
);
rlimit
->
startw
();
rlimit
->
startw
();
...
...
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