From: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: Emacs Development <emacs-devel@gnu.org>
Subject: Re: encoding and content-length for url-http.el
Date: Fri, 10 Jun 2005 17:22:37 -0400 [thread overview]
Message-ID: <87is0lap4t.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <1118423681.8854.58.camel@localhost.localdomain> (Mark A. Hershberger's message of "Fri, 10 Jun 2005 13:14:41 -0400")
>> > - (length url-request-data))
>> > + (string-bytes url-request-data))
>>
>> I must say I haven't looked at the code, but it's anything but
>> a no-brainer. I'd rather say that it's obviously wrong. `string-bytes'
>> will give you the number of bytes used by Emacs for the internal
>> representation of the string, not the number of bytes that the string will
>> use on the write.
> So I was wrong. But length is even more obviously wrong than
> string-bytes.
> The description for length says "If the string contains multibyte
> characters, this is not necessarily the number of bytes in the string;
> it is the number of characters. To get the number of bytes, use
> `string-bytes'."
> Which is why I thought this was a no-brainer. We want number of bytes,
> not number of characters. RFC2616 says "The Content-Length
> entity-header field indicates the size of the entity-body, in decimal
> number of OCTETs, sent to the recipient"
Problem is that the byte length depends on the encoding that will be used.
I.e. it's not just a property of the string itself.
I think the code should keep `length' while making sure that
url-request-data is always a sequence of bytes rather than a sequence of
strings (i.e. its content has already been explicitly encoded in whichever
coding-system was deemed appropriate).
>> If the change from length to string-bytes solves your problem, it means that
>> url-request-data is not unibyte (i.e. not a seq of bytes, but a seq of
>> chars), in which case using `binary' when sending can't be right.
> I've been using the patch successfully for some time on unicode strings
> (seq of chars). It works for me and works were what is currently in CVS
> fails.
I believe you, that your code worked on your test cases, but if it does it
seems to be by accident.
> I'm quite willing to concede that its wrong, but I've had trouble
> finding documentation for this stuff. And, like I said, this works
> better for me than what is in CVS.
Could you describe much more precisely what you're doing (especially how
you use the URL package: which functions of it you call, etc...).
Are you using WebDAV (i.e. url-dav.el)?
I've found url-dav.el to be pretty buggy and looking through it, I see some
places where a few more encode-coding-string wouldn't be amiss.
Stefan
next prev parent reply other threads:[~2005-06-10 21:22 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-06-10 15:41 encoding and content-length for url-http.el Mark A. Hershberger
2005-06-10 15:53 ` Mark A. Hershberger
2005-06-10 19:47 ` Stefan Monnier
2005-06-10 17:14 ` Mark A. Hershberger
2005-06-10 21:22 ` Stefan Monnier [this message]
2005-06-16 4:21 ` Mark A. Hershberger
2005-06-16 7:05 ` Kenichi Handa
2005-06-16 16:05 ` Mark A. Hershberger
2005-06-11 11:06 ` Kenichi Handa
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/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87is0lap4t.fsf-monnier+emacs@gnu.org \
--to=monnier@iro.umontreal.ca \
--cc=emacs-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.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
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).