[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] http-client: Support basic authentication.
From: |
Ricardo Wurmus |
Subject: |
Re: [PATCH] http-client: Support basic authentication. |
Date: |
Wed, 16 Dec 2015 11:51:15 +0100 |
I sent this patch after making a tiny untested change, which broke
http-fetch unexpectedly.
This does not work:
(let*-values ((auth-header
(match (uri-userinfo uri)
((str) (cons 'Authorization
(string-append "Basic "
(base64-encode
(string->utf8 str)))))
(_ '())))
...) ...)
With that I get this error:
web/request.scm:183:10: In procedure build-request:
web/request.scm:183:10: Bad request: Header not a pair: ()
Binding the result of (uri-userinfo uri) fixes it:
(let*-values ((userinfo (uri-userinfo uri))
(auth-header
(match userinfo
((str) (cons 'Authorization
(string-append "Basic "
(base64-encode
(string->utf8 str)))))
(_ '())))
...) ...)
I don’t understand this. Does (uri-userinfo uri) return multiple
values?
~~ Ricardo