From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Julien Danjou Newsgroups: gmane.emacs.devel Subject: [PATCH] url-cache-create-filename: parse and recreate URL Date: Wed, 22 Sep 2010 18:26:04 +0200 Message-ID: <1285172764-24967-1-git-send-email-julien@danjou.info> NNTP-Posting-Host: lo.gmane.org X-Trace: dough.gmane.org 1285172783 18452 80.91.229.12 (22 Sep 2010 16:26:23 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Wed, 22 Sep 2010 16:26:23 +0000 (UTC) Cc: Julien Danjou To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Sep 22 18:26:21 2010 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1OyS9D-00052z-G6 for ged-emacs-devel@m.gmane.org; Wed, 22 Sep 2010 18:26:19 +0200 Original-Received: from localhost ([127.0.0.1]:53383 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OyS9D-0006wk-0i for ged-emacs-devel@m.gmane.org; Wed, 22 Sep 2010 12:26:19 -0400 Original-Received: from [140.186.70.92] (port=49735 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OyS97-0006uR-P4 for emacs-devel@gnu.org; Wed, 22 Sep 2010 12:26:14 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OyS96-0007pK-1F for emacs-devel@gnu.org; Wed, 22 Sep 2010 12:26:13 -0400 Original-Received: from coquelicot-s.easter-eggs.com ([213.215.37.94]:55946) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OyS95-0007ok-Sb for emacs-devel@gnu.org; Wed, 22 Sep 2010 12:26:12 -0400 Original-Received: from cigue.easter-eggs.fr (cigue.easter-eggs.fr [10.0.0.33]) by rose.easter-eggs.fr (Postfix) with ESMTPS id 08D3E14142; Wed, 22 Sep 2010 18:26:05 +0200 (CEST) Original-Received: from jdanjou by cigue.easter-eggs.fr with local (Exim 4.72) (envelope-from ) id 1OyS92-0006VB-P0; Wed, 22 Sep 2010 18:26:08 +0200 X-Mailer: git-send-email 1.7.1 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) 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:130633 Archived-At: Signed-off-by: Julien Danjou --- 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 + + * 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 * 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