From: Alain Schneble <a.s@realize.ch>
To: "Toke Høiland-Jørgensen" <toke@toke.dk>
Cc: Eli Zaretskii <eliz@gnu.org>,
emacs-devel@gnu.org, monnier@iro.umontreal.ca,
Dmitry Gutov <dgutov@yandex.ru>
Subject: Re: [PATCH] url: Wrap cookie headers in url-http--encode-string.
Date: Fri, 9 Sep 2016 20:02:43 +0200 [thread overview]
Message-ID: <86d1kdq7cs.fsf@realize.ch> (raw)
In-Reply-To: <87a8fiidso.fsf@toke.dk> ("Toke \=\?iso-8859-1\?Q\?H\=F8iland-J\=F8\?\= \=\?iso-8859-1\?Q\?rgensen\=22's\?\= message of "Thu, 08 Sep 2016 17:58:31 +0200")
Toke Høiland-Jørgensen <toke@toke.dk> writes:
> Dmitry Gutov <dgutov@yandex.ru> 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")
(url-cookie-write-file)
(url-cookie-parse-file)
(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.
Alain
next prev parent reply other threads:[~2016-09-09 18:02 UTC|newest]
Thread overview: 42+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-09-07 15:30 [PATCH] url: Wrap cookie headers in url-http--encode-string Toke Høiland-Jørgensen
2016-09-07 16:40 ` Stefan Monnier
2016-09-07 16:52 ` Toke Høiland-Jørgensen
2016-09-07 17:15 ` Eli Zaretskii
2016-09-07 18:25 ` Toke Høiland-Jørgensen
2016-09-08 14:06 ` Dmitry Gutov
2016-09-08 14:14 ` Toke Høiland-Jørgensen
2016-09-08 14:25 ` Dmitry Gutov
2016-09-08 15:58 ` Toke Høiland-Jørgensen
2016-09-08 17:20 ` Eli Zaretskii
2016-09-08 17:43 ` Toke Høiland-Jørgensen
2016-09-08 18:01 ` Eli Zaretskii
2016-09-08 17:47 ` Stefan Monnier
2016-09-08 18:04 ` Eli Zaretskii
2016-09-08 20:29 ` Alain Schneble
2016-09-09 7:57 ` Eli Zaretskii
2016-09-09 14:56 ` Alain Schneble
2016-09-09 15:04 ` Eli Zaretskii
2016-09-09 15:16 ` Alain Schneble
2016-09-09 15:06 ` Stefan Monnier
2016-09-09 15:15 ` Alain Schneble
2016-09-09 18:02 ` Alain Schneble [this message]
2016-09-09 18:07 ` Toke Høiland-Jørgensen
2016-09-09 18:54 ` Eli Zaretskii
2016-09-09 19:21 ` Alain Schneble
2016-09-09 19:32 ` Eli Zaretskii
2016-09-09 19:47 ` Alain Schneble
2016-09-09 19:49 ` Eli Zaretskii
2016-09-09 19:56 ` Toke Høiland-Jørgensen
2016-09-10 5:42 ` Eli Zaretskii
2016-09-10 8:34 ` Dmitry Gutov
2016-09-10 19:12 ` Eli Zaretskii
2016-09-09 20:01 ` distinguishing multibyte/unibyte ASCII (was: [PATCH] url: Wrap cookie headers in url-http--encode-string.) Stefan Monnier
2016-09-09 20:17 ` distinguishing multibyte/unibyte ASCII Toke Høiland-Jørgensen
2016-09-09 20:46 ` Stefan Monnier
2016-09-09 21:02 ` Alain Schneble
2016-09-10 5:50 ` distinguishing multibyte/unibyte ASCII (was: [PATCH] url: Wrap cookie headers in url-http--encode-string.) Eli Zaretskii
2016-09-07 19:14 ` [PATCH] url: Wrap cookie headers in url-http--encode-string Lars Ingebrigtsen
2016-09-07 20:49 ` Toke Høiland-Jørgensen
2016-09-08 2:47 ` Eli Zaretskii
2016-09-08 9:07 ` Lars Ingebrigtsen
2016-09-08 17:23 ` Eli Zaretskii
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=86d1kdq7cs.fsf@realize.ch \
--to=a.s@realize.ch \
--cc=dgutov@yandex.ru \
--cc=eliz@gnu.org \
--cc=emacs-devel@gnu.org \
--cc=monnier@iro.umontreal.ca \
--cc=toke@toke.dk \
/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.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.