(url-http-chunked-encoding-after-change-function):
authorMagnus Henoch <mange@freemail.hu>
Sun, 9 Mar 2008 20:16:12 +0000 (20:16 +0000)
committerMagnus Henoch <mange@freemail.hu>
Sun, 9 Mar 2008 20:16:12 +0000 (20:16 +0000)
Remove superfluous CRLF at end of file.  (bug #42)

lisp/url/ChangeLog
lisp/url/url-http.el

index 69f5a5c..531dce8 100644 (file)
@@ -1,3 +1,8 @@
+2008-03-09  Magnus Henoch  <mange@freemail.hu>
+
+       * url-http.el (url-http-chunked-encoding-after-change-function):
+       Remove superfluous CRLF at end of file.  (bug #42)
+
 2008-03-02  Andreas Schwab  <schwab@suse.de>
 
        * url-util.el: Require cl when compiling.
index 7b29eba..c9cecea 100644 (file)
@@ -948,7 +948,11 @@ the end of the document."
                  (url-http-debug "Saw end of stream chunk!")
                  (setq read-next-chunk nil)
                  (url-display-percentage nil nil)
-                 (goto-char (match-end 1))
+                 ;; Every chunk, even the last 0-length one, is
+                 ;; terminated by CRLF.  Skip it.
+                 (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)
                      (url-http-debug "Saw end of trailers..."))
                  (if (url-http-parse-headers)