Also does minimal parsing of HTTP headers and will actually cause
the callback to be triggered."
(if url-http-content-type
- (url-display-percentage
+ (url-display-message
"Reading [%s]... %s of %s (%d%%)"
- (url-percentage (- nd url-http-end-of-headers)
- url-http-content-length)
url-http-content-type
(funcall byte-count-to-string-function (- nd url-http-end-of-headers))
(funcall byte-count-to-string-function url-http-content-length)
(url-percentage (- nd url-http-end-of-headers)
url-http-content-length))
- (url-display-percentage
+ (url-display-message
"Reading... %s of %s (%d%%)"
- (url-percentage (- nd url-http-end-of-headers)
- url-http-content-length)
(funcall byte-count-to-string-function (- nd url-http-end-of-headers))
(funcall byte-count-to-string-function url-http-content-length)
(url-percentage (- nd url-http-end-of-headers)
(if (> (- nd url-http-end-of-headers) url-http-content-length)
(progn
;; Found the end of the document! Wheee!
- (url-display-percentage nil nil)
(url-lazy-message "Reading... done.")
(if (url-http-parse-headers)
(url-http-activate-callback)))))
;; one after-change-function call.
(while read-next-chunk
(setq no-initial-crlf (= 0 url-http-chunked-counter))
- (if url-http-content-type
- (url-display-percentage nil
- "Reading [%s]... chunk #%d"
- url-http-content-type url-http-chunked-counter)
- (url-display-percentage nil
- "Reading... chunk #%d"
- url-http-chunked-counter))
(url-http-debug "Reading chunk %d (%d %d %d)"
url-http-chunked-counter st nd length)
(setq regexp (if no-initial-crlf
;; Found the end of the document! Wheee!
(url-http-debug "Saw end of stream chunk!")
(setq read-next-chunk nil)
- (url-display-percentage nil nil)
;; Every chunk, even the last 0-length one, is
;; terminated by CRLF. Skip it.
(if (not (looking-at "\r?\n"))
'file-size-human-readable "24.4")
;;;###autoload
-(defun url-display-percentage (fmt _perc &rest args)
+(defun url-display-message (fmt &rest args)
+ "Like `message', but do nothing if `url-show-status' is nil."
(when (and url-show-status
(not (and url-current-object (url-silent url-current-object)))
fmt)
(apply #'message fmt args)))
+;;;###autoload
+(defun url-display-percentage (fmt _perc &rest args)
+ (declare (obsolete url-display-message "29.1"))
+ (url-display-message fmt args))
+
;;;###autoload
(defun url-percentage (x y)
(round (* 100 (/ x (float y)))))