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
a5d66e71
Commit
a5d66e71
authored
Oct 16, 2016
by
Tatsuhiro Tsujikawa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update http-parser to feae95a3a69f111bc1897b9048d9acbc290992f9
parent
3de26542
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
36 additions
and
10 deletions
+36
-10
third-party/http-parser/README.md
third-party/http-parser/README.md
+2
-2
third-party/http-parser/http_parser.c
third-party/http-parser/http_parser.c
+6
-5
third-party/http-parser/http_parser.h
third-party/http-parser/http_parser.h
+1
-1
third-party/http-parser/test.c
third-party/http-parser/test.c
+27
-2
No files found.
third-party/http-parser/README.md
View file @
a5d66e71
...
@@ -148,7 +148,7 @@ callback in a threadsafe manner. This allows http-parser to be used in
...
@@ -148,7 +148,7 @@ callback in a threadsafe manner. This allows http-parser to be used in
multi-threaded contexts.
multi-threaded contexts.
Example:
Example:
```
```
c
typedef
struct
{
typedef
struct
{
socket_t
sock
;
socket_t
sock
;
void
*
buffer
;
void
*
buffer
;
...
@@ -184,7 +184,7 @@ void http_parser_thread(socket_t sock) {
...
@@ -184,7 +184,7 @@ void http_parser_thread(socket_t sock) {
parser supplied to callback functions */
parser supplied to callback functions */
parser
->
data
=
my_data
;
parser
->
data
=
my_data
;
http_parser_settings settings; /
* set up callbacks */
http_parser_settings
settings
;
/* set up callbacks */
settings
.
on_url
=
my_url_callback
;
settings
.
on_url
=
my_url_callback
;
/* execute parser */
/* execute parser */
...
...
third-party/http-parser/http_parser.c
View file @
a5d66e71
...
@@ -1366,12 +1366,7 @@ reexecute:
...
@@ -1366,12 +1366,7 @@ reexecute:
||
c
!=
CONTENT_LENGTH
[
parser
->
index
])
{
||
c
!=
CONTENT_LENGTH
[
parser
->
index
])
{
parser
->
header_state
=
h_general
;
parser
->
header_state
=
h_general
;
}
else
if
(
parser
->
index
==
sizeof
(
CONTENT_LENGTH
)
-
2
)
{
}
else
if
(
parser
->
index
==
sizeof
(
CONTENT_LENGTH
)
-
2
)
{
if
(
parser
->
flags
&
F_CONTENTLENGTH
)
{
SET_ERRNO
(
HPE_UNEXPECTED_CONTENT_LENGTH
);
goto
error
;
}
parser
->
header_state
=
h_content_length
;
parser
->
header_state
=
h_content_length
;
parser
->
flags
|=
F_CONTENTLENGTH
;
}
}
break
;
break
;
...
@@ -1474,6 +1469,12 @@ reexecute:
...
@@ -1474,6 +1469,12 @@ reexecute:
goto
error
;
goto
error
;
}
}
if
(
parser
->
flags
&
F_CONTENTLENGTH
)
{
SET_ERRNO
(
HPE_UNEXPECTED_CONTENT_LENGTH
);
goto
error
;
}
parser
->
flags
|=
F_CONTENTLENGTH
;
parser
->
content_length
=
ch
-
'0'
;
parser
->
content_length
=
ch
-
'0'
;
break
;
break
;
...
...
third-party/http-parser/http_parser.h
View file @
a5d66e71
...
@@ -27,7 +27,7 @@ extern "C" {
...
@@ -27,7 +27,7 @@ extern "C" {
/* Also update SONAME in the Makefile whenever you change these. */
/* Also update SONAME in the Makefile whenever you change these. */
#define HTTP_PARSER_VERSION_MAJOR 2
#define HTTP_PARSER_VERSION_MAJOR 2
#define HTTP_PARSER_VERSION_MINOR 7
#define HTTP_PARSER_VERSION_MINOR 7
#define HTTP_PARSER_VERSION_PATCH
0
#define HTTP_PARSER_VERSION_PATCH
1
#include <sys/types.h>
#include <sys/types.h>
#if defined(_WIN32) && !defined(__MINGW32__) && \
#if defined(_WIN32) && !defined(__MINGW32__) && \
...
...
third-party/http-parser/test.c
View file @
a5d66e71
...
@@ -1745,6 +1745,32 @@ const struct message responses[] =
...
@@ -1745,6 +1745,32 @@ const struct message responses[] =
,.
body
=
""
,.
body
=
""
}
}
#define CONTENT_LENGTH_X 21
,
{.
name
=
"Content-Length-X"
,.
type
=
HTTP_RESPONSE
,.
raw
=
"HTTP/1.1 200 OK
\r\n
"
"Content-Length-X: 0
\r\n
"
"Transfer-Encoding: chunked
\r\n
"
"
\r\n
"
"2
\r\n
"
"OK
\r\n
"
"0
\r\n
"
"
\r\n
"
,.
should_keep_alive
=
TRUE
,.
message_complete_on_eof
=
FALSE
,.
http_major
=
1
,.
http_minor
=
1
,.
status_code
=
200
,.
response_status
=
"OK"
,.
num_headers
=
2
,.
headers
=
{
{
"Content-Length-X"
,
"0"
}
,
{
"Transfer-Encoding"
,
"chunked"
}
}
,.
body
=
"OK"
,.
num_chunks_complete
=
2
,.
chunk_lengths
=
{
2
}
}
,
{.
name
=
NULL
}
/* sentinel */
,
{.
name
=
NULL
}
/* sentinel */
};
};
...
@@ -3850,11 +3876,10 @@ test_message_connect (const struct message *msg)
...
@@ -3850,11 +3876,10 @@ test_message_connect (const struct message *msg)
{
{
char
*
buf
=
(
char
*
)
msg
->
raw
;
char
*
buf
=
(
char
*
)
msg
->
raw
;
size_t
buflen
=
strlen
(
msg
->
raw
);
size_t
buflen
=
strlen
(
msg
->
raw
);
size_t
nread
;
parser_init
(
msg
->
type
);
parser_init
(
msg
->
type
);
nread
=
parse_connect
(
buf
,
buflen
);
parse_connect
(
buf
,
buflen
);
if
(
num_messages
!=
1
)
{
if
(
num_messages
!=
1
)
{
printf
(
"
\n
*** num_messages != 1 after testing '%s' ***
\n\n
"
,
msg
->
name
);
printf
(
"
\n
*** num_messages != 1 after testing '%s' ***
\n\n
"
,
msg
->
name
);
...
...
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