Branch: Tag:

2010-03-26

2010-03-26 16:31:11 by Martin Jonsson <marty@roxen.com>

Fix Gz.File object leakage together with -DHTTP_COMPRESSION by making sure that the pool of Gz.File instances is kept in the Configuration instead of being a useless per-request pool.

Rev: server/base_server/configuration.pike:1.692
Rev: server/protocols/http.pike:1.615

2:   // Modified by Francesco Chemolli to add throttling capabilities.   // Copyright © 1996 - 2009, Roxen IS.    - constant cvs_version = "$Id: http.pike,v 1.614 2009/09/22 09:21:15 mast Exp $"; + constant cvs_version = "$Id: http.pike,v 1.615 2010/03/26 16:31:11 marty Exp $";   // #define REQUEST_DEBUG   #define MAGIC_ERROR   
2246:   }      #ifdef HTTP_COMPRESSION - Thread.Local gzfileobj = Thread.Local(); -  +    private string gzip_data(string data)   {    Stdio.FakeFile f = Stdio.FakeFile("", "wb");       // Reuse the Gz.File object to reduce the overhead of instantiating    // Gz.deflate objects etc. -  Gz.File gzfile = gzfileobj->get(); +  Gz.File gzfile = conf->gz_file_pool->get();    if(!gzfile) {    gzfile = Gz.File(f, "wb");    gzfile->setparams(conf->query("http_compression_level"),    Gz.DEFAULT_STRATEGY); -  gzfileobj->set(gzfile); +  conf->gz_file_pool->set(gzfile);    } else {    gzfile->open(f, "wb");    }
2274: Inside #if defined(HTTP_COMPRESSION)
  {    Stdio.FakeFile f = Stdio.FakeFile(data, "rb");    -  Gz.File gzfile = gzfileobj->get(); +  Gz.File gzfile = conf->gz_file_pool->get();    if(!gzfile) {    gzfile = Gz.File(f, "rb");    gzfile->setparams(conf->query("http_compression_level"),    Gz.DEFAULT_STRATEGY); -  gzfileobj->set(gzfile); +  conf->gz_file_pool->set(gzfile);    } else {    gzfile->open(f, "rb");    }