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

Commit

Permalink
HTTP_STRICT ifdefs out behavior introduced in 50b9bec
Browse files Browse the repository at this point in the history
Fixes #37.
  • Loading branch information
ry committed May 24, 2011
1 parent b1c2cf8 commit 2839784
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 5 deletions.
5 changes: 3 additions & 2 deletions Makefile
@@ -1,5 +1,6 @@
OPT_DEBUG=-O0 -g -Wall -Wextra -Werror -I.
OPT_FAST=-O3 -DHTTP_PARSER_STRICT=0 -I.
CPPFLAGS?=-DHTTP_PARSER_STRICT=1
OPT_DEBUG=-O0 -g -Wall -Wextra -Werror -I. $(CPPFLAGS)
OPT_FAST=-O3 -DHTTP_PARSER_STRICT=0 -I. $(CPPFLAGS)

CC?=gcc

Expand Down
7 changes: 6 additions & 1 deletion http_parser.c
Expand Up @@ -191,6 +191,9 @@ static const uint8_t normal_url_char[256] = {
/* 120 x 121 y 122 z 123 { 124 | 125 } 126 ~ 127 del */
1, 1, 1, 1, 1, 1, 1, 0,

#if HTTP_PARSER_STRICT
0
#else
/* Remainder of non-ASCII range are accepted as-is to support implicitly UTF-8
encoded paths. This is out of spec, but clients generate this and most other
HTTP servers support it. We should, too. */
Expand All @@ -210,7 +213,9 @@ static const uint8_t normal_url_char[256] = {
1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1 };
1, 1, 1, 1, 1, 1, 1, 1
#endif
}; /* normal_url_char */


enum state
Expand Down
2 changes: 0 additions & 2 deletions http_parser.h
Expand Up @@ -49,8 +49,6 @@ typedef int ssize_t;
*/
#ifndef HTTP_PARSER_STRICT
# define HTTP_PARSER_STRICT 1
#else
# define HTTP_PARSER_STRICT 0
#endif


Expand Down
2 changes: 2 additions & 0 deletions test.c
Expand Up @@ -582,6 +582,7 @@ const struct message requests[] =
,.body= ""
}

#if !HTTP_PARSER_STRICT
#define UTF8_PATH_REQ 21
, {.name= "utf-8 path request"
,.type= HTTP_REQUEST
Expand All @@ -602,6 +603,7 @@ const struct message requests[] =
}
,.body= ""
}
#endif /* !HTTP_PARSER_STRICT */

#define QUERY_TERMINATED_HOST 22
, {.name= "host terminated by a query string"
Expand Down

1 comment on commit 2839784

@pgriess
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. I was just about to submit a patch for this ;)

Please sign in to comment.