Content-Type / AddOutputFilterByType DEFLATE text/html

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Content-Type / AddOutputFilterByType DEFLATE text/html

Reindl Harald-2
Hi

AddOutputFilterByType DEFLATE text/html

is this a bug or somehow expected behavior that in case the
"Content-Type" header also contains a charset mod_defalte don't work as
expected which means in case of curl requests only static files are gzip
compressed while PHP responses are missing "Content-Encoding: gzip" -
that this don't happen in case of Firefox as client makes it even more
strange

identical result for "Content-Type: text/html; charset=UTF-8" in case
"default_charset" is not set in php.ini

the last line of each block is the PHP array for curl_setopt($curl,
CURLOPT_HTTPHEADER, $curl_header);

NO GZIP
http://corecms/index.php?count=250_1502096587
HTTP/1.1 200 OK
Date: Mon, 07 Aug 2017 09:03:08 GMT
X-DNS-Prefetch-Control: off
X-Content-Type-Options: nosniff
X-Response-Time: D=1744 us
Expires: Mon, 26 Jul 1997 05:00:00 GMT
Cache-Control: no-cache
ETag: 7d820de3763d0e6c22ccbfe846ab1c31
Vary: User-Agent
Content-Type: text/html; charset=ISO-8859-1
a:2:{i:0;s:58:"Cookie:
LOUNGE_ID=pivked76ocg1n9750n91d3dtnqqpqhpmqci63pvo";i:1;s:30:"Accept-Encoding:
gzip, deflate";}

NO GZIP
http://corecms/
HTTP/1.1 200 OK
Date: Mon, 07 Aug 2017 09:03:08 GMT
X-DNS-Prefetch-Control: off
X-Content-Type-Options: nosniff
X-Response-Time: D=400 us
Cache-Control: max-age=120
Expires: Mon, 07 Aug 2017 09:05:08 GMT
Vary: User-Agent
Content-Type: text/html; charset=ISO-8859-1
a:2:{i:0;s:58:"Cookie:
LOUNGE_ID=pivked76ocg1n9750n91d3dtnqqpqhpmqci63pvo";i:1;s:30:"Accept-Encoding:
gzip, deflate";}

GZIP OK
http://corecms/static.htm?count=250_1502096587
HTTP/1.1 200 OK
Date: Mon, 07 Aug 2017 09:03:08 GMT
X-DNS-Prefetch-Control: off
X-Content-Type-Options: nosniff
X-Response-Time: D=297 us
Last-Modified: Sun, 06 Aug 2017 17:49:54 GMT
ETag: "ec1-556195b938c8f-gzip"
Accept-Ranges: bytes
Cache-Control: max-age=120
Expires: Mon, 07 Aug 2017 09:05:08 GMT
Content-Encoding: gzip
Vary: Accept-Encoding
Content-Length: 890
Content-Type: text/html
a:2:{i:0;s:58:"Cookie:
LOUNGE_ID=pivked76ocg1n9750n91d3dtnqqpqhpmqci63pvo";i:1;s:30:"Accept-Encoding:
gzip, deflate";}

NO GZIP
http://corecms/static.php?count=250_1502096587
HTTP/1.1 200 OK
Date: Mon, 07 Aug 2017 09:03:08 GMT
X-DNS-Prefetch-Control: off
X-Content-Type-Options: nosniff
X-Response-Time: D=280 us
Cache-Control: max-age=120
Expires: Mon, 07 Aug 2017 09:05:08 GMT
Vary: User-Agent
Content-Type: text/html; charset=ISO-8859-1
a:2:{i:0;s:58:"Cookie:
LOUNGE_ID=pivked76ocg1n9750n91d3dtnqqpqhpmqci63pvo";i:1;s:30:"Accept-Encoding:
gzip, deflate";}
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Content-Type / AddOutputFilterByType DEFLATE text/html

Reindl Harald-2
OK, the reason are the HEAD-Requests triggered by curl_setopt($curl,
CURLOPT_NOBODY, 1); so the bug is ignoring that in case of
"/static.htm?count=250_150209658" and sending in fact a body back while
for the 3 other test urls the response is HEAD as requested and the curl
code is identical

  $curl = curl_init();
  curl_setopt($curl, CURLOPT_NOBODY, 1);
  curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
  curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 5);
  curl_setopt($curl, CURLOPT_USERAGENT, 'Mozilla/5.0 (X11; Fedora; Linux
x86_64; rv:55.0) Gecko/20100101 Firefox/55.0');
  curl_setopt($curl, CURLOPT_HEADER, 1);
  curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0);
  curl_setopt($curl, CURLOPT_URL, $url);
  curl_setopt($curl, CURLOPT_HTTPHEADER, $curl_header);

Am 07.08.2017 um 11:12 schrieb Reindl Harald:

> Hi
>
> AddOutputFilterByType DEFLATE text/html
>
> is this a bug or somehow expected behavior that in case the
> "Content-Type" header also contains a charset mod_defalte don't work as
> expected which means in case of curl requests only static files are gzip
> compressed while PHP responses are missing "Content-Encoding: gzip" -
> that this don't happen in case of Firefox as client makes it even more
> strange
>
> identical result for "Content-Type: text/html; charset=UTF-8" in case
> "default_charset" is not set in php.ini
>
> the last line of each block is the PHP array for curl_setopt($curl,
> CURLOPT_HTTPHEADER, $curl_header);
>
> NO GZIP
> http://corecms/index.php?count=250_1502096587
> HTTP/1.1 200 OK
> Date: Mon, 07 Aug 2017 09:03:08 GMT
> X-DNS-Prefetch-Control: off
> X-Content-Type-Options: nosniff
> X-Response-Time: D=1744 us
> Expires: Mon, 26 Jul 1997 05:00:00 GMT
> Cache-Control: no-cache
> ETag: 7d820de3763d0e6c22ccbfe846ab1c31
> Vary: User-Agent
> Content-Type: text/html; charset=ISO-8859-1
> a:2:{i:0;s:58:"Cookie:
> LOUNGE_ID=pivked76ocg1n9750n91d3dtnqqpqhpmqci63pvo";i:1;s:30:"Accept-Encoding:
> gzip, deflate";}
>
> NO GZIP
> http://corecms/
> HTTP/1.1 200 OK
> Date: Mon, 07 Aug 2017 09:03:08 GMT
> X-DNS-Prefetch-Control: off
> X-Content-Type-Options: nosniff
> X-Response-Time: D=400 us
> Cache-Control: max-age=120
> Expires: Mon, 07 Aug 2017 09:05:08 GMT
> Vary: User-Agent
> Content-Type: text/html; charset=ISO-8859-1
> a:2:{i:0;s:58:"Cookie:
> LOUNGE_ID=pivked76ocg1n9750n91d3dtnqqpqhpmqci63pvo";i:1;s:30:"Accept-Encoding:
> gzip, deflate";}
>
> GZIP OK
> http://corecms/static.htm?count=250_1502096587
> HTTP/1.1 200 OK
> Date: Mon, 07 Aug 2017 09:03:08 GMT
> X-DNS-Prefetch-Control: off
> X-Content-Type-Options: nosniff
> X-Response-Time: D=297 us
> Last-Modified: Sun, 06 Aug 2017 17:49:54 GMT
> ETag: "ec1-556195b938c8f-gzip"
> Accept-Ranges: bytes
> Cache-Control: max-age=120
> Expires: Mon, 07 Aug 2017 09:05:08 GMT
> Content-Encoding: gzip
> Vary: Accept-Encoding
> Content-Length: 890
> Content-Type: text/html
> a:2:{i:0;s:58:"Cookie:
> LOUNGE_ID=pivked76ocg1n9750n91d3dtnqqpqhpmqci63pvo";i:1;s:30:"Accept-Encoding:
> gzip, deflate";}
>
> NO GZIP
> http://corecms/static.php?count=250_1502096587
> HTTP/1.1 200 OK
> Date: Mon, 07 Aug 2017 09:03:08 GMT
> X-DNS-Prefetch-Control: off
> X-Content-Type-Options: nosniff
> X-Response-Time: D=280 us
> Cache-Control: max-age=120
> Expires: Mon, 07 Aug 2017 09:05:08 GMT
> Vary: User-Agent
> Content-Type: text/html; charset=ISO-8859-1
> a:2:{i:0;s:58:"Cookie:
> LOUNGE_ID=pivked76ocg1n9750n91d3dtnqqpqhpmqci63pvo";i:1;s:30:"Accept-Encoding:
> gzip, deflate";}
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Content-Type / AddOutputFilterByType DEFLATE text/html

William A Rowe Jr
This current behavior still seems wrong in httpd. A content (as opposed perhaps to transfer) should not vary, in fact cannot vary if an etag is presented.

I suspect that the deflate filter looks to see if there is a benefit to compression, and cannot do so until it has a body. If it is going to do that, I suspect it must use a transfer encoding. Otherwise the deflation of content shouldn't vary, and the header should be toggled even when there is no body.


On Aug 7, 2017 04:43, "Reindl Harald" <[hidden email]> wrote:
OK, the reason are the HEAD-Requests triggered by curl_setopt($curl, CURLOPT_NOBODY, 1); so the bug is ignoring that in case of "/static.htm?count=250_150209658" and sending in fact a body back while for the 3 other test urls the response is HEAD as requested and the curl code is identical

 $curl = curl_init();
 curl_setopt($curl, CURLOPT_NOBODY, 1);
 curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
 curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 5);
 curl_setopt($curl, CURLOPT_USERAGENT, 'Mozilla/5.0 (X11; Fedora; Linux x86_64; rv:55.0) Gecko/20100101 Firefox/55.0');
 curl_setopt($curl, CURLOPT_HEADER, 1);
 curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0);
 curl_setopt($curl, CURLOPT_URL, $url);
 curl_setopt($curl, CURLOPT_HTTPHEADER, $curl_header);

Am 07.08.2017 um 11:12 schrieb Reindl Harald:
Hi

AddOutputFilterByType DEFLATE text/html

is this a bug or somehow expected behavior that in case the "Content-Type" header also contains a charset mod_defalte don't work as expected which means in case of curl requests only static files are gzip compressed while PHP responses are missing "Content-Encoding: gzip" - that this don't happen in case of Firefox as client makes it even more strange

identical result for "Content-Type: text/html; charset=UTF-8" in case "default_charset" is not set in php.ini

the last line of each block is the PHP array for curl_setopt($curl, CURLOPT_HTTPHEADER, $curl_header);

NO GZIP
http://corecms/index.php?count=250_1502096587
HTTP/1.1 200 OK
Date: Mon, 07 Aug 2017 09:03:08 GMT
X-DNS-Prefetch-Control: off
X-Content-Type-Options: nosniff
X-Response-Time: D=1744 us
Expires: Mon, 26 Jul 1997 05:00:00 GMT
Cache-Control: no-cache
ETag: 7d820de3763d0e6c22ccbfe846ab1c31
Vary: User-Agent
Content-Type: text/html; charset=ISO-8859-1
a:2:{i:0;s:58:"Cookie: LOUNGE_ID=pivked76ocg1n9750n91d3dtnqqpqhpmqci63pvo";i:1;s:30:"Accept-Encoding: gzip, deflate";}

NO GZIP
http://corecms/
HTTP/1.1 200 OK
Date: Mon, 07 Aug 2017 09:03:08 GMT
X-DNS-Prefetch-Control: off
X-Content-Type-Options: nosniff
X-Response-Time: D=400 us
Cache-Control: max-age=120
Expires: Mon, 07 Aug 2017 09:05:08 GMT
Vary: User-Agent
Content-Type: text/html; charset=ISO-8859-1
a:2:{i:0;s:58:"Cookie: LOUNGE_ID=pivked76ocg1n9750n91d3dtnqqpqhpmqci63pvo";i:1;s:30:"Accept-Encoding: gzip, deflate";}

GZIP OK
http://corecms/static.htm?count=250_1502096587
HTTP/1.1 200 OK
Date: Mon, 07 Aug 2017 09:03:08 GMT
X-DNS-Prefetch-Control: off
X-Content-Type-Options: nosniff
X-Response-Time: D=297 us
Last-Modified: Sun, 06 Aug 2017 17:49:54 GMT
ETag: "ec1-556195b938c8f-gzip"
Accept-Ranges: bytes
Cache-Control: max-age=120
Expires: Mon, 07 Aug 2017 09:05:08 GMT
Content-Encoding: gzip
Vary: Accept-Encoding
Content-Length: 890
Content-Type: text/html
a:2:{i:0;s:58:"Cookie: LOUNGE_ID=pivked76ocg1n9750n91d3dtnqqpqhpmqci63pvo";i:1;s:30:"Accept-Encoding: gzip, deflate";}

NO GZIP
http://corecms/static.php?count=250_1502096587
HTTP/1.1 200 OK
Date: Mon, 07 Aug 2017 09:03:08 GMT
X-DNS-Prefetch-Control: off
X-Content-Type-Options: nosniff
X-Response-Time: D=280 us
Cache-Control: max-age=120
Expires: Mon, 07 Aug 2017 09:05:08 GMT
Vary: User-Agent
Content-Type: text/html; charset=ISO-8859-1
a:2:{i:0;s:58:"Cookie: LOUNGE_ID=pivked76ocg1n9750n91d3dtnqqpqhpmqci63pvo";i:1;s:30:"Accept-Encoding: gzip, deflate";}
Loading...