Commits
- Commit:
fe3fcc3a56d76b914c9673099634579c91897840- From:
- kirill <kirill@openbsd.org>
- Date:
relayd: strip Content-Length for chunked messages
RFC 9112 section 6.1 requires an intermediary that forwards a message
carrying Transfer-Encoding to remove any received Content-Length first.
relayd already parses the body as chunked in this case, but previously
left Content-Length in the header tree, so the backend could receive
both framing fields and choose a different message boundary.
When chunked framing is selected, remove Content-Length before header
emission; this preserves relayd's chunked body handling while avoiding
CL.TE ambiguity downstream.
Reproted by: Stuart Thomas
OK: rsaodwski@
- Commit:
b62a1edfe3cff4df2c3931d28a5f5dd58ed9406d- From:
- rsadowski <rsadowski@openbsd.org>
- Date:
relayd: reject obs-fold to prevent parser differentials (RFC 9112 5.2)
Replace silent kv_extend normalisation with an unconditional reject.
RFC 9112 5.2 permits rejection; it is safer than SP replacement
for a forwarding proxy and handles both request and response direction.
kv_extend is therefore no longer required.
Reported by Stuart Thomas, OK kirill@
- Commit:
ee2597096652830f488428a76fe8eb91c92ac82d- From:
- rsadowski <rsadowski@openbsd.org>
- Date:
relayd: add support for the MKCALENDAR HTTP method
relayd is missing this method from the WebDAV/CalDAV extensions. This causes
issues when using relayd as a reverse proxy in front of CalDAV servers like
Nextcloud.
OK kirill@
- Commit:
05a099a8f45a2d2132479e114f734065e2e12f45- From:
- kirill <kirill@openbsd.org>
- Date:
usr.sbin/relayd: handle HTTP responses without bodies
RFC 9112 section 6.3 specifies that responses to HEAD requests, and
responses with 1xx, 204, or 304 status codes, are terminated by the
empty line after the header section regardless of Content-Length or
Transfer-Encoding. They cannot contain a message body or trailer
section.
Teach relayd to apply that framing rule before deciding whether a
response body is bounded. Otherwise relayd treats these responses as
unbounded, adds Connection: close, and can forward both the backend's
Connection: keep-alive and its own Connection: close.
Tweaks and OK: rsadowski@
- Commit:
4c3a9f7f9d06e22d34bebc20a495ec845a46b824- From:
- tb <tb@openbsd.org>
- Date:
relayd: error check bsearch in relay_httperror_byid()
If relay_httperror_byid() is passed a HTTP error code not in the table
this would result in a NULL deref. The intent is that the code fall back
to "Unknown error" on NULL return.
From Jan Schreiber
- Commit:
7ef192f50c90fdf6076af21336101fafcccfe678- From:
- tb <tb@openbsd.org>
- Date:
relayd: fix NULL check for strdup()
Due to a copy-paste error, relay_lookup_query() would check the wrong kv
member for NULL.
From Jan Schreiber
- Commit:
192c004f0b9ce8bc0c0ad277ea43052717f12cf9- From:
- rsadowski <rsadowski@openbsd.org>
- Date:
Move HTTP start-line logic to a dedicated function
This is a structural refactoring with no functional change.
OK kirill
- Commit:
6b5c4000434cc5dc67e202d8aede2f543b5b2bf3- From:
- rsadowski <rsadowski@openbsd.org>
- Date:
Standardize logging with bgpd
OK claudio@
- Commit:
158279cc4bb747491259166e29f248ce32e3d6b4- From:
- rsadowski <rsadowski@openbsd.org>
- Date:
fix missing initialisation
It is possible that "request_method" is checked without having been
initialised in line 439.
OK kirill@ stsp@
- Commit:
952c015b38f9d4dcaf68a269c4018a920f35eb5f- From:
- tb <tb@openbsd.org>
- Date:
relayd: fix relay_http_time() to emit GMT times again
The HTTP standard RFC 9110 requires GMT, in HTTP-date. We used to do this
until a recent modification to localtime.c changed GMT to UTC.
sync from httpd
- Commit:
a4d9f8427a0b519ebdae371a4d1354182e8fcbb5- From:
- anton <anton@openbsd.org>
- Date:
Fix regression introduced in previous causing HEAD requests to be
erroneously rejected as malformed.
ok chrisz@
- Commit:
13b29be6c948661d67a2a3b020deb5be219a20fd- From:
- chrisz <chrisz@openbsd.org>
- Date:
Keep Content-length header in HEAD responses.
ok millert@
- Commit:
5a4941b3d51f5b3484ee279b6b2809e607feaf13- From:
- florian <florian@openbsd.org>
- Date:
cleanup unused variable
- Commit:
3e59c1b6888eddd11b8d7084945a4f04f5744c9f- From:
- millert <millert@openbsd.org>
- Date:
relay_read_http: strip out Content-Length if we strip the body too
We should not forward Content-Length if the body is not also forwarded.
- Commit:
0e047fe72a6224af32278dca0072894b891bea96- From:
- millert <millert@openbsd.org>
- Date:
relay_read_http: defer header parsing until after line continuation
Wait until we have a complete line before parsing the Content-Length,
Transfer-Encoding and Host headers. This prevents potential request
smuggling attacks. Filtering already happens after header line
continuation has been performed. Reported by Ben Kallus.
OK claudio@
- Commit:
d335681c1131dd288fbd162698bdb7001f82fad7- From:
- millert <millert@openbsd.org>
- Date:
relay_read_http: tighten up header parsing
1) reject headers with embedded NULs
2) reject headers with invalid characters in the name
3) reject Transfer-Encoding with values other than "chunked"
4) reject chunk values containing non-hex characters
5) reject Content-Length values of "+0" or "-0"
6) reject requests without a ' ' and headers without a ':'
Reported by Ben Kallus, OK bluhm@
- Commit:
c97398dfac7959fc0f0d0fad8f9107fd6d0d0002- From:
- jmc <jmc@openbsd.org>
- Date:
{en,de}queing -> {en,de}queuing; from paul tagliamonte
- Commit:
7e7eb993c27a57fef189e7865ef5c38770a386ae- From:
- benno <benno@openbsd.org>
- Date:
do not duplicate "Connection: close" headers and only add it if its
not a websockets response.
Reported by Marcus MERIGHI and Jonathon Fletcher, this fix is by Jonathon, Thanks!
ok claudio@
- Commit:
e4d9aa924d63f25d6d38da9e49a9f9cdf96a98b4- From:
- benno <benno@openbsd.org>
- Date:
The output of server_root_strip() is a string. Use the correct format
"%s". Same for the output of relay_expand_http().
with and ok claudio@
Found by Cedric Tessier, thanks!
- Commit:
94c8a65e1db2bd36b1efb39bcb8ddb0634b49c8b- From:
- benno <benno@openbsd.org>
- Date:
Responses to HEAD requests must not have a message body (even though they have
a Content-Length header). HTTP RFC 7231 section 4.3.2.
found by niklas@, claudio@ agrees.
- Commit:
d498e80a114cd078ac00398a2d648ec0f9175e44- From:
- denis <denis@openbsd.org>
- Date:
Add 'strip' directive
Feedback by Olivier Cherrier, Hiltjo Posthuma, Mischa
OK benno@
- Commit:
c3aaa0baf31c6a93a831a16a4f85f532b943d824- From:
- bket <bket@openbsd.org>
- Date:
Replace TAILQ concatenation loop with TAILQ_CONCAT
OK millert@, florian@
- Commit:
d9d7e70831be72ebf5273a07c9e6e84552e7e40a- From:
- chrisz <chrisz@openbsd.org>
- Date:
Don't "forward to <table>" when a "forward to destination" address is set.
This matches the documented behaviour.
On matching "forward to <table>" filter rules the "forward to destination"
address is unset, so that in that case the "forward to <table>" rule is still
used.
OK benno@, regression tests still passing.
- Commit:
4cc2f5fd363be14cef61c876edcbaf5e373cc60a- From:
- robert <robert@openbsd.org>
- Date:
Add a new macro called $HOST that expands to the Host header's value or falls
back to the same value as $SERVER_ADDR in case the Host header is not available.
ok reyk@
- Commit:
41f2ab1c6849a05b2193e170de407ad2603aeda9- From:
- reyk <reyk@openbsd.org>
- Date:
Add Connection: close when switching to "unlimited" reading mode.
Ask the server to close the connection after the request since we
don't read any further request headers. This fixes an issue with
OPTIONS and optional body, as well as similar cases.
Reported and tested by Rivo Nurges
OK benno@
