chunked encoding may include empty lines at random places, do not
authorreyk <reyk@openbsd.org>
Fri, 8 Aug 2008 20:34:30 +0000 (20:34 +0000)
committerreyk <reyk@openbsd.org>
Fri, 8 Aug 2008 20:34:30 +0000 (20:34 +0000)
abort the session if we get an empty line except of the expected chunk
header.

usr.sbin/relayd/relay.c

index 8f47023..8c02fbf 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: relay.c,v 1.99 2008/08/08 19:13:24 reyk Exp $ */
+/*     $OpenBSD: relay.c,v 1.100 2008/08/08 20:34:30 reyk Exp $        */
 
 /*
  * Copyright (c) 2006, 2007, 2008 Reyk Floeter <reyk@openbsd.org>
@@ -1188,7 +1188,8 @@ relay_read_httpchunks(struct bufferevent *bev, void *arg)
        if (!cre->toread) {
                line = evbuffer_readline(src);
                if (line == NULL) {
-                       relay_close(con, "invalid chunk");
+                       /* Ignore empty line, continue */
+                       bufferevent_enable(bev, EV_READ);
                        return;
                }
                if (!strlen(line)) {