From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Diane Murray Newsgroups: gmane.emacs.devel Subject: [Patch] url-http-create-request creates truncated paths Date: Fri, 01 Sep 2006 01:25:38 +0200 Message-ID: <87bqq01o99.fsf@x3y2z1.net> NNTP-Posting-Host: main.gmane.org X-Trace: sea.gmane.org 1157066700 21792 80.91.229.2 (31 Aug 2006 23:25:00 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Thu, 31 Aug 2006 23:25:00 +0000 (UTC) Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Sep 01 01:24:56 2006 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1GIvtq-0006yT-Lk for ged-emacs-devel@m.gmane.org; Fri, 01 Sep 2006 01:24:43 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GIvtq-0007go-1r for ged-emacs-devel@m.gmane.org; Thu, 31 Aug 2006 19:24:42 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1GIvte-0007gZ-Bn for emacs-devel@gnu.org; Thu, 31 Aug 2006 19:24:30 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1GIvtc-0007g7-Px for emacs-devel@gnu.org; Thu, 31 Aug 2006 19:24:30 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GIvtc-0007g4-Mr for emacs-devel@gnu.org; Thu, 31 Aug 2006 19:24:28 -0400 Original-Received: from [194.25.134.81] (helo=mailout03.sul.t-online.com) by monty-python.gnu.org with esmtp (Exim 4.52) id 1GIw3L-00053B-9V for emacs-devel@gnu.org; Thu, 31 Aug 2006 19:34:31 -0400 Original-Received: from fwd31.aul.t-online.de by mailout03.sul.t-online.com with smtp id 1GIvta-0006ic-01; Fri, 01 Sep 2006 01:24:26 +0200 Original-Received: from spargel (VacLS-Z-Qe1bYTMv6sSvzAd+A+XQ5YMrH7fNfkarmA7XPXVr-2UnUr@[84.189.240.155]) by fwd31.sul.t-online.de with esmtp id 1GIvtX-0bmIam0; Fri, 1 Sep 2006 01:24:23 +0200 Original-To: emacs-devel@gnu.org X-ID: VacLS-Z-Qe1bYTMv6sSvzAd+A+XQ5YMrH7fNfkarmA7XPXVr-2UnUr@t-dialin.net X-TOI-MSGID: 313350e2-fb74-4aec-9dee-438d5876f4d6 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:59189 Archived-At: 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 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