emacs-devel
[Top][All Lists]
Advanced

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

[PATCH] url-cache-create-filename: parse and recreate URL


From: Julien Danjou
Subject: [PATCH] url-cache-create-filename: parse and recreate URL
Date: Wed, 22 Sep 2010 18:26:04 +0200

Signed-off-by: Julien Danjou <address@hidden>
---
 lisp/url/ChangeLog    |    6 ++++++
 lisp/url/url-cache.el |   14 +++++++++-----
 2 files changed, 15 insertions(+), 5 deletions(-)

diff --git a/lisp/url/ChangeLog b/lisp/url/ChangeLog
index 9bc9d31..0a35fd9 100644
--- a/lisp/url/ChangeLog
+++ b/lisp/url/ChangeLog
@@ -1,3 +1,9 @@
+2010-09-22  Julien Danjou  <address@hidden>
+
+       * url-cache.el (url-cache-create-filename): Parse and recreate URL
+       to make sure we remove the port if the default one is specified in
+       the URL.
+
 2010-09-19  Julien Danjou  <address@hidden>
 
        * url-cache.el (url-fetch-from-cache): New function.
diff --git a/lisp/url/url-cache.el b/lisp/url/url-cache.el
index 28d0af7..67065e5 100644
--- a/lisp/url/url-cache.el
+++ b/lisp/url/url-cache.el
@@ -87,8 +87,7 @@ FILE can be created or overwritten."
 (defun url-cache-create-filename-human-readable (url)
   "Return a filename in the local cache for URL."
   (if url
-      (let* ((url (if (vectorp url) (url-recreate-url url) url))
-            (urlobj (url-generic-parse-url url))
+      (let* ((urlobj (url-generic-parse-url url))
             (protocol (url-type urlobj))
             (hostname (url-host urlobj))
             (host-components
@@ -146,8 +145,7 @@ FILE can be created or overwritten."
 Very fast if you have an `md5' primitive function, suitably fast otherwise."
   (require 'md5)
   (if url
-      (let* ((url (if (vectorp url) (url-recreate-url url) url))
-            (checksum (md5 url))
+      (let* ((checksum (md5 url))
             (urlobj (url-generic-parse-url url))
             (protocol (url-type urlobj))
             (hostname (url-host urlobj))
@@ -177,7 +175,13 @@ Very fast if you have an `md5' primitive function, 
suitably fast otherwise."
   :group 'url-cache)
 
 (defun url-cache-create-filename (url)
-  (funcall url-cache-creation-function url))
+  (funcall url-cache-creation-function
+           ;; We need to parse+recreate in order to remove the default port
+           ;; if it has been specified: e.g. http://www.example.com:80 will
+           ;; be transcoded as http://www.example.com
+           (url-recreate-url
+            (if (vectorp url) url
+              (url-generic-parse-url url)))))
 
 ;;;###autoload
 (defun url-cache-extract (fnam)
-- 
1.7.1




reply via email to

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