all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Philipp Stephani <p.stephani2@gmail.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: larsi@gnus.org, dgutov@yandex.ru, kentaro.nakazawa@nifty.com,
	emacs-devel@gnu.org
Subject: Re: bug#23750: 25.0.95; bug in url-retrieve or json.el
Date: Wed, 28 Dec 2016 18:35:58 +0000	[thread overview]
Message-ID: <CAArVCkRbhekuCx=PuHV85nmF1-DySiAG2=QE7coNFmVOWKLMTw@mail.gmail.com> (raw)
In-Reply-To: <83mvffvrh7.fsf@gnu.org>

[-- Attachment #1: Type: text/plain, Size: 3307 bytes --]

Eli Zaretskii <eliz@gnu.org> schrieb am Mi., 28. Dez. 2016 um 19:28 Uhr:

> > From: Philipp Stephani <p.stephani2@gmail.com>
> > Date: Wed, 28 Dec 2016 18:09:52 +0000
> > Cc: larsi@gnus.org, dgutov@yandex.ru, kentaro.nakazawa@nifty.com,
> >       emacs-devel@gnu.org
> >
> >
> > [1:text/plain Show]
> >
> >
> > [2:text/html Hide Save:noname (9kB)]
> >
> > Eli Zaretskii <eliz@gnu.org> schrieb am Mi., 30. Nov. 2016 um 19:45 Uhr:
> >
> >  > From: Philipp Stephani <p.stephani2@gmail.com>
> >  > Date: Wed, 30 Nov 2016 18:23:14 +0000
> >  > Cc: dgutov@yandex.ru, kentaro.nakazawa@nifty.com, emacs-devel@gnu.org
> >  >
> >  > > Yes, this is not a json.el problem at all. It does the correct
> thing,
> >  > > and shouldn't be changed.
> >  >
> >  > ??? Why should any code care whether a pure-ASCII string is marked as
> >  > unibyte or as multibyte? Both are "correct".
> >  >
> >  > I guess the problem is that process-send-string cares. If it didn't,
> we wouldn't have the problem.
> >
> >  I don't think I follow. The error we are talking about is signaled
> >  from url-http-create-request, not from process-send-string.
> >
> > Yes, but url-http-create-request only cares about unibyte strings
> because the request it creates is passed to
> > process-send-string, which special-cases unibyte strings.
>
> How do you see that process-send-string special-cases unibyte strings?
>

The send_process function has two branches, one for unibyte, one for
multibyte.


>
> >  > For URL, we'd need functions like
> >  > (byte-array-length s) = (length (string-to-unibyte s))
> >
> >  Why do you need this? string-to-unibyte is well-defined only for
> >  unibyte or ASCII strings (if we forget the raw bytes for a moment), so
> >  length will do.
> >
> > We need it because we have to send the byte length in a header. We can't
> just use (length s) because it
> > would silently give a wrong result.
>
> We are miscommunicating.  string-to-unibyte can only meaningfully be
> called on a pure-ASCII string, and for pure-ASCII strings 'length'
> will count bytes.  So I see no need for 'byte-array-length' if its
> implementation is as you indicated.
>

That depends on how you want to represent byte arrays/octet streams in
Emacs. If you want to represent them using unibyte strings, then you indeed
only need `length'. But some earlier messages sounded like you wanted to
represent byte arrays either using unibyte strings or byte-only multibyte
strings. In that case `string-to-unibyte' is necessary.


>
> >  > (process-send-bytes s) = (process-send-string (string-to-unibyte s))
> >
> >  Why is this needed? process-send-string already encodes its argument,
> >  which produces a unibyte string.
> >
> > We can't give a multibyte string to process-send-string, because we have
> to pass the length in bytes in a
> > header first. Therefore we have to encode any string before passing it
> to process-send-string.
>
> Once you encoded the string, why do you need anything except calling
> process-send-string?
>
>
The byte size should be added as a Content-length HTTP header. If
url-request-data is a unibyte string, that's not a problem (except for the
newline conversion behavior in send_string), you can just use `length'. But
if it's a multibyte string, you need to encode first to find the byte
length.

[-- Attachment #2: Type: text/html, Size: 6155 bytes --]

  reply	other threads:[~2016-12-28 18:35 UTC|newest]

Thread overview: 125+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-29  8:22 bug#23750: 25.0.95; bug in url-retrieve or json.el Kentaro NAKAZAWA
2016-11-29  9:54 ` Andreas Schwab
2016-11-29 10:06   ` Kentaro NAKAZAWA
2016-11-29 10:08     ` Dmitry Gutov
2016-11-29 10:23       ` Kentaro NAKAZAWA
2016-11-29 10:34         ` Lars Ingebrigtsen
2016-11-29 10:38           ` Kentaro NAKAZAWA
2016-11-29 10:42             ` Lars Ingebrigtsen
2016-11-29 10:48               ` Kentaro NAKAZAWA
2016-11-29 10:49               ` Dmitry Gutov
2016-11-29 10:50             ` Dmitry Gutov
2016-11-29 10:55               ` Kentaro NAKAZAWA
2016-11-29 10:59                 ` Dmitry Gutov
2016-11-29 11:03                   ` Kentaro NAKAZAWA
2016-11-29 11:05                     ` Dmitry Gutov
2016-11-29 11:12                       ` Kentaro NAKAZAWA
2016-11-29 17:23                       ` Eli Zaretskii
2016-11-29 23:09                         ` Philipp Stephani
2016-11-29 23:18                           ` Philipp Stephani
2016-11-30 15:11                             ` Eli Zaretskii
2016-11-30 15:20                               ` Lars Ingebrigtsen
2016-11-30 15:43                                 ` Eli Zaretskii
2016-11-30 15:46                                   ` Lars Ingebrigtsen
2016-11-30  0:16                           ` Dmitry Gutov
2016-11-30 15:13                             ` Eli Zaretskii
2016-11-30 15:17                               ` Dmitry Gutov
2016-11-30 15:32                                 ` Stefan Monnier
2016-11-30 15:42                                 ` Eli Zaretskii
2016-11-30 15:45                                   ` Dmitry Gutov
2016-11-30 15:48                                     ` Lars Ingebrigtsen
2016-11-30 16:25                                       ` Eli Zaretskii
2016-11-30 16:27                                         ` Lars Ingebrigtsen
2016-11-30 16:42                                           ` Eli Zaretskii
2016-11-30 18:25                                             ` Philipp Stephani
2016-11-30 18:48                                               ` Eli Zaretskii
2016-12-28 18:18                                                 ` Philipp Stephani
2016-12-28 18:34                                                   ` Eli Zaretskii
2016-12-28 18:45                                                     ` Philipp Stephani
2016-12-28 18:55                                                       ` Eli Zaretskii
2016-12-28 19:03                                                       ` Andreas Schwab
2016-11-30 18:23                                         ` Philipp Stephani
2016-11-30 18:44                                           ` Eli Zaretskii
2016-12-28 18:09                                             ` Philipp Stephani
2016-12-28 18:27                                               ` Eli Zaretskii
2016-12-28 18:35                                                 ` Philipp Stephani [this message]
2016-12-28 18:45                                                   ` Eli Zaretskii
2016-12-28 18:22                                       ` Philipp Stephani
2016-12-28 18:57                                         ` Lars Ingebrigtsen
2016-12-30  0:07                                           ` Richard Stallman
2016-12-30 14:15                                             ` Lars Ingebrigtsen
2016-12-30 16:59                                               ` Eli Zaretskii
2017-01-21 15:39                                                 ` Lars Ingebrigtsen
2017-01-21 15:56                                                   ` Eli Zaretskii
2017-01-21 16:30                                                     ` Lars Ingebrigtsen
2017-01-21 22:58                                                       ` Stefan Monnier
2017-01-24 20:04                                                         ` Lars Ingebrigtsen
2017-01-28  9:52                                                           ` Elias Mårtenson
2017-01-28 14:16                                                             ` Lars Ingebrigtsen
2016-12-30 21:38                                               ` Richard Stallman
2016-11-30 16:23                                     ` Eli Zaretskii
2016-12-01  0:30                                       ` Dmitry Gutov
2016-12-01 17:17                                         ` Eli Zaretskii
2016-12-02 13:18                                           ` Dmitry Gutov
2016-12-02 14:24                                             ` Eli Zaretskii
2016-12-02 14:35                                               ` Dmitry Gutov
2016-12-02 15:20                                                 ` Eli Zaretskii
2016-12-02 14:53                                               ` Yuri Khan
2016-12-02 15:45                                                 ` Eli Zaretskii
2016-12-02 15:51                                                 ` Lars Ingebrigtsen
2016-12-02 15:58                                                   ` Eli Zaretskii
2016-12-02 15:29                                             ` Lars Ingebrigtsen
2016-12-02 15:32                                               ` Dmitry Gutov
2016-12-02 15:48                                                 ` Lars Ingebrigtsen
2016-12-02 15:56                                                   ` Dmitry Gutov
2016-12-02 16:02                                                     ` Lars Ingebrigtsen
2016-12-02 16:06                                                       ` Dmitry Gutov
2016-12-02 16:31                                                         ` Lars Ingebrigtsen
2016-12-02 23:13                                                           ` Dmitry Gutov
2016-12-03  0:37                                                             ` Lars Ingebrigtsen
2016-12-03  1:27                                                               ` Dmitry Gutov
2016-12-03  8:12                                                               ` Eli Zaretskii
2016-12-03 10:01                                                                 ` Lars Ingebrigtsen
2016-12-03 16:00                                                                   ` Stefan Monnier
2016-12-03 20:01                                                                     ` Lars Ingebrigtsen
2016-12-03 20:57                                                                       ` Andreas Schwab
2016-12-28 18:25                                         ` Philipp Stephani
2016-11-30 15:06                           ` Eli Zaretskii
2016-11-30 15:31                             ` Stefan Monnier
  -- strict thread matches above, loose matches on Subject: below --
2016-06-12  2:22 Leo Liu
2016-06-13 15:02 ` Dmitry Gutov
2016-06-13 17:55   ` Stefan Monnier
2016-06-13 19:26     ` Dmitry Gutov
2016-06-14  0:30       ` Stefan Monnier
2016-06-19 18:14         ` Dmitry Gutov
2016-06-19 18:25           ` Eli Zaretskii
2016-06-19 18:30             ` John Wiegley
2016-06-19 18:45               ` Dmitry Gutov
2016-06-19 19:56                 ` John Wiegley
2016-06-19 20:05                   ` Dmitry Gutov
2016-06-19 21:07                     ` John Wiegley
2016-06-20  1:28                       ` Glenn Morris
2016-06-20  4:22                         ` John Wiegley
2016-06-20 12:39                           ` Lars Ingebrigtsen
2016-07-01 20:49                             ` John Wiegley
2016-06-20 14:42                           ` Eli Zaretskii
2016-06-23 17:14                           ` Glenn Morris
2016-06-20  1:26                   ` Glenn Morris
2016-06-20  2:58                   ` Dmitry Gutov
2016-06-19 18:36             ` Dmitry Gutov
2016-06-20  0:15               ` Leo Liu
2016-06-20 14:39                 ` Eli Zaretskii
2016-06-20  2:40               ` Eli Zaretskii
2016-06-20  2:51                 ` Dmitry Gutov
2016-06-20 14:38                   ` Eli Zaretskii
2016-06-20 14:54                     ` Dmitry Gutov
2016-06-20 15:03                       ` Eli Zaretskii
2016-06-20 17:16                     ` Dmitry Gutov
2016-06-20 20:17                       ` Eli Zaretskii
2016-06-20 20:27                         ` Dmitry Gutov
2016-06-21  2:30                           ` Eli Zaretskii
2016-06-21 13:51                             ` Dmitry Gutov
2016-06-21 15:18                               ` Eli Zaretskii
2016-06-22  1:08                                 ` John Wiegley
2016-06-22  2:36                                   ` Eli Zaretskii
2016-06-22 18:21                                   ` Dmitry Gutov

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='CAArVCkRbhekuCx=PuHV85nmF1-DySiAG2=QE7coNFmVOWKLMTw@mail.gmail.com' \
    --to=p.stephani2@gmail.com \
    --cc=dgutov@yandex.ru \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=kentaro.nakazawa@nifty.com \
    --cc=larsi@gnus.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.
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.