emacs-devel
[Top][All Lists]
Advanced

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

[Patch] url-http-create-request creates truncated paths


From: Diane Murray
Subject: [Patch] url-http-create-request creates truncated paths
Date: Fri, 01 Sep 2006 01:25:38 +0200

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




reply via email to

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