X-Git-Url: http://git.archive.openwrt.org/?p=project%2Fuhttpd.git;a=blobdiff_plain;f=relay.c;h=7331a0a59d2eedbe25e984b8b60a0d62580581c9;hp=1b55d41cb312bd2cd3c03f80c601acd13c3928ae;hb=b965b8cc10f094ec0408d57b1bc9aeee0bca501c;hpb=d58f77ad52caa52e91cf698e60a5a43c5d870e84 diff --git a/relay.c b/relay.c index 1b55d41..7331a0a 100644 --- a/relay.c +++ b/relay.c @@ -28,6 +28,7 @@ void uh_relay_free(struct relay *r) if (r->proc.pending) kill(r->proc.pid, SIGKILL); + uloop_timeout_cancel(&r->timeout); uloop_process_delete(&r->proc); ustream_free(&r->sfd.stream); close(r->sfd.fd.fd); @@ -55,6 +56,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 +120,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) { /* @@ -139,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); }