* [Patch] url-http-create-request creates truncated paths
@ 2006-08-31 23:25 Diane Murray
2006-09-01 2:32 ` Stefan Monnier
0 siblings, 1 reply; 2+ messages in thread
From: Diane Murray @ 2006-08-31 23:25 UTC (permalink / raw)
Argument and value pairs separated by semicolons in URLs, parsed as
attributes in URL/Emacs, are being left out of HTTP requests. This
results in 404 errors or the wrong page being retrieved. For example,
the request for the URL
<http://www.emacswiki.org/cgi-bin/wiki?action=browse;oldid=Gnus;id=GnusPage>
is "GET /cgi-bin/wiki/?action=browse HTTP/1.1" - note that everything
following the first semicolon is ignored in the request.
Additionally, I believe - in http:// URLs, at least - the target (like
#top) belongs at the very end of the URL, yet `url-recreate-url'
places it just before any attributes. Please see the following patch
for fixes.
* url-parse.el (url-recreate-url-attributes): New function, code
simply moved from `url-recreate-url'.
(url-recreate-url): Use it. Put the `url-target' at the end of
the URL after the attributes.
* url-http.el (url-http-create-request): Use
`url-recreate-url-attributes' when setting real-fname.
Index: url-parse.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/url/url-parse.el,v
retrieving revision 1.11
diff -c -r1.11 url-parse.el
*** url-parse.el 5 Feb 2006 23:15:07 -0000 1.11
--- url-parse.el 31 Aug 2006 22:54:10 -0000
***************
*** 100,116 ****
(not (equal (url-port urlobj)
(url-scheme-get-property (url-type urlobj) 'default-port))))
(format ":%d" (url-port urlobj)))
! (or (url-filename urlobj) "/")
(if (url-target urlobj)
! (concat "#" (url-target urlobj)))
! (if (url-attributes urlobj)
! (concat ";"
! (mapconcat
! (function
! (lambda (x)
! (if (cdr x)
! (concat (car x) "=" (cdr x))
! (car x)))) (url-attributes urlobj) ";")))))
;;;###autoload
(defun url-generic-parse-url (url)
--- 100,120 ----
(not (equal (url-port urlobj)
(url-scheme-get-property (url-type urlobj) 'default-port))))
(format ":%d" (url-port urlobj)))
! (or (url-filename urlobj) "/")
! (url-recreate-url-attributes urlobj)
(if (url-target urlobj)
! (concat "#" (url-target urlobj)))))
!
! (defun url-recreate-url-attributes (urlobj)
! "Recreate the attributes of an URL string from the parsed URLOBJ."
! (when (url-attributes urlobj)
! (concat ";"
! (mapconcat
! (function
! (lambda (x)
! (if (cdr x)
! (concat (car x) "=" (cdr x))
! (car x)))) (url-attributes urlobj) ";"))))
;;;###autoload
(defun url-generic-parse-url (url)
Index: url-http.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/url/url-http.el,v
retrieving revision 1.30
diff -c -r1.30 url-http.el
*** url-http.el 12 May 2006 12:29:36 -0000 1.30
--- url-http.el 31 Aug 2006 22:52:34 -0000
***************
*** 160,166 ****
(let ((url-basic-auth-storage
'url-http-proxy-basic-auth-storage))
(url-get-authentication url nil 'any nil))))
! (real-fname (url-filename (or proxy-obj url)))
(host (url-host (or proxy-obj url)))
(auth (if (cdr-safe (assoc "Authorization" url-request-extra-headers))
nil
--- 160,167 ----
(let ((url-basic-auth-storage
'url-http-proxy-basic-auth-storage))
(url-get-authentication url nil 'any nil))))
! (real-fname (concat (url-filename (or proxy-obj url))
! (url-recreate-url-attributes (or proxy-obj url))))
(host (url-host (or proxy-obj url)))
(auth (if (cdr-safe (assoc "Authorization" url-request-extra-headers))
nil
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2006-09-01 2:32 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-08-31 23:25 [Patch] url-http-create-request creates truncated paths Diane Murray
2006-09-01 2:32 ` Stefan Monnier
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).