summaryrefslogtreecommitdiff
path: root/client.c
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2013-01-02 19:07:17 +0100
committerFelix Fietkau <nbd@openwrt.org>2013-01-02 19:07:17 +0100
commit4f8d550c72658177b47111d2f64dfe94900b6df4 (patch)
treebb8d31e9d028e3f75da5c098776eaacce07b3ca3 /client.c
parent3c4d560581795dbb6c89ec9f08fade3adcc91024 (diff)
add support for sending HTTP/1.1 100 Continue
Diffstat (limited to 'client.c')
-rw-r--r--client.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/client.c b/client.c
index 3dc40e8..c5b82d2 100644
--- a/client.c
+++ b/client.c
@@ -141,6 +141,7 @@ static int client_parse_request(struct client *cl, char *data)
if (!type || !path || !version)
return CLIENT_STATE_DONE;
+ memset(&cl->request, 0, sizeof(cl->request));
req->url = path;
req->method = find_idx(http_methods, ARRAY_SIZE(http_methods), type);
if (req->method < 0)
@@ -191,6 +192,9 @@ static void client_header_complete(struct client *cl)
if (!rfc1918_filter_check(cl))
return;
+ if (cl->request.expect_cont)
+ ustream_printf(cl->us, "HTTP/1.1 100 Continue\r\n\r\n");
+
uh_handle_request(cl);
}
@@ -216,6 +220,10 @@ static void client_parse_header(struct client *cl, char *data)
if (isupper(*name))
*name = tolower(*name);
+ if (!strcasecmp(data, "Expect") &&
+ !strcasecmp(val, "100-continue"))
+ cl->request.expect_cont = true;
+
blobmsg_add_string(&cl->hdr, data, val);
cl->state = CLIENT_STATE_HEADER;