From 78ff51b3ebd230a926118179b3e5aea4d4529ea6 Mon Sep 17 00:00:00 2001 From: Alexander Bluhm Date: Wed, 4 Sep 2013 22:21:33 +0000 Subject: Handling of HTTP requests with a body like POST were broken in relayd. Instead of checking for the direction RELAY_DIR_RESPONSE, set toread to 0 if we don't expect a body. OK reyk@ --- usr.sbin/relayd/relay_http.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/usr.sbin/relayd/relay_http.c b/usr.sbin/relayd/relay_http.c index 5b933eb5412..a7925b44c2f 100644 --- a/usr.sbin/relayd/relay_http.c +++ b/usr.sbin/relayd/relay_http.c @@ -1,4 +1,4 @@ -/* $OpenBSD: relay_http.c,v 1.15 2013/06/02 18:02:45 reyk Exp $ */ +/* $OpenBSD: relay_http.c,v 1.16 2013/09/04 22:21:32 bluhm Exp $ */ /* * Copyright (c) 2006 - 2012 Reyk Floeter @@ -324,6 +324,8 @@ relay_read_http(struct bufferevent *bev, void *arg) case HTTP_METHOD_GET: case HTTP_METHOD_HEAD: case HTTP_METHOD_OPTIONS: + cre->toread = 0; + /* FALLTHROUGH */ case HTTP_METHOD_POST: case HTTP_METHOD_PUT: case HTTP_METHOD_RESPONSE: @@ -331,9 +333,8 @@ relay_read_http(struct bufferevent *bev, void *arg) if (cre->toread > 0) bev->readcb = relay_read_httpcontent; - /* Single-pass HTTP response */ - if (cre->dir == RELAY_DIR_RESPONSE && - cre->toread < 0) { + /* Single-pass HTTP body */ + if (cre->toread < 0) { cre->toread = TOREAD_UNLIMITED; bev->readcb = relay_read; } -- cgit v1.2.3