There was a race in relayd that caused connections to hang. It
authorbluhm <bluhm@openbsd.org>
Sun, 10 Aug 2014 21:55:17 +0000 (21:55 +0000)
committerbluhm <bluhm@openbsd.org>
Sun, 10 Aug 2014 21:55:17 +0000 (21:55 +0000)
happend with non-persistent PUT connections that had a very short
body.  If the whole body was read from the client before the
connection to the server was set up, the event callback was not
called.  Do the regular checks after relay_connect() succeeded.
OK reyk@

usr.sbin/relayd/relay_http.c

index 53d3af6..8c711df 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: relay_http.c,v 1.32 2014/07/17 11:35:26 stsp Exp $    */
+/*     $OpenBSD: relay_http.c,v 1.33 2014/08/10 21:55:17 bluhm Exp $   */
 
 /*
  * Copyright (c) 2006 - 2014 Reyk Floeter <reyk@openbsd.org>
@@ -427,9 +427,10 @@ relay_read_http(struct bufferevent *bev, void *arg)
                                relay_bindanyreq(con, 0, IPPROTO_TCP);
                                return;
                        }
-                       if (relay_connect(con) == -1)
+                       if (relay_connect(con) == -1) {
                                relay_abort_http(con, 502, "session failed", 0);
-                       return;
+                               return;
+                       }
                }
        }
        if (con->se_done) {