From: Atom X Zane <atomx@deadlyhead.com>
To: 14370@debbugs.gnu.org
Subject: bug#14370: [PATCH] Write out HTTP Basic auth headers correctly
Date: Wed, 8 May 2013 01:50:15 -0700 [thread overview]
Message-ID: <87haidvlcd.fsf@atomx.deadlyhead.home> (raw)
HTTP Basic authorization headers are not output correctly, leaving off
the user credentials in the Authorization: header.
Test case:
(let ((req (build-request
(build-uri
'http
#:host "example.com")
#:headers '((authorization
basic . "dXNlcm5hbWU6cGFzc3dvcmQ=")
))))
(write-request req (current-output-port)))
Expected output:
> GET / HTTP/1.1
> Host: example.com
> Authorization: basic dXNlcm5hbWU6cGFzc3dvcmQ=
Actual output:
> GET / HTTP/1.1
> Host: example.com
> Authorization: basic
As you can see, the user credentials aren't actually written out,
causing the server to return a "401 Authorization required" response. I
have included a patch which remedies this problem.
-- Atom X Zane
* module/web/http.scm: modify write-credentials to display the
base64-encoded concatenation of username and password if the
authorization model is 'basic
---
module/web/http.scm | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/module/web/http.scm b/module/web/http.scm
index 35169ef..0e5db5d 100644
--- a/module/web/http.scm
+++ b/module/web/http.scm
@@ -913,10 +913,10 @@ as an ordered alist."
(define (write-credentials val port)
(display (car val) port)
+ (display #\space port)
(if (pair? (cdr val))
- (begin
- (display #\space port)
- (write-key-value-list (cdr val) port))))
+ (write-key-value-list (cdr val) port)
+ (display (cdr val) port)))
;; challenges = 1#challenge
;; challenge = auth-scheme 1*SP 1#auth-param
--
1.7.10.4
next reply other threads:[~2013-05-08 8:50 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-05-08 8:50 Atom X Zane [this message]
2014-01-21 21:59 ` bug#14370: [PATCH] Write out HTTP Basic auth headers correctly Mark H Weaver
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/guile/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87haidvlcd.fsf@atomx.deadlyhead.home \
--to=atomx@deadlyhead.com \
--cc=14370@debbugs.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).