Re: Code updates
Miles Elam <[email protected]>
| Newsgroups | gmane.network.tux |
|---|---|
| Message-ID | <[email protected]> |
Mark Swanson wrote:
>In a nutshell, I have it working with or without squid. If squid is used the
>data is never compressed. If squid is not used, the data is always
>compressed.
>
>The patch Miles submitted works, and you need to add:
>
> echo 1 > /proc/sys/net/tux/compression
> echo 0 > /proc/sys/net/tux/extra_html_header_size
> echo "Vary: Accept-Encoding" >/proc/sys/net/tux/extra_html_header
> echo 21 > /proc/sys/net/tux/extra_html_header_size
> echo "http://127.0.0.1:80" > /proc/net/tux/0/listen/0
>
>And you need to modify proto_http.c so it looks like this:
>
> /*
> * Possibly add an extra HTML header:
> */
> if (tux_extra_html_header_size && mime && !strcmp(mime->type,
>"text/html")) {
> unsigned int len = tux_extra_html_header_size;
>
> //memcpy(curr, tux_extra_html_header, len);
> //curr += len;
> curr += sprintf(curr, "\r\n%s", tux_extra_html_header);
> }
> COPY_STATIC_PART(4, curr);
>
Where in proto_http.c is this change made? Got any line numbers or
function names? Also, am I reading this if-statement correctly? Can
this extra header only be sent for MIME type text/html? What about CSS,
XML, plain text, Word documents, Postscript files, etc. etc.?
>HTML et. all. compress around 400% - 500%.
>I've gone live with this so you can see this working for yourself at:
>http://www.ScheduleWorld.com/
>
Sweet!
In other news, should the "Vary" header be sent always or just when
there is a compressed/uncompressed file pair? In yours (Mark's), it is
always sent on every transaction and in my last patch, it's only sent
when sending a compressed file.
Anyone know which is correct according to the HTTP spec?
- Miles