developer.jelix.org is not used any more and exists only for history. Post new tickets on the Github account.
developer.jelix.org n'est plus utilisée, et existe uniquement pour son historique. Postez les nouveaux tickets sur le compte github.

Opened 14 years ago

Closed 9 years ago

#119 closed new feature (wontfix)

support of gzip encoding in response

Reported by: laurentj Owned by: laurentj
Priority: low Milestone:
Component: jelix:core response Version: 1.0 beta1
Severity: minor Keywords: gzip http compression
Cc: Blocked By:
Blocking: Documentation needed: no
Hosting Provider: Php version:

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 (1)

temp.php (2.4 KB) - added by dmp 14 years ago.
Exemple implementation to read Accept-encodings headers

Download all attachments as: .zip

Change History (11)

Changed 14 years ago by dmp

Exemple implementation to read Accept-encodings headers

comment:2 Changed 14 years ago 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...

comment:3 Changed 14 years ago 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

comment:4 Changed 14 years ago 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...

comment:5 Changed 13 years ago by laurentj

  • Milestone changed from Jelix 1.0 to Jelix 1.0beta3

comment:6 Changed 13 years ago by laurentj

  • Milestone changed from Jelix 1.0beta3 to Jelix 1.3

comment:7 Changed 13 years ago by marko_

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

comment:8 Changed 13 years ago 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 ;)

comment:9 Changed 10 years ago by laurentj

  • Documentation needed unset
  • Milestone Jelix 1.3 deleted

comment:10 Changed 9 years ago by laurentj

  • Resolution set to wontfix
  • Status changed from new to closed

use apache/nginx/whatever features for this.

Note: See TracTickets for help on using tickets.