Update http-parser to feae95a3a69f111bc1897b9048d9acbc290992f9
This commit is contained in:
parent
3de2654223
commit
a5d66e71d0
|
@ -148,7 +148,7 @@ callback in a threadsafe manner. This allows http-parser to be used in
|
|||
multi-threaded contexts.
|
||||
|
||||
Example:
|
||||
```
|
||||
```c
|
||||
typedef struct {
|
||||
socket_t sock;
|
||||
void* buffer;
|
||||
|
|
|
@ -1366,12 +1366,7 @@ reexecute:
|
|||
|| c != CONTENT_LENGTH[parser->index]) {
|
||||
parser->header_state = h_general;
|
||||
} 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->flags |= F_CONTENTLENGTH;
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -1474,6 +1469,12 @@ reexecute:
|
|||
goto error;
|
||||
}
|
||||
|
||||
if (parser->flags & F_CONTENTLENGTH) {
|
||||
SET_ERRNO(HPE_UNEXPECTED_CONTENT_LENGTH);
|
||||
goto error;
|
||||
}
|
||||
|
||||
parser->flags |= F_CONTENTLENGTH;
|
||||
parser->content_length = ch - '0';
|
||||
break;
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@ extern "C" {
|
|||
/* Also update SONAME in the Makefile whenever you change these. */
|
||||
#define HTTP_PARSER_VERSION_MAJOR 2
|
||||
#define HTTP_PARSER_VERSION_MINOR 7
|
||||
#define HTTP_PARSER_VERSION_PATCH 0
|
||||
#define HTTP_PARSER_VERSION_PATCH 1
|
||||
|
||||
#include <sys/types.h>
|
||||
#if defined(_WIN32) && !defined(__MINGW32__) && \
|
||||
|
|
|
@ -1745,6 +1745,32 @@ const struct message responses[] =
|
|||
,.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 */
|
||||
};
|
||||
|
||||
|
@ -3850,11 +3876,10 @@ test_message_connect (const struct message *msg)
|
|||
{
|
||||
char *buf = (char*) msg->raw;
|
||||
size_t buflen = strlen(msg->raw);
|
||||
size_t nread;
|
||||
|
||||
parser_init(msg->type);
|
||||
|
||||
nread = parse_connect(buf, buflen);
|
||||
parse_connect(buf, buflen);
|
||||
|
||||
if (num_messages != 1) {
|
||||
printf("\n*** num_messages != 1 after testing '%s' ***\n\n", msg->name);
|
||||
|
|
Loading…
Reference in New Issue