Ticket #119 (new new feature)

Opened 2 years ago

Last modified 1 year ago

support of gzip encoding in response

Reported by: laurentj Assigned to: laurentj
Priority: low Milestone: Jelix 1.3
Component: jelix:core response Version: 1.0 beta1
Severity: minor Keywords: gzip http compression
Cc: Php version:
Review: Hosting Provider:
Documentation needed: Blocking:

Description

jResponse should provide http compression feature. For example, a property "compression". Then if client accept compression and if this property is true, jResponse return a compressed response.

Attachments

temp.php (2.4 kB) - added by dmp on 02/15/07 10:46:21.
Exemple implementation to read Accept-encodings headers

Change History

02/15/07 10:36:12 changed by laurentj

02/15/07 10:46:21 changed by dmp

  • attachment temp.php added.

Exemple implementation to read Accept-encodings headers

02/15/07 10:48:21 changed by dmp

Usual encodings are: array('zip', 'deflate', 'gzip', 'x-zip', 'x-deflate', 'x-gzip')

and of course 'identity'.

All these (but identity) are in fact *the same*... and means the client do accept compression...

02/15/07 10:59:15 changed by dmp

I - don't forget that we need to send the proper Content-encoding if we are to perform compression

II - suggesting also to read other headers (at least Accept-charset - eg: utf8 for most people, unless client doesn't support it). IMO, this is related, as we are treating here content transformations. Same remark as above applies: need to explicitely manipulate the answer header

02/15/07 11:03:07 changed by dmp

Last remarks:

Be sure to check that *we are able* to compress... extension_loaded('zlib')

To perform the compression itself, relying on something very simple is probably a good idea. eg: start bufferizing stop bufferizing compress the buffer content ---> gzdeflate($mybuff, 9); flush it out...

09/05/07 12:25:36 changed by laurentj

  • blocking changed.
  • milestone changed from Jelix 1.0 to Jelix 1.0beta3.

09/05/07 12:44:11 changed by laurentj

  • milestone changed from Jelix 1.0beta3 to Jelix 1.3.

09/25/07 18:25:07 changed by marko_

ob_gzhandler() callback check browser capacity before sending compressed content. Don't need to check this manualy in jResponse ?

09/26/07 10:03:27 changed by dmp

ob_gzhandler() is just a helper anyhow. IMHO, it's better not to rely on it. Not to mention that http://www.php.net/manual/en/function.ob-gzhandler.php explicitely discourage its use (and recommends using zlib.output_compression instead), having to use it as a callback for ob_start restricts your possibilities manipulating the buffer (if I understood correctly).

Anyhow, something sure is better than nothing ;)

Download in other formats: Comma-delimited Text Tab-delimited Text RSS Feed