From: Felix Fietkau Date: Fri, 21 Mar 2014 20:27:30 +0000 (+0100) Subject: relay: do forward data if the http request type was HEAD X-Git-Url: http://git.openwrt.org/?a=commitdiff_plain;h=d6366570bf706f3970b7f106a1ccd49b584559cf;p=project%2Fuhttpd.git relay: do forward data if the http request type was HEAD Signed-off-by: Felix Fietkau --- diff --git a/proc.c b/proc.c index 5be6232..9c4b685 100644 --- a/proc.c +++ b/proc.c @@ -224,6 +224,9 @@ static void proc_handle_header_end(struct relay *r) ustream_printf(cl->us, "%s: %s\r\n", blobmsg_name(cur), blobmsg_data(cur)); ustream_printf(cl->us, "\r\n"); + + if (cl->request.method == UH_HTTP_MSG_HEAD) + r->skip_data = true; } static void proc_write_close(struct client *cl) diff --git a/relay.c b/relay.c index 6195349..7331a0a 100644 --- a/relay.c +++ b/relay.c @@ -142,7 +142,9 @@ static void relay_read_cb(struct ustream *s, int bytes) if (!buf || !len) return; - uh_chunk_write(cl, buf, len); + if (!r->skip_data) + uh_chunk_write(cl, buf, len); + ustream_consume(s, len); } diff --git a/uhttpd.h b/uhttpd.h index a620030..cace950 100644 --- a/uhttpd.h +++ b/uhttpd.h @@ -152,6 +152,8 @@ struct relay { bool process_done; bool error; + bool skip_data; + int ret; int header_ofs;