Skip to content
This repository was archived by the owner on Nov 6, 2022. It is now read-only.

Fix regression in IS_HEADER_CHAR check #283

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ CC = winegcc
BINEXT = .exe.so
HELPER = wine
else
SONAME ?= libhttp_parser.so.2.6.1
SONAME ?= libhttp_parser.so.2.6.2
SOEXT ?= so
endif

Expand Down
2 changes: 1 addition & 1 deletion http_parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,7 @@ enum http_host_state
* character or %x80-FF
**/
#define IS_HEADER_CHAR(ch) \
(ch == CR || ch == LF || ch == 9 || (ch > 31 && ch != 127))
(ch == CR || ch == LF || ch == 9 || ((unsigned char)ch > 31 && ch != 127))

This comment was marked as off-topic.


#define start_state (parser->type == HTTP_REQUEST ? s_start_req : s_start_res)

Expand Down
2 changes: 1 addition & 1 deletion http_parser.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 6
#define HTTP_PARSER_VERSION_PATCH 1
#define HTTP_PARSER_VERSION_PATCH 2

#include <sys/types.h>
#if defined(_WIN32) && !defined(__MINGW32__) && \
Expand Down
20 changes: 20 additions & 0 deletions test.c
Original file line number Diff line number Diff line change
Expand Up @@ -1153,6 +1153,26 @@ const struct message requests[] =
,.body= ""
}

#define HEADER_OBSTEXT 42
, {.name = "header obstext"
,.type=HTTP_REQUEST
,.raw= "GET /foo HTTP/1.1\r\n"
"X-Foo: Düsseldorf\r\n"
"\r\n"
,.should_keep_alive= TRUE
,.message_complete_on_eof= FALSE
,.http_major= 1
,.http_minor= 1
,.method= HTTP_GET
,.request_path= "/foo"
,.request_url= "/foo"
,.query_string= ""
,.fragment= ""
,.num_headers= 1
,.headers= {{"X-Foo", "Düsseldorf"}}
,.body= ""
}

, {.name= NULL } /* sentinel */
};

Expand Down