Branch: Tag:

2011-08-16

2011-08-16 15:25:40 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Support the Content-Encoding header in <insert href> et al. Fixes [bug 6041 (#6041)].

Rev: server/etc/modules/Roxen.pmod:1.312

1:   // This is a roxen pike module. Copyright © 1999 - 2009, Roxen IS.   // - // $Id: Roxen.pmod,v 1.311 2011/07/06 18:32:41 jonasw Exp $ + // $Id: Roxen.pmod,v 1.312 2011/08/16 15:25:40 grubba Exp $      #include <roxen.h>   #include <config.h>
958:    }       if (string ce = headers["content-encoding"]) { -  err_msg = "Content-Encoding header not supported.\n"; +  switch(lower_case(ce)) { +  case "gzip": +  { +  Stdio.FakeFile f = Stdio.FakeFile(body, "rb"); +  Gz.File gz = Gz.File(f, "rb"); +  body = gz->read(); +  } +  break; +  case "deflate": +  body = Gz.inflate(-15)->inflate(body); +  break; +  default: +  err_msg = sprintf("Content-Encoding %O not supported.\n", ce);    break proc;    } -  +  }       if (!charset) {    // Guess the charset from the content. Adapted from insert#href,