From: "Aleix Conchillo Flaqué" <aconchillo@gmail.com>
To: guile-devel <guile-devel@gnu.org>
Subject: [PATCH] web: uri-encode hexadecimal percent-encoding is now uppercase
Date: Thu, 2 May 2013 10:44:20 -0700 [thread overview]
Message-ID: <CA+XASoVOmZt39LiOGAW7=Y+P3Q2nOOgr=H7_VnOv5pLQy2SkhA@mail.gmail.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 167 bytes --]
This patch changes the way uri-encode does percent-encoding. The
hexadecimal characters are now uppercase as suggested by RFC3986. So,
(uri-encode "/")
=> %2F
Aleix
[-- Attachment #2: uri-encode-uppercase.patch --]
[-- Type: application/octet-stream, Size: 2885 bytes --]
From 9909cae88e9bdf03b4253170a8669e5eb667b2b6 Mon Sep 17 00:00:00 2001
From: Aleix Conchillo Flaque <aconchillo@gmail.com>
Date: Thu, 2 May 2013 10:39:18 -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 | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/module/web/uri.scm b/module/web/uri.scm
index 7fe0100..df5a792 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?)
@@ -396,11 +396,12 @@ hexadecimal representation of the byte."
(len (bytevector-length bv)))
(let lp ((i 0))
(if (< i len)
- (let ((byte (bytevector-u8-ref bv i)))
+ (let* ((byte (bytevector-u8-ref bv i))
+ (num (number->string byte 16)))
(display #\% port)
(when (< byte 16)
(display #\0 port))
- (display (number->string byte 16) port)
+ (display (string-upcase num) port)
(lp (1+ i))))))))
str)))
str))
--
1.7.10.4
next reply other threads:[~2013-05-02 17:44 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-05-02 17:44 Aleix Conchillo Flaqué [this message]
2013-05-02 18:53 ` [PATCH] web: uri-encode hexadecimal percent-encoding is now uppercase Mark H Weaver
2013-05-02 19:15 ` Aleix Conchillo Flaqué
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+XASoVOmZt39LiOGAW7=Y+P3Q2nOOgr=H7_VnOv5pLQy2SkhA@mail.gmail.com' \
--to=aconchillo@gmail.com \
--cc=guile-devel@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).