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
bebea5e1
Commit
bebea5e1
authored
Nov 19, 2012
by
Tatsuhiro Tsujikawa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update http-parser
parent
542fd642
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
39 additions
and
34 deletions
+39
-34
src/http-parser/AUTHORS
src/http-parser/AUTHORS
+1
-0
src/http-parser/README.md
src/http-parser/README.md
+1
-1
src/http-parser/http_parser.c
src/http-parser/http_parser.c
+0
-8
src/http-parser/http_parser.gyp
src/http-parser/http_parser.gyp
+34
-2
src/http-parser/http_parser.h
src/http-parser/http_parser.h
+2
-21
src/http-parser/test.c
src/http-parser/test.c
+1
-2
No files found.
src/http-parser/AUTHORS
View file @
bebea5e1
...
@@ -35,3 +35,4 @@ Simon Zimmermann <simonz05@gmail.com>
...
@@ -35,3 +35,4 @@ Simon Zimmermann <simonz05@gmail.com>
Erik Dubbelboer <erik@dubbelboer.com>
Erik Dubbelboer <erik@dubbelboer.com>
Martell Malone <martellmalone@gmail.com>
Martell Malone <martellmalone@gmail.com>
Bertrand Paquet <bpaquet@octo.com>
Bertrand Paquet <bpaquet@octo.com>
BogDan Vatra <bogdan@kde.org>
src/http-parser/README.md
View file @
bebea5e1
...
@@ -36,7 +36,7 @@ using `http_parser_init()` and set the callbacks. That might look something
...
@@ -36,7 +36,7 @@ using `http_parser_init()` and set the callbacks. That might look something
like this for a request parser:
like this for a request parser:
http_parser_settings settings;
http_parser_settings settings;
settings.on_
path = my_path
_callback;
settings.on_
url = my_url
_callback;
settings.on_header_field = my_header_field_callback;
settings.on_header_field = my_header_field_callback;
/* ... */
/* ... */
...
...
src/http-parser/http_parser.c
View file @
bebea5e1
...
@@ -51,18 +51,10 @@
...
@@ -51,18 +51,10 @@
# define ELEM_AT(a, i, v) ((unsigned int) (i) < ARRAY_SIZE(a) ? (a)[(i)] : (v))
# define ELEM_AT(a, i, v) ((unsigned int) (i) < ARRAY_SIZE(a) ? (a)[(i)] : (v))
#endif
#endif
#if HTTP_PARSER_DEBUG
#define SET_ERRNO(e) \
do { \
parser->http_errno = (e); \
parser->error_lineno = __LINE__; \
} while (0)
#else
#define SET_ERRNO(e) \
#define SET_ERRNO(e) \
do { \
do { \
parser->http_errno = (e); \
parser->http_errno = (e); \
} while(0)
} while(0)
#endif
/* Run the notify callback FOR, returning ER if it fails */
/* Run the notify callback FOR, returning ER if it fails */
...
...
src/http-parser/http_parser.gyp
View file @
bebea5e1
...
@@ -12,6 +12,7 @@
...
@@ -12,6 +12,7 @@
# RuntimeLibrary MUST MATCH across the entire project
# RuntimeLibrary MUST MATCH across the entire project
'Debug': {
'Debug': {
'defines': [ 'DEBUG', '_DEBUG' ],
'defines': [ 'DEBUG', '_DEBUG' ],
'cflags': [ '-Wall', '-Wextra', '-O0', '-g', '-ftrapv' ],
'msvs_settings': {
'msvs_settings': {
'VCCLCompilerTool': {
'VCCLCompilerTool': {
'RuntimeLibrary': 1, # static debug
'RuntimeLibrary': 1, # static debug
...
@@ -20,6 +21,7 @@
...
@@ -20,6 +21,7 @@
},
},
'Release': {
'Release': {
'defines': [ 'NDEBUG' ],
'defines': [ 'NDEBUG' ],
'cflags': [ '-Wall', '-Wextra', '-O3' ],
'msvs_settings': {
'msvs_settings': {
'VCCLCompilerTool': {
'VCCLCompilerTool': {
'RuntimeLibrary': 0, # static release
'RuntimeLibrary': 0, # static release
...
@@ -51,6 +53,7 @@
...
@@ -51,6 +53,7 @@
'type': 'static_library',
'type': 'static_library',
'include_dirs': [ '.' ],
'include_dirs': [ '.' ],
'direct_dependent_settings': {
'direct_dependent_settings': {
'defines': [ 'HTTP_PARSER_STRICT=0' ],
'include_dirs': [ '.' ],
'include_dirs': [ '.' ],
},
},
'defines': [ 'HTTP_PARSER_STRICT=0' ],
'defines': [ 'HTTP_PARSER_STRICT=0' ],
...
@@ -69,11 +72,40 @@
...
@@ -69,11 +72,40 @@
},
},
{
{
'target_name': 'test',
'target_name': 'http_parser_strict',
'type': 'static_library',
'include_dirs': [ '.' ],
'direct_dependent_settings': {
'defines': [ 'HTTP_PARSER_STRICT=1' ],
'include_dirs': [ '.' ],
},
'defines': [ 'HTTP_PARSER_STRICT=1' ],
'sources': [ './http_parser.c', ],
'conditions': [
['OS=="win"', {
'msvs_settings': {
'VCCLCompilerTool': {
# Compile as C++. http_parser.c is actually C99, but C++ is
# close enough in this case.
'CompileAs': 2,
},
},
}]
],
},
{
'target_name': 'test-nonstrict',
'type': 'executable',
'type': 'executable',
'dependencies': [ 'http_parser' ],
'dependencies': [ 'http_parser' ],
'sources': [ 'test.c' ]
'sources': [ 'test.c' ]
},
{
'target_name': 'test-strict',
'type': 'executable',
'dependencies': [ 'http_parser_strict' ],
'sources': [ 'test.c' ]
}
}
]
]
}
}
src/http-parser/http_parser.h
View file @
bebea5e1
...
@@ -24,7 +24,7 @@
...
@@ -24,7 +24,7 @@
extern
"C"
{
extern
"C"
{
#endif
#endif
#define HTTP_PARSER_VERSION_MAJOR
1
#define HTTP_PARSER_VERSION_MAJOR
2
#define HTTP_PARSER_VERSION_MINOR 0
#define HTTP_PARSER_VERSION_MINOR 0
#include <sys/types.h>
#include <sys/types.h>
...
@@ -51,14 +51,6 @@ typedef SSIZE_T ssize_t;
...
@@ -51,14 +51,6 @@ typedef SSIZE_T ssize_t;
# define HTTP_PARSER_STRICT 1
# define HTTP_PARSER_STRICT 1
#endif
#endif
/* Compile with -DHTTP_PARSER_DEBUG=1 to add extra debugging information to
* the error reporting facility.
*/
#ifndef HTTP_PARSER_DEBUG
# define HTTP_PARSER_DEBUG 0
#endif
/* Maximium header size allowed */
/* Maximium header size allowed */
#define HTTP_MAX_HEADER_SIZE (80*1024)
#define HTTP_MAX_HEADER_SIZE (80*1024)
...
@@ -77,7 +69,7 @@ typedef struct http_parser_settings http_parser_settings;
...
@@ -77,7 +69,7 @@ typedef struct http_parser_settings http_parser_settings;
* chunked' headers that indicate the presence of a body.
* chunked' headers that indicate the presence of a body.
*
*
* http_data_cb does not return data chunks. It will be call arbitrarally
* http_data_cb does not return data chunks. It will be call arbitrarally
* many times for each string. E.G. you might get 10 callbacks for "on_
path
"
* many times for each string. E.G. you might get 10 callbacks for "on_
url
"
* each providing just a few characters more data.
* each providing just a few characters more data.
*/
*/
typedef
int
(
*
http_data_cb
)
(
http_parser
*
,
const
char
*
at
,
size_t
length
);
typedef
int
(
*
http_data_cb
)
(
http_parser
*
,
const
char
*
at
,
size_t
length
);
...
@@ -196,13 +188,6 @@ enum http_errno {
...
@@ -196,13 +188,6 @@ enum http_errno {
/* Get an http_errno value from an http_parser */
/* Get an http_errno value from an http_parser */
#define HTTP_PARSER_ERRNO(p) ((enum http_errno) (p)->http_errno)
#define HTTP_PARSER_ERRNO(p) ((enum http_errno) (p)->http_errno)
/* Get the line number that generated the current error */
#if HTTP_PARSER_DEBUG
#define HTTP_PARSER_ERRNO_LINE(p) ((p)->error_lineno)
#else
#define HTTP_PARSER_ERRNO_LINE(p) 0
#endif
struct
http_parser
{
struct
http_parser
{
/** PRIVATE **/
/** PRIVATE **/
...
@@ -229,10 +214,6 @@ struct http_parser {
...
@@ -229,10 +214,6 @@ struct http_parser {
*/
*/
unsigned
char
upgrade
:
1
;
unsigned
char
upgrade
:
1
;
#if HTTP_PARSER_DEBUG
uint32_t
error_lineno
;
#endif
/** PUBLIC **/
/** PUBLIC **/
void
*
data
;
/* A pointer to get hook to the "connection" or "socket" object */
void
*
data
;
/* A pointer to get hook to the "connection" or "socket" object */
};
};
...
...
src/http-parser/test.c
View file @
bebea5e1
...
@@ -1954,8 +1954,7 @@ upgrade_message_fix(char *body, const size_t nread, const size_t nmsgs, ...) {
...
@@ -1954,8 +1954,7 @@ upgrade_message_fix(char *body, const size_t nread, const size_t nmsgs, ...) {
static
void
static
void
print_error
(
const
char
*
raw
,
size_t
error_location
)
print_error
(
const
char
*
raw
,
size_t
error_location
)
{
{
fprintf
(
stderr
,
"
\n
*** %s:%d -- %s ***
\n\n
"
,
fprintf
(
stderr
,
"
\n
*** %s ***
\n\n
"
,
"http_parser.c"
,
HTTP_PARSER_ERRNO_LINE
(
parser
),
http_errno_description
(
HTTP_PARSER_ERRNO
(
parser
)));
http_errno_description
(
HTTP_PARSER_ERRNO
(
parser
)));
int
this_line
=
0
,
char_len
=
0
;
int
this_line
=
0
,
char_len
=
0
;
...
...
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