all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Paul Pogonyshev <pogonyshev@gmx.net>
Cc: emacs-devel@gnu.org
Subject: Re: URL library problem
Date: Mon, 3 Oct 2005 20:53:01 +0300	[thread overview]
Message-ID: <200510032053.01278.pogonyshev@gmx.net> (raw)
In-Reply-To: <jwv4q7y8vx4.fsf-monnier+emacs@gnu.org>

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	other threads:[~2005-10-03 17:53 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-10-02 18:48 URL library problem Paul Pogonyshev
2005-10-02 19:32 ` Mark A. Hershberger
2005-10-03  5:09 ` Richard M. Stallman
2005-10-03 14:36 ` Stefan Monnier
2005-10-03 15:26   ` Stefan Monnier
2005-10-03 17:53     ` Paul Pogonyshev [this message]

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=200510032053.01278.pogonyshev@gmx.net \
    --to=pogonyshev@gmx.net \
    --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 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.