Andrew M. Bishop
Sat, 21 Jul 2007 21:04:29 -0700
Paul Slootman <[EMAIL PROTECTED]> writes: > While investigating > http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=395009 (which is a > wierd bug...) I noticed that pages received via wwwoffle were larger > than directly received pages. Wwwoffle is adding spaces before /> > strings. > > To demonstrate: > > # echo "<bla />"|wwwoffle-write --addheader http://foo.bar/bla > > # wwwoffle-read http://foo.bar/bla | cat -vet > HTTP/1.0 200 OK^M$ > Content-Type: text/html^M$ > ^M$ > <bla />$ > > # http_proxy=http://localhost:8080/ GET http://foo.bar/bla | cat -vet > <bla />$ > > > Now this shouldn't be a problem for properly written browsers (I've > checked that it doesn't happen with e.g. text/plain content), but I > suspect an off-by-one error somewhere... It is rather simpler than that, this will fix it. -------------------- htmlmodify.l.diff -------------------- --- htmlmodify.l 2007/07/08 17:53:14 1.95 +++ htmlmodify.l 2007/07/21 13:18:26 @@ -1359,7 +1359,7 @@ if(suffix) {YY_OUTPUT(suffix);} if(yychar==LEX_TAG_END_XHTML && !suffix) - {YY_OUTPUT(" />");} + {YY_OUTPUT("/>");} else {YY_OUTPUT(">");} -------------------- htmlmodify.l.diff -------------------- If you were to repeat your test (without the patch) and use a different tag, one that WWWOFFLE handles specially then you will see that the extra space is not added. If the HTML content was: <img href="foo" /> then the HTML modification makes no change. I think the problem is that on line 1122 I do need the extra space (for outputting the special tags) but not on line 1362 for the normal tags. The difference is that the special tags are completely read in and then output with modifications but the other tags are written out as they are read in. -- Andrew. ---------------------------------------------------------------------- Andrew M. Bishop [EMAIL PROTECTED] http://www.gedanken.demon.co.uk/ WWWOFFLE users page: http://www.gedanken.demon.co.uk/wwwoffle/version-2.9/user.html