1
0
Fork 0

http: Support HEAD

This commit is contained in:
Xavier Del Campo Romero 2023-10-02 23:37:44 +02:00
parent b43adf9a00
commit 07e0063870
Signed by untrusted user: xavi
GPG Key ID: 84FF3612A9BF43F2
2 changed files with 6 additions and 1 deletions

4
http.c
View File

@ -359,6 +359,8 @@ static int start_line(struct http_ctx *const h)
c->op = HTTP_OP_GET;
else if (!strncmp(line, "POST", n))
c->op = HTTP_OP_POST;
else if (!strncmp(line, "HEAD", n))
c->op = HTTP_OP_HEAD;
else
{
fprintf(stderr, "%s: unsupported HTTP op %.*s\n",
@ -1039,6 +1041,8 @@ static int header_cr_line(struct http_ctx *const h)
switch (c->op)
{
case HTTP_OP_GET:
/* Fall through. */
case HTTP_OP_HEAD:
return process_payload(h, line);
case HTTP_OP_POST:

View File

@ -10,7 +10,8 @@ struct http_payload
enum http_op
{
HTTP_OP_GET,
HTTP_OP_POST
HTTP_OP_POST,
HTTP_OP_HEAD
} op;
const char *resource;