Use relative reference URIs in Location header on directory redirects.
authordv <dv@openbsd.org>
Thu, 29 Apr 2021 18:23:07 +0000 (18:23 +0000)
committerdv <dv@openbsd.org>
Thu, 29 Apr 2021 18:23:07 +0000 (18:23 +0000)
commitcb8c4e3e16b5e498a825202c2567d5fef1b6d2fe
treefefd8fb520bfeeb713166c49cf6761c84257eea8
parent4cf001dcc25cc2a1e539f59074a67b24c366319a
Use relative reference URIs in Location header on directory redirects.

This adds support for front-ending httpd(8) with a TLS-terminating
gateway like relayd(8) that forwards unencrypted http traffic.

Previously httpd(8) would use a full URL in the Location header in 301
redirects when a user-agent requests a directory but without the
trailing '/'. If the user-agent originally connected with https, this
caused the redirected url to be http.

This change conforms to RFC7231 section 7.1.2.

Reported by Vincent Lee.

OK claudio@
usr.sbin/httpd/server_file.c