GNU bug report logs -
#11981
24.1.50; url-http-parse-headers should not disable file name handlers since it breaks auth-source
Previous Next
Reported by: David Engster <deng <at> randomsample.de>
Date: Wed, 18 Jul 2012 18:46:02 UTC
Severity: normal
Found in version 24.1.50
Done: Stefan Monnier <monnier <at> iro.umontreal.ca>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
[Message part 1 (text/plain, inline)]
David Engster writes:
> Stefan Monnier writes:
>>>> However, this workaraound assumes that everything that gets afterwards
>>>> in the `let'-section does not depend on file name handlers. However,
>>>> this is not the case: `url-http-handle-authentication' is called which
>
>>>> in turn calls the auth-source package. This package however supports
>>>> encrypted authinfo files which have to be automatically decrypted
>>>> through `auto-encryption-mode'. This, of course, works through file name
>>>> handlers.
>>> Does it work, if Tramp is disabled instead?
>>
>> I think I'd first like to better understand bug#6717: why do we take
>> a local part of a URL, let it start with / and then pass it to
>> file-name-directory? That sounds like a problem in itself.
>
> I agree. I wonder which call to `file-name-directory' threw the error in
> the original report - the most likely candidate is `url-file-directory',
> which should simply be rewritten to not use `file-name-directory'.
Patch attached. It even fixes another bug along the way:
`url-file-(non)directory' would not work on hexified URLs.
I'm not 100% sure this also fixes bug #6717; it might be that there's
another file-* call lurking somewhere.
-David
[url-util-diff.patch (text/x-patch, inline)]
=== modified file 'lisp/url/url-util.el'
--- lisp/url/url-util.el 2012-07-11 23:13:41 +0000
+++ lisp/url/url-util.el 2012-07-21 14:25:59 +0000
@@ -246,18 +246,24 @@
"Return the directory part of FILE, for a URL."
(cond
((null file) "")
- ((string-match "\\?" file)
- (file-name-directory (substring file 0 (match-beginning 0))))
- (t (file-name-directory file))))
+ ((string-match "\\(\\?\\|%3[fF]\\)" file)
+ (url-file-directory (substring file 0 (match-beginning 0))))
+ ((string-match "\\(.*\\(/\\|%2[fF]\\)\\)" file)
+ (match-string 1 file))
+ (t
+ "")))
;;;###autoload
(defun url-file-nondirectory (file)
"Return the nondirectory part of FILE, for a URL."
(cond
((null file) "")
- ((string-match "\\?" file)
- (file-name-nondirectory (substring file 0 (match-beginning 0))))
- (t (file-name-nondirectory file))))
+ ((string-match "\\(\\?\\|%3[fF]\\)" file)
+ (url-file-nondirectory (substring file 0 (match-beginning 0))))
+ ((string-match ".*\\(?:/\\|%2[fF]\\)\\(.*\\)" file)
+ (match-string 1 file))
+ (t
+ "")))
;;;###autoload
(defun url-parse-query-string (query &optional downcase allow-newlines)
This bug report was last modified 12 years and 281 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.