summaryrefslogtreecommitdiff
path: root/lisp/url
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/url')
-rw-r--r--lisp/url/url-auth.el4
-rw-r--r--lisp/url/url-handlers.el11
-rw-r--r--lisp/url/url-http.el17
-rw-r--r--lisp/url/url-util.el4
-rw-r--r--lisp/url/url-vars.el12
5 files changed, 28 insertions, 20 deletions
diff --git a/lisp/url/url-auth.el b/lisp/url/url-auth.el
index b419db58ca9..75a9e387847 100644
--- a/lisp/url/url-auth.el
+++ b/lisp/url/url-auth.el
@@ -50,7 +50,7 @@
Must be a symbol pointing to another variable that will actually store
the information. The value of this variable is an assoc list of assoc
lists. The first assoc list is keyed by the server name. The cdr of
-this is an assoc list based on the 'directory' specified by the URL we
+this is an assoc list based on the \"directory\" specified by the URL we
are looking up.")
(defun url-basic-auth (url &optional prompt overwrite realm args)
@@ -141,7 +141,7 @@ instead of the filename inheritance method."
"Where usernames and passwords are stored.
Its value is an assoc list of assoc lists. The first assoc list is
keyed by the server name. The cdr of this is an assoc list based
-on the 'directory' specified by the url we are looking up.")
+on the \"directory\" specified by the url we are looking up.")
(defun url-digest-auth-create-key (username password realm method uri)
"Create a key for digest authentication method"
diff --git a/lisp/url/url-handlers.el b/lisp/url/url-handlers.el
index 6d2a5c2ee4b..9c272767858 100644
--- a/lisp/url/url-handlers.el
+++ b/lisp/url/url-handlers.el
@@ -342,8 +342,15 @@ if it had been inserted from a file named URL."
;; XXX: This is HTTP/S specific and should be moved to url-http
;; instead. See http://debbugs.gnu.org/17549.
(when (bound-and-true-p url-http-response-status)
- (unless (and (>= url-http-response-status 200)
- (< url-http-response-status 300))
+ ;; Don't signal an error if VISIT is non-nil, because
+ ;; 'insert-file-contents' doesn't. This is required to
+ ;; support, e.g., 'browse-url-emacs', which is a fancy way of
+ ;; visiting the HTML source of a URL: in that case, we want to
+ ;; display a file buffer even if the URL does not exist and
+ ;; 'url-retrieve-synchronously' returns 404 or whatever.
+ (unless (or visit
+ (and (>= url-http-response-status 200)
+ (< url-http-response-status 300)))
(let ((desc (nth 2 (assq url-http-response-status url-http-codes))))
(kill-buffer buffer)
;; Signal file-error per http://debbugs.gnu.org/16733.
diff --git a/lisp/url/url-http.el b/lisp/url/url-http.el
index 258f8025662..36cc2f32bbc 100644
--- a/lisp/url/url-http.el
+++ b/lisp/url/url-http.el
@@ -136,17 +136,6 @@ request.")
(507 insufficient-storage "Insufficient storage"))
"The HTTP return codes and their text.")
-(defcustom url-user-agent (format "User-Agent: %sURL/%s\r\n"
- (if url-package-name
- (concat url-package-name "/"
- url-package-version " ")
- "") url-version)
- "User Agent used by the URL package."
- :type '(choice (string :tag "A static User-Agent string")
- (function :tag "Call a function to get the User-Agent string"))
- :version "25.1"
- :group 'url)
-
;(eval-when-compile
;; These are all macros so that they are hidden from external sight
;; when the file is byte-compiled.
@@ -433,7 +422,7 @@ Return the number of characters removed."
(progn
(widen)
(goto-char (point-max))
- (insert "<hr>Sorry, but I do not know how to handle " type
+ (insert "<hr>Sorry, but I do not know how to handle " (or type auth url "")
" authentication. If you'd like to write it,"
" please use M-x report-emacs-bug RET.<hr>")
;; We used to set a `status' var (declared "special") but I can't
@@ -988,7 +977,7 @@ the callback to be triggered."
(url-http-activate-callback)))))
(defun url-http-chunked-encoding-after-change-function (st nd length)
- "Function used when dealing with 'chunked' encoding.
+ "Function used when dealing with chunked encoding.
Cannot give a sophisticated percentage, but we need a different
function to look for the special 0-length chunk that signifies
the end of the document."
@@ -1069,7 +1058,7 @@ the end of the document."
(when (looking-at "\r?\n")
(url-http-debug "Removing terminator of last chunk")
(delete-region (match-beginning 0) (match-end 0)))
- (if (re-search-forward "^\r*$" nil t)
+ (if (re-search-forward "^\r?\n" nil t)
(url-http-debug "Saw end of trailers..."))
(if (url-http-parse-headers)
(url-http-activate-callback))))))))))
diff --git a/lisp/url/url-util.el b/lisp/url/url-util.el
index 54b02e98c97..65a24a5bbb7 100644
--- a/lisp/url/url-util.el
+++ b/lisp/url/url-util.el
@@ -160,7 +160,7 @@ conversion. Replaces these characters as follows:
;;;###autoload
(defun url-normalize-url (url)
- "Return a 'normalized' version of URL.
+ "Return a \"normalized\" version of URL.
Strips out default port numbers, etc."
(let (type data retval)
(setq data (url-generic-parse-url url)
@@ -188,7 +188,7 @@ Will not do anything if `url-show-status' is nil."
;;;###autoload
(defun url-get-normalized-date (&optional specified-time)
- "Return a 'real' date string that most HTTP servers can understand."
+ "Return a date string that most HTTP servers can understand."
(let ((system-time-locale "C"))
(format-time-string "%a, %d %b %Y %T GMT" specified-time t)))
diff --git a/lisp/url/url-vars.el b/lisp/url/url-vars.el
index 46c2ec3c69f..fa6f182e831 100644
--- a/lisp/url/url-vars.el
+++ b/lisp/url/url-vars.el
@@ -357,6 +357,18 @@ Currently supported methods:
(const :tag "Direct connection" :value native))
:group 'url-hairy)
+(defcustom url-user-agent (format "User-Agent: %sURL/%s\r\n"
+ (if url-package-name
+ (concat url-package-name "/"
+ url-package-version " ")
+ "") url-version)
+ "User Agent used by the URL package for HTTP/HTTPS requests
+Should be a string or a function of no arguments returning a string."
+ :type '(choice (string :tag "A static User-Agent string")
+ (function :tag "Call a function to get the User-Agent string"))
+ :version "25.1"
+ :group 'url)
+
(defvar url-setup-done nil "Has setup configuration been done?")
(defconst url-weekday-alist