unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
* [PATCH] web: authorization header scheme should be capitalized
@ 2022-06-23 19:15 Aleix Conchillo Flaqué
  0 siblings, 0 replies; 12+ messages in thread
From: Aleix Conchillo Flaqué @ 2022-06-23 19:15 UTC (permalink / raw)
  To: guile-devel; +Cc: Aleix Conchillo Flaqué

* module/web/http.scm (write-credentials): capitalize authorization
header scheme. See, for example,
https://datatracker.ietf.org/doc/html/rfc7617#section-2
---
 module/web/http.scm | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/module/web/http.scm b/module/web/http.scm
index 4276e1744..312c28934 100644
--- a/module/web/http.scm
+++ b/module/web/http.scm
@@ -965,10 +965,10 @@ as an ordered alist."
 (define (write-credentials val port)
   (match val
     (('basic . cred)
-     (put-string port "basic ")
+     (put-string port "Basic ")
      (put-string port cred))
     ((scheme . params)
-     (put-symbol port scheme)
+     (put-string port (string-titlecase (symbol->string scheme)))
      (put-char port #\space)
      (write-key-value-list params port))))
 
-- 
2.34.1




^ permalink raw reply related	[flat|nested] 12+ messages in thread
* [PATCH] web: authorization header scheme should be capitalized
@ 2022-06-23 20:27 Aleix Conchillo Flaqué
  2022-06-23 20:33 ` Aleix Conchillo Flaqué
  2022-06-23 20:40 ` Maxime Devos
  0 siblings, 2 replies; 12+ messages in thread
From: Aleix Conchillo Flaqué @ 2022-06-23 20:27 UTC (permalink / raw)
  To: guile-devel; +Cc: Aleix Conchillo Flaqué

* module/web/http.scm (write-credentials): capitalize authorization
header scheme. See, for example,
https://datatracker.ietf.org/doc/html/rfc7617#section-2
---
 module/web/http.scm            | 4 ++--
 test-suite/tests/web-http.test | 7 ++++---
 2 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/module/web/http.scm b/module/web/http.scm
index 4276e1744..312c28934 100644
--- a/module/web/http.scm
+++ b/module/web/http.scm
@@ -965,10 +965,10 @@ as an ordered alist."
 (define (write-credentials val port)
   (match val
     (('basic . cred)
-     (put-string port "basic ")
+     (put-string port "Basic ")
      (put-string port cred))
     ((scheme . params)
-     (put-symbol port scheme)
+     (put-string port (string-titlecase (symbol->string scheme)))
      (put-char port #\space)
      (write-key-value-list params port))))
 
diff --git a/test-suite/tests/web-http.test b/test-suite/tests/web-http.test
index 63377349c..df25030de 100644
--- a/test-suite/tests/web-http.test
+++ b/test-suite/tests/web-http.test
@@ -336,9 +336,10 @@
   (pass-if-parse authorization "Digest foooo" '(digest foooo))
   (pass-if-parse authorization "Digest foo=bar,baz=qux"
                  '(digest (foo . "bar") (baz . "qux")))
-  (pass-if-round-trip "Authorization: basic foooo\r\n")
-  (pass-if-round-trip "Authorization: digest foooo\r\n")
-  (pass-if-round-trip "Authorization: digest foo=bar, baz=qux\r\n")
+  (pass-if-round-trip "Authorization: Basic foooo\r\n")
+  (pass-if-round-trip "Authorization: Bearer token\r\n")
+  (pass-if-round-trip "Authorization: Digest foooo\r\n")
+  (pass-if-round-trip "Authorization: Digest foo=bar, baz=qux\r\n")
   (pass-if-parse expect "100-continue, foo" '((100-continue) (foo)))
   (pass-if-parse from "foo@bar" "foo@bar")
   (pass-if-parse host "qux" '("qux" . #f))
-- 
2.34.1




^ permalink raw reply related	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2022-06-24 13:41 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-06-23 19:15 [PATCH] web: authorization header scheme should be capitalized Aleix Conchillo Flaqué
  -- strict thread matches above, loose matches on Subject: below --
2022-06-23 20:27 Aleix Conchillo Flaqué
2022-06-23 20:33 ` Aleix Conchillo Flaqué
2022-06-23 20:40 ` Maxime Devos
2022-06-23 20:42   ` Aleix Conchillo Flaqué
2022-06-23 20:45     ` Maxime Devos
2022-06-23 21:13       ` Aleix Conchillo Flaqué
2022-06-23 22:20         ` Maxime Devos
2022-06-24  1:46           ` Aleix Conchillo Flaqué
2022-06-24  8:35             ` Maxime Devos
2022-06-24 13:41               ` Aleix Conchillo Flaqué
2022-06-24 12:16             ` Dr. Arne Babenhauserheide

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).