commit 6f311a06cf64ab61689e2d5c0fd04d84b8551bf9
parent 97c67f7cfb4076973dfbacfcfdf1773d4b9c3666
Author: Joris Vink <joris@coders.se>
Date:   Mon, 25 Nov 2013 14:21:47 +0100
Do not get stuck processing HTTP requests, found by Thorduri
Diffstat:
1 file changed, 2 insertions(+), 7 deletions(-)
diff --git a/src/net.c b/src/net.c
@@ -193,11 +193,6 @@ net_recv(struct connection *c)
 			r = SSL_get_error(c->ssl, r);
 			switch (r) {
 			case SSL_ERROR_WANT_READ:
-				c->flags &= ~CONN_READ_POSSIBLE;
-				if (nb->flags & NETBUF_CALL_CB_ALWAYS &&
-				    nb->s_off > 0)
-					goto handle;
-				return (KORE_RESULT_OK);
 			case SSL_ERROR_WANT_WRITE:
 				c->flags &= ~CONN_READ_POSSIBLE;
 				return (KORE_RESULT_OK);
@@ -208,8 +203,8 @@ net_recv(struct connection *c)
 		}
 
 		nb->s_off += (size_t)r;
-		if (nb->s_off == nb->b_len) {
-handle:
+		if (nb->s_off == nb->b_len ||
+		    (nb->flags & NETBUF_CALL_CB_ALWAYS)) {
 			r = nb->cb(nb);
 			if (nb->s_off == nb->b_len ||
 			    (nb->flags & NETBUF_FORCE_REMOVE)) {