[http] Gracefully handle offers of multiple authentication schemes
authorMichael Brown <mcb30@ipxe.org>
Tue, 7 Nov 2017 11:33:13 +0000 (11:33 +0000)
committerMichael Brown <mcb30@ipxe.org>
Sun, 12 Nov 2017 18:52:03 +0000 (18:52 +0000)
commitc49acbb4d2d84c6cb2faacd18fa21ed5d12ed450
tree8a8903067c05a1a79a4f5baba5f4bff13b71882e
parentfc2f0dd93013d0037e2dd442eb0b71174ad8412d
[http] Gracefully handle offers of multiple authentication schemes

Servers may provide multiple WWW-Authenticate headers, each offering a
different authentication scheme.  We currently fail the request as
soon as we encounter an unrecognised scheme, which prevents subsequent
offers from succeeding.

Fix by silently ignoring headers for schemes that we do not recognise.
If no schemes are recognised then the request will eventually fail
anyway due to the 401 response code.

If multiple schemes are supported, arbitrarily choose the scheme
appearing first within the response headers.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
src/net/tcp/httpauth.c