From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: =?UTF-8?q?Aleix=20Conchillo=20Flaqu=C3=A9?= Newsgroups: gmane.lisp.guile.devel Subject: [PATCH] web: authorization header scheme should be capitalized Date: Thu, 23 Jun 2022 13:27:59 -0700 Message-ID: <20220623202759.3578506-1-aconchillo@gmail.com> Mime-Version: 1.0 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="17490"; mail-complaints-to="usenet@ciao.gmane.io" Cc: =?UTF-8?q?Aleix=20Conchillo=20Flaqu=C3=A9?= To: guile-devel@gnu.org Original-X-From: guile-devel-bounces+guile-devel=m.gmane-mx.org@gnu.org Thu Jun 23 22:28:21 2022 Return-path: Envelope-to: guile-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1o4TR5-0004Lv-S4 for guile-devel@m.gmane-mx.org; Thu, 23 Jun 2022 22:28:19 +0200 Original-Received: from localhost ([::1]:53968 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o4TR4-0003Rm-Pb for guile-devel@m.gmane-mx.org; Thu, 23 Jun 2022 16:28:18 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:42210) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o4TQs-0003RL-1j for guile-devel@gnu.org; Thu, 23 Jun 2022 16:28:06 -0400 Original-Received: from mail-pg1-x529.google.com ([2607:f8b0:4864:20::529]:43821) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o4TQq-0004Tp-Gh for guile-devel@gnu.org; Thu, 23 Jun 2022 16:28:05 -0400 Original-Received: by mail-pg1-x529.google.com with SMTP id 68so465172pgb.10 for ; Thu, 23 Jun 2022 13:28:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=6RnjKe4i0xgPPlFYRx5pc6+DoC3O8bif6fLedl5gEOA=; b=RhoIC2GBQ/Xk/W+GfZiTsI9C8DHZxTBlNsCVXEyD5/jTgqpJDIjA/mwBB5LHGZVfMF oTmBzBdWUdJtfBAtQ0t7dkx+yQnK9Z8fq3S+rqnFBgiOTwRErjRTvgyn0OdW3Cq4udqY 7cYRFblQnLbia/Ej27G7NuT1SVT3yz0WPR7ZeYQLwaXaPy7yzfnmRlEQ+yhK928SxsHv sgMwPZhpNt/udAqE2g5klcZOQ+b8iw1jk1nkM/uZ7bFR0yKOv143Hs/bMSG88tnVxV9f 4CoYHT+IX7PIi5T4lNAxWsRfcW+6JgHYM/1nCVBVn8KCfoDjAPcrQ2Sq1Iu1uPlNo9yt SPDw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=6RnjKe4i0xgPPlFYRx5pc6+DoC3O8bif6fLedl5gEOA=; b=og25BatTO0pRoM8dwgsJozURpCG8qrKaLYVFqDpc5mcxgM0T+XHlNcRd32pl9v6KUx vH7ksLRRb+EAcNWiHXBUsi1GUjYJa8jftAhrvE2d8Djc1rPTfCvBUIAhdrq9JVUDNFap TKsdZPHGEnyJLSGl9KCr4xzB4xXAkMcu5v3Udn6AFJDLq6sagh4jXGHjK47zxJXItKfU nLUqOg/3I1oekGwCzTyV2Xz462r8IAPKdEGNi1bB6ETVOhfm/oYAw6oAEF3l/L6BAySA kTY9tJgBpXxq/UOoOYTzdOQfhYAHLJ09GR+WR0OxC9Gwk+KOrptO6mjK4vw+8KP577n7 1l0w== X-Gm-Message-State: AJIora+Z6FVzHDpomp42C8jJriN4VBN8n3+IkGrcxOPGynS80Uq90C/7 ZHPQBOD5MrfWGB0SXLLPcNcci89/5+0= X-Google-Smtp-Source: AGRyM1uXfNFM/zzdNeNdzqSehJFhqo7XTbj7F1EWdSZg7MkHYxY4EboMBqwEfadODAdT1Ff0wAY48Q== X-Received: by 2002:a05:6a00:2af:b0:525:13b0:4099 with SMTP id q15-20020a056a0002af00b0052513b04099mr29055832pfs.71.1656016082648; Thu, 23 Jun 2022 13:28:02 -0700 (PDT) Original-Received: from localhost (cpe-198-72-134-0.socal.res.rr.com. [198.72.134.0]) by smtp.gmail.com with UTF8SMTPSA id h25-20020aa796d9000000b0051ba97b788bsm70358pfq.27.2022.06.23.13.28.01 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 23 Jun 2022 13:28:02 -0700 (PDT) X-Mailer: git-send-email 2.34.1 Received-SPF: pass client-ip=2607:f8b0:4864:20::529; envelope-from=aconchillo@gmail.com; helo=mail-pg1-x529.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Developers list for Guile, the GNU extensibility library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-devel-bounces+guile-devel=m.gmane-mx.org@gnu.org Original-Sender: "guile-devel" Xref: news.gmane.io gmane.lisp.guile.devel:21226 Archived-At: * 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