From: "Aleix Conchillo Flaqué" <aconchillo@gmail.com>
To: Mark H Weaver <mhw@netris.org>
Cc: guile-devel <guile-devel@gnu.org>
Subject: Re: [PATCH] web: uri-encode hexadecimal percent-encoding is now uppercase
Date: Thu, 2 May 2013 12:15:35 -0700 [thread overview]
Message-ID: <CA+XASoVqykR=8-uYE3X=qZmvd-yWtnz2drvneyTToxkOOz_OKA@mail.gmail.com> (raw)
In-Reply-To: <8761z1gqmu.fsf@tines.lan>
[-- Attachment #1: Type: text/plain, Size: 373 bytes --]
On Thu, May 2, 2013 at 11:53 AM, Mark H Weaver <mhw@netris.org> wrote:
> Hi Aleix,
>
> This patch looks good to me, except that I don't like the variable name
> 'num' for a string. Actually, I'm not sure we need to bind that to a
> variable at all. How about just wrapping 'string-upcase' around the
> call to 'number->string'?
>
Makes sense. Let's see this one.
Aleix
[-- Attachment #2: uri-encode-uppercase.patch --]
[-- Type: application/octet-stream, Size: 2622 bytes --]
From 8f1d8b7f4c08d81c44884697e9fed717be27e857 Mon Sep 17 00:00:00 2001
From: Aleix Conchillo Flaque <aconchillo@gmail.com>
Date: Thu, 2 May 2013 12:13:31 -0700
Subject: [PATCH] web: uri-encode hexadecimal percent-encoding is now
uppercase
* module/web/uri.scm (uri-encode): the hexadecimal percent-encoding %HH
is now uppercased as suggested by RFC3986:
"For consistency, URI producers and normalizers should use
uppercase hexadecimal digits for all percent-encodings."
---
module/web/uri.scm | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/module/web/uri.scm b/module/web/uri.scm
index 7fe0100..3ab820d 100644
--- a/module/web/uri.scm
+++ b/module/web/uri.scm
@@ -6,12 +6,12 @@
;;;; modify it under the terms of the GNU Lesser General Public
;;;; License as published by the Free Software Foundation; either
;;;; version 3 of the License, or (at your option) any later version.
-;;;;
+;;;;
;;;; This library is distributed in the hope that it will be useful,
;;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
;;;; Lesser General Public License for more details.
-;;;;
+;;;;
;;;; You should have received a copy of the GNU Lesser General Public
;;;; License along with this library; if not, write to the Free Software
;;;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
@@ -20,7 +20,7 @@
;;; Commentary:
;; A data type for Universal Resource Identifiers, as defined in RFC
-;; 3986.
+;; 3986.
;;; Code:
@@ -382,7 +382,7 @@ The default character set includes alphanumerics from ASCII, as well as
the special characters ‘-’, ‘.’, ‘_’, and ‘~’. Any other character will
be percent-encoded, by writing out the character to a bytevector within
the given ENCODING, then encoding each byte as ‘%HH’, where HH is the
-hexadecimal representation of the byte."
+uppercase hexadecimal representation of the byte."
(define (needs-escaped? ch)
(not (char-set-contains? unescaped-chars ch)))
(if (string-index str needs-escaped?)
@@ -400,7 +400,8 @@ hexadecimal representation of the byte."
(display #\% port)
(when (< byte 16)
(display #\0 port))
- (display (number->string byte 16) port)
+ (display (string-upcase (number->string byte 16))
+ port)
(lp (1+ i))))))))
str)))
str))
--
1.7.10.4
next prev parent reply other threads:[~2013-05-02 19:15 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-05-02 17:44 [PATCH] web: uri-encode hexadecimal percent-encoding is now uppercase Aleix Conchillo Flaqué
2013-05-02 18:53 ` Mark H Weaver
2013-05-02 19:15 ` Aleix Conchillo Flaqué [this message]
2013-05-02 21:17 ` Mark H Weaver
2013-05-02 23:50 ` Aleix Conchillo Flaqué
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='CA+XASoVqykR=8-uYE3X=qZmvd-yWtnz2drvneyTToxkOOz_OKA@mail.gmail.com' \
--to=aconchillo@gmail.com \
--cc=guile-devel@gnu.org \
--cc=mhw@netris.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).