emacs-devel
[Top][All Lists]
Advanced

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

Re: encoding and content-length for url-http.el


From: Mark A. Hershberger
Subject: Re: encoding and content-length for url-http.el
Date: Fri, 10 Jun 2005 13:14:41 -0400

On Fri, 2005-06-10 at 15:47 -0400, Stefan Monnier wrote:

> > -                               (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"

> 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'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.


-- 
http://mah.everybody.org/weblog/
GPG Fingerprint: 7E15 362D A32C DFAB E4D2  B37A 735E F10A 2DFC BFF5
More people are killed every year by pigs than by sharks, which shows
you how good we are at evaluating risk. -- Bruce Schneier

Attachment: signature.asc
Description: This is a digitally signed message part


reply via email to

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