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 1b55d41..0540bd8 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;
 
        struct ustream *s = &r->sfd.stream;
        int len;
 
+       r->error = true;
        s->eof = true;
        ustream_get_read_buf(s, &len);
        if (len)
        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);
 
        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) {
                /*
 
        if (r->header_cb) {
                /*
index 59f1565..0137eef 100644 (file)
--- a/uhttpd.h
+++ b/uhttpd.h
@@ -150,6 +150,7 @@ struct relay {
        struct client *cl;
 
        bool process_done;
        struct client *cl;
 
        bool process_done;
+       bool error;
        int ret;
        int header_ofs;
 
        int ret;
        int header_ofs;