Skip to content

Commit 64934e5

Browse files
committed
HTTP: Introduce quoted target marker in HTTP parsing
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.
1 parent 6269777 commit 64934e5

File tree

2 files changed

+5
-12
lines changed

2 files changed

+5
-12
lines changed

src/nxt_http_parse.c

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -286,13 +286,11 @@ nxt_http_parse_request_line(nxt_http_request_parse_t *rp, u_char **pos,
286286
case NXT_HTTP_TARGET_SPACE:
287287
rp->target_end = p;
288288
goto space_after_target;
289-
#if 0
289+
290290
case NXT_HTTP_TARGET_QUOTE_MARK:
291291
rp->quoted_target = 1;
292292
goto rest_of_target;
293-
#else
294-
case NXT_HTTP_TARGET_QUOTE_MARK:
295-
#endif
293+
296294
case NXT_HTTP_TARGET_HASH:
297295
rp->complex_target = 1;
298296
goto rest_of_target;
@@ -434,12 +432,7 @@ nxt_http_parse_request_line(nxt_http_request_parse_t *rp, u_char **pos,
434432

435433
rp->request_line_end = p;
436434

437-
if (rp->complex_target != 0
438-
#if 0
439-
|| rp->quoted_target != 0
440-
#endif
441-
)
442-
{
435+
if (rp->complex_target || rp->quoted_target) {
443436
rc = nxt_http_parse_complex_target(rp);
444437

445438
if (nxt_slow_path(rc != NXT_OK)) {
@@ -1041,7 +1034,7 @@ nxt_http_parse_complex_target(nxt_http_request_parse_t *rp)
10411034
break;
10421035

10431036
case sw_quoted:
1044-
//rp->quoted_target = 1;
1037+
rp->quoted_target = 1;
10451038

10461039
if (ch >= '0' && ch <= '9') {
10471040
high = (u_char) (ch - '0');

src/nxt_http_parse.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,9 @@ struct nxt_http_request_parse_s {
6161

6262
/* target with "/." */
6363
uint8_t complex_target; /* 1 bit */
64-
#if 0
6564
/* target with "%" */
6665
uint8_t quoted_target; /* 1 bit */
66+
#if 0
6767
/* target with " " */
6868
uint8_t space_in_target; /* 1 bit */
6969
#endif

0 commit comments

Comments
 (0)