Skip to content

Commit

Permalink
HTTP: Introduce quoted target marker in HTTP parsing
Browse files Browse the repository at this point in the history
The quoted_target field is to indentify URLs containing
percent-encoded characters. It can be used in places
where you might need to generate new URL, such as in the
proxy module.
It will be used in the subsequent commit.
  • Loading branch information
hongzhidao committed Apr 11, 2024
1 parent 6269777 commit 64934e5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 12 deletions.
15 changes: 4 additions & 11 deletions src/nxt_http_parse.c
Original file line number Diff line number Diff line change
Expand Up @@ -286,13 +286,11 @@ nxt_http_parse_request_line(nxt_http_request_parse_t *rp, u_char **pos,
case NXT_HTTP_TARGET_SPACE:
rp->target_end = p;
goto space_after_target;
#if 0

case NXT_HTTP_TARGET_QUOTE_MARK:
rp->quoted_target = 1;
goto rest_of_target;
#else
case NXT_HTTP_TARGET_QUOTE_MARK:
#endif

case NXT_HTTP_TARGET_HASH:
rp->complex_target = 1;
goto rest_of_target;
Expand Down Expand Up @@ -434,12 +432,7 @@ nxt_http_parse_request_line(nxt_http_request_parse_t *rp, u_char **pos,

rp->request_line_end = p;

if (rp->complex_target != 0
#if 0
|| rp->quoted_target != 0
#endif
)
{
if (rp->complex_target || rp->quoted_target) {
rc = nxt_http_parse_complex_target(rp);

if (nxt_slow_path(rc != NXT_OK)) {
Expand Down Expand Up @@ -1041,7 +1034,7 @@ nxt_http_parse_complex_target(nxt_http_request_parse_t *rp)
break;

case sw_quoted:
//rp->quoted_target = 1;
rp->quoted_target = 1;

if (ch >= '0' && ch <= '9') {
high = (u_char) (ch - '0');
Expand Down
2 changes: 1 addition & 1 deletion src/nxt_http_parse.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,9 @@ struct nxt_http_request_parse_s {

/* target with "/." */
uint8_t complex_target; /* 1 bit */
#if 0
/* target with "%" */
uint8_t quoted_target; /* 1 bit */
#if 0
/* target with " " */
uint8_t space_in_target; /* 1 bit */
#endif
Expand Down

0 comments on commit 64934e5

Please sign in to comment.