relay: do not process headers after the first error
authorFelix Fietkau <nbd@openwrt.org>
Thu, 23 May 2013 10:50:08 +0000 (12:50 +0200)
committerFelix Fietkau <nbd@openwrt.org>
Thu, 23 May 2013 10:50:08 +0000 (12:50 +0200)
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
relay.c
uhttpd.h

diff --git a/relay.c b/relay.c
index 1b55d41cb312bd2cd3c03f80c601acd13c3928ae..0540bd8e58d29d118293fc466becd8db6260b0be 100644 (file)
--- a/relay.c
+++ b/relay.c
@@ -55,6 +55,7 @@ static void relay_error(struct relay *r)
        struct ustream *s = &r->sfd.stream;
        int len;
 
+       r->error = true;
        s->eof = true;
        ustream_get_read_buf(s, &len);
        if (len)
@@ -118,7 +119,8 @@ static void relay_read_cb(struct ustream *s, int bytes)
        if (r->process_done)
                uloop_timeout_set(&r->timeout, 1);
 
-       relay_process_headers(r);
+       if (!r->error)
+               relay_process_headers(r);
 
        if (r->header_cb) {
                /*
index 59f1565737538c9d7df4a07b1a13f967c5f62da8..0137eef53ab5fcdf1ad535d8132f62c365b655c7 100644 (file)
--- a/uhttpd.h
+++ b/uhttpd.h
@@ -150,6 +150,7 @@ struct relay {
        struct client *cl;
 
        bool process_done;
+       bool error;
        int ret;
        int header_ofs;