* Change branch for HTTP chunking bug?
@ 2008-03-10 10:47 Magnus Henoch
2008-03-10 15:46 ` Chong Yidong
2008-03-10 15:57 ` Stefan Monnier
0 siblings, 2 replies; 5+ messages in thread
From: Magnus Henoch @ 2008-03-10 10:47 UTC (permalink / raw)
To: emacs-devel; +Cc: 42
[-- Attachment #1: Type: text/plain, Size: 239 bytes --]
I recently committed the attached patch to trunk, fixing bug #42,
"Superfluous CR from HTTP chunked download":
http://emacsbugs.donarmstrong.com/cgi-bin/bugreport.cgi?bug=42
Should this be changed on the Emacs 22 branch as well?
Magnus
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: url-http.el.patch --]
[-- Type: text/x-patch, Size: 707 bytes --]
diff --git a/lisp/url/url-http.el b/lisp/url/url-http.el
index 7b29eba..c9cecea 100644
--- a/lisp/url/url-http.el
+++ b/lisp/url/url-http.el
@@ -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)
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: Change branch for HTTP chunking bug?
2008-03-10 10:47 Change branch for HTTP chunking bug? Magnus Henoch
@ 2008-03-10 15:46 ` Chong Yidong
2008-03-10 15:57 ` Stefan Monnier
1 sibling, 0 replies; 5+ messages in thread
From: Chong Yidong @ 2008-03-10 15:46 UTC (permalink / raw)
To: emacs-devel
Magnus Henoch <mange@freemail.hu> writes:
> I recently committed the attached patch to trunk, fixing bug #42,
> "Superfluous CR from HTTP chunked download":
> http://emacsbugs.donarmstrong.com/cgi-bin/bugreport.cgi?bug=42
>
> Should this be changed on the Emacs 22 branch as well?
>
> Magnus
>
> diff --git a/lisp/url/url-http.el b/lisp/url/url-http.el
> index 7b29eba..c9cecea 100644
> --- a/lisp/url/url-http.el
> +++ b/lisp/url/url-http.el
> @@ -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)
Looks OK. Please check it into Emacs 22 (assuming it's been tested).
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Change branch for HTTP chunking bug?
2008-03-10 10:47 Change branch for HTTP chunking bug? Magnus Henoch
2008-03-10 15:46 ` Chong Yidong
@ 2008-03-10 15:57 ` Stefan Monnier
2008-03-11 12:19 ` Magnus Henoch
1 sibling, 1 reply; 5+ messages in thread
From: Stefan Monnier @ 2008-03-10 15:57 UTC (permalink / raw)
To: emacs-devel
> I recently committed the attached patch to trunk, fixing bug #42,
> "Superfluous CR from HTTP chunked download":
> http://emacsbugs.donarmstrong.com/cgi-bin/bugreport.cgi?bug=42
> Should this be changed on the Emacs 22 branch as well?
It seems that the bug is also present on the 22 branch. I'm not sure
how serious it is compared to the risk of introducing more bugs.
How confident are you that this is the right fix and that it will not
break anything currently working?
Stefan
> diff --git a/lisp/url/url-http.el b/lisp/url/url-http.el
> index 7b29eba..c9cecea 100644
> --- a/lisp/url/url-http.el
> +++ b/lisp/url/url-http.el
> @@ -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)
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Change branch for HTTP chunking bug?
2008-03-10 15:57 ` Stefan Monnier
@ 2008-03-11 12:19 ` Magnus Henoch
2008-03-11 12:23 ` Thien-Thi Nguyen
0 siblings, 1 reply; 5+ messages in thread
From: Magnus Henoch @ 2008-03-11 12:19 UTC (permalink / raw)
To: emacs-devel
Stefan Monnier <monnier@iro.umontreal.ca> writes:
> It seems that the bug is also present on the 22 branch. I'm not sure
> how serious it is compared to the risk of introducing more bugs.
> How confident are you that this is the right fix
Quite confident; the previous code didn't do what the standard spells
out, but with my fix it does. I have also tested it with downloads from
Emacswiki.
> and that it will not break anything currently working?
It eats whitespace at a point where it isn't significant, so nothing
should break.
[It would be nice if there were a test suite for the URL package. It
seems to be that the easiest way to implement that would be if it were
possible to make pipes (as in the system call) that behave as pairs of
Lisp processes, so that the test suite can perform a fake conversation
with the client code...]
Magnus
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2008-03-11 12:23 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-03-10 10:47 Change branch for HTTP chunking bug? Magnus Henoch
2008-03-10 15:46 ` Chong Yidong
2008-03-10 15:57 ` Stefan Monnier
2008-03-11 12:19 ` Magnus Henoch
2008-03-11 12:23 ` Thien-Thi Nguyen
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).