Add secure field to HTTP_Request to mark whether the underlying connection uses TLS or not

This commit is contained in:
2025-09-18 09:19:38 +02:00
parent a63e68f969
commit b1021deb15
7 changed files with 24 additions and 8 deletions
+2 -4
View File
@@ -1003,6 +1003,8 @@ static int parse_request(Scanner *s, HTTP_Request *req)
if (!contains_head(s->src + s->cur, s->len - s->cur))
return 0;
req->secure = false;
if (0) {}
else if (consume_str(s, HTTP_STR("GET "))) req->method = HTTP_METHOD_GET;
else if (consume_str(s, HTTP_STR("POST "))) req->method = HTTP_METHOD_POST;
@@ -1015,10 +1017,6 @@ static int parse_request(Scanner *s, HTTP_Request *req)
else if (consume_str(s, HTTP_STR("PATCH "))) req->method = HTTP_METHOD_PATCH;
else return -1;
if (s->cur == s->len || s->src[s->cur] != ' ')
return -1;
s->cur++;
{
Scanner s2 = *s;
int peek = s->cur;