When the HTTP client did close the connection while relayd was still
authorbluhm <bluhm@openbsd.org>
Wed, 29 Apr 2015 08:41:24 +0000 (08:41 +0000)
committerbluhm <bluhm@openbsd.org>
Wed, 29 Apr 2015 08:41:24 +0000 (08:41 +0000)
commit24d4a724de16ad797ec19cc8fe3fddf67e011e6c
tree326b26d004569d4aa3304af7abb6393b8e72f49a
parent4412839d968417cd48850043b6079664471189d4
When the HTTP client did close the connection while relayd was still
parsig the HTTP header, the session was never destroyed.  This
resulted in a file descriptor leak.
Add a check wether the protocol knows how much data to expect.  If
relayd is reading unlimited data or is expecting nothing to read,
ignore the end-of-file.  Otherwise it is a protocol violation, so
close the session immediately.
While there, make relayd compile with DEBUG defined.
Based on a diff from claudio@; tested by claudio@; OK claudio@ benno@
usr.sbin/relayd/relay.c
usr.sbin/relayd/relay_http.c