emacs-devel
[Top][All Lists]
Advanced

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

Re: URL library problem


From: Paul Pogonyshev
Subject: Re: URL library problem
Date: Mon, 3 Oct 2005 20:53:01 +0300
User-agent: KMail/1.4.3

Stefan Monnier wrote:
> > Would the patch below do the trick?
>
> No, it clearly wouldn't.  Try this one instead.
>
>
>         Stefan
>
>
> --- url-http.el       25 aoĆ» 2005 10:56:43 -0400      1.20
> +++ url-http.el       03 oct 2005 11:26:27 -0400
> @@ -198,7 +198,12 @@
>      ;; allows us to elide null lines directly, at the cost of making
>      ;; the layout less clear.
>      (setq request
> -       (concat
> +         (mapconcat
> +          ;; We'd really want here `string-to-unibyte', so as to signal an
> +          ;; error if one of the strings contains a multibyte char.
> +          'string-as-unibyte
> +          (delq nil
> +          (list
>          ;; The request
>          (or url-request-method "GET") " "
>          (if proxy-obj (url-recreate-url proxy-obj) real-fname)
> @@ -267,6 +272,7 @@
>          "\r\n"
>          ;; Any data
>          url-request-data))
> +          ""))
>      (url-http-debug "Request is: \n%s" request)
>      request))

Yes, it works.  I was thinking more along the lines of this patch:

--- url-http.el 24 Aug 2005 22:29:10 +0300      1.20
+++ url-http.el 03 Oct 2005 20:37:50 +0300      
@@ -264,9 +264,10 @@ request.
                                    (length url-request-data))
                "\r\n"))
           ;; End request
-          "\r\n"
-          ;; Any data
-          url-request-data))
+          "\r\n"))
+    (setq request (concat (encode-coding-string request 'binary t)
+                         ;; Any data
+                         url-request-data))
     (url-http-debug "Request is: \n%s" request)
     request))
 
@@ -1016,6 +1017,12 @@ CBARGS as the arguments."
                    url-http-chunked-start
                    url-http-chunked-counter
                    url-http-process))
+
+  (when (and url-request-data (multibyte-string-p url-request-data))
+    (let ((ascii-string (encode-coding-string url-request-data 'iso-safe)))
+      (if (string= ascii-string url-request-data)
+         (setq url-request-data ascii-string)
+       (error "`url-request-data' must be properly encoded or consist only of 
ASCII characters"))))
   (let ((connection (url-http-find-free-connection (url-host url)
                                                   (url-port url)))
        (buffer (generate-new-buffer (format " *http %s:%d*"

I assume you will commit something solving it to CVS.

Paul





reply via email to

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