GNU bug report logs - #31248
27.0.50; Regression: Multibyte text in HTTP request

Previous Next

Package: emacs;

Reported by: Aaron Jensen <aaronjensen <at> gmail.com>

Date: Mon, 23 Apr 2018 16:21:02 UTC

Severity: normal

Found in version 27.0.50

Done: Aaron Jensen <aaronjensen <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Aaron Jensen <aaronjensen <at> gmail.com>
Cc: 31248 <at> debbugs.gnu.org, Andreas Schwab <schwab <at> linux-m68k.org>
Subject: bug#31248: 27.0.50; Regression: Multibyte text in HTTP request
Date: Tue, 24 Apr 2018 14:17:38 +0200
Aaron Jensen <aaronjensen <at> gmail.com> writes:

> On Tue, Apr 24, 2018 at 5:06 AM, Lars Ingebrigtsen <larsi <at> gnus.org> wrote:
>> And this made the entire request string multibyte.
>
> Hm, that's odd. What does that have to do with the url-request-data w/
> the emoji?

That's the *really* obscure bit.  :-)

> If I change that to just an "x" then it won't fail in the
> same way:
>
> (let ((url "http://requestbin.fullcontact.com/1kkmrpx1")
>       (url-request-method "POST")
>       (url-request-data (encode-coding-string "x" 'utf-8))
>       (url-request-extra-headers '(("Content-Type" . "application/json")))
>       (url-http-proxy nil))
>   (url-retrieve url (lambda (_))))

So you start with a thing that's now multibyte:

(url-host u)
=> "requestbin.fullcontact.com"

(multibyte-string-p (url-host u))
=> t

(setq data (encode-coding-string "📦" 'utf-8))
(multibyte-string-p data)
=> nil

Then concatenate:

(setq foo (concat (url-host u) data))
"\360\237\223\246"
foo
=> "requestbin.fullcontact.com\360\237\223\246"
(multibyte-string-p foo)
=> t
(string-bytes data)
=> 4

(length foo)
=> 30
(string-bytes foo)
=> 34

Fun!  :-)

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




This bug report was last modified 7 years and 33 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.