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: Kenichi Handa
Subject: Re: encoding and content-length for url-http.el
Date: Sat, 11 Jun 2005 20:06:07 +0900
User-agent: SEMI/1.14.3 (Ushinoya) FLIM/1.14.2 (Yagi-Nishiguchi) APEL/10.2 Emacs/22.0.50 (i686-pc-linux-gnu) MULE/5.0 (SAKAKI)

In article <address@hidden>, "Mark A. Hershberger" <address@hidden> writes:

> Could I get input on the following patch before I apply it?  The first
> part (using string-bytes instead of length) seems like a no-brainer.
> The second part, I'm less sure about.

If url-request-data is a string of raw bytes (i.e. not-yet
decoded, or already-encoded), you had better use length
because it works both for multibyte-string and
unibyte-string.

Otherwise, you must at first encode it and check the
resulting length to decide the value for "Content-Length:",
and calling detect-coding-string on url-request-data is
nonsense.

---
Kenichi Handa
address@hidden

> --- url-http.el       4 Jun 2005 18:37:16 -0000       1.14
> +++ url-http.el       10 Jun 2005 18:36:06 -0000
> @@ -259,7 +259,7 @@
>          (if url-request-data
>              (concat
>               "Content-length: " (number-to-string
> -                                 (length url-request-data))
> +                                 (string-bytes url-request-data))
>               "\r\n"))
>          ;; End request
>          "\r\n"
> @@ -1066,6 +1066,9 @@
>       (set-process-buffer connection buffer)
>       (set-process-sentinel connection 'url-http-end-of-document-sentinel)
>       (set-process-filter connection 'url-http-generic-filter)
> +     (set-process-coding-system connection
> +                                (detect-coding-string url-request-data t)
> +                                url-request-coding-system)
>       (process-send-string connection (url-http-create-request url))))
>      buffer))
 

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

> [1.2 This is a digitally signed message part <application/pgp-signature 
> (7bit)>]

> [2  <text/plain; us-ascii (7bit)>]
> _______________________________________________
> Emacs-devel mailing list
> address@hidden
> http://lists.gnu.org/mailman/listinfo/emacs-devel




reply via email to

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