[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] url: Wrap cookie headers in url-http--encode-string.

From: Alain Schneble
Subject: Re: [PATCH] url: Wrap cookie headers in url-http--encode-string.
Date: Fri, 9 Sep 2016 20:02:43 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4 (windows-nt)

Toke Høiland-Jørgensen <address@hidden> writes:

> Dmitry Gutov <address@hidden> writes:
>> Could you post the full recipe?
> (url-retrieve-synchronously "http://google.se";) ; sets a cookie
> (let* ((url-request-data (encode-coding-string "æøå" 'utf-8)))
>        (url-retrieve-synchronously "http://google.se";)) ; crashes

Just two notes on this:

1. This example uses a GET request with some body data.  I don't think
   that this is a real use case.  Of course, with other requests such as
   POST, where some body data is typically sent, we might run into the
   same issue.

2. The reason why it crashes in this example is not because the cookie
   contains some non-ascii characters but because the ascii-only
   cookie-value gets converted into a multibyte string internally.  If
   you save and reload the cookie file after the first
   `url-retrieve-synchronously' that sets the cookie, the error goes
   away.  So this ...

   (url-retrieve-synchronously "http://google.se";)
   (let* ((url-request-data (encode-coding-string "æøå" 'utf-8)))
         (url-retrieve-synchronously "http://google.se";))

   ... works properly.

   The point is that while accepting and parsing the cookie, the
   cookie-value gets turned into a multibyte string in `url-parse-args'
   called from `url-cookie-handle-set-cookie'.  Not sure if that should
   happen if a multibyte string is not really needed...
   And while reloading the cookie file, the cookie-value is read back as
   a non multibyte-string, as I would have expected it to be in the
   first place.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]