Skip to content

Commit

Permalink
* test/request.c (serve_check_reqline, target_forms):
Browse files Browse the repository at this point in the history
  Better failure mode, no functional change.
  • Loading branch information
notroj committed Apr 24, 2024
1 parent 6b0c605 commit 9368047
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions test/request.c
Original file line number Diff line number Diff line change
Expand Up @@ -2290,9 +2290,10 @@ static int serve_check_reqline(ne_socket *sock, void *userdata)

NE_DEBUG(NE_DBG_HTTP, "child: got request-line %s\n", buffer);

ONCMPN(expect, buffer, "request-line", "check for absolute URI");

return single_serve_string(sock, RESP200 "Connection: close\r\n\r\n");
if (strcmp(expect, buffer) != 0)
return single_serve_string(sock, "HTTP/1.1 400 Bad Request-Line\r\n" EMPTY_RESP);
else
return single_serve_string(sock, RESP200 "Connection: close\r\n\r\n");
}

/* Test that various request target forms are allowed. */
Expand All @@ -2314,7 +2315,7 @@ static int target_forms(void)

CALL(make_session(&sess, serve_check_reqline, (void *)ts[n].reqline));

ONREQ(any_request(sess, ts[n].uri));
ONREQ(any_2xx_request(sess, ts[n].uri));

CALL(destroy_and_wait(sess));
}
Expand Down

0 comments on commit 9368047

Please sign in to comment.