mirror of
https://github.com/gnustep/libs-gsweb.git
synced 2025-02-23 11:41:20 +00:00
fix compression
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gsweb/trunk@21753 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
5eab6c1214
commit
f79fc700ab
2 changed files with 13 additions and 11 deletions
|
@ -260,13 +260,17 @@ void GSWResponse_appendTagAttributeValueEscapingHTMLAttributeValue(GSWResponse*
|
|||
if ([appAcceptedContentEncodingArray count]>0)
|
||||
{
|
||||
NSString* contentType=[self headerForKey:@"content-type"];
|
||||
NSString* gzHeader=[self headerForKey:@"gzip"];
|
||||
|
||||
if ([contentType isEqualTo:@"text/html"])
|
||||
{
|
||||
NSString* contentEncoding=[self headerForKey:@"content-encoding"];
|
||||
// we could do better by handling compress,...
|
||||
if ([contentEncoding length]==0 // Not already encoded
|
||||
if (([contentEncoding length]==0 // Not already encoded
|
||||
&& [_acceptedEncodings containsObject:@"gzip"]
|
||||
&& [appAcceptedContentEncodingArray containsObject:@"gzip"])
|
||||
&& [appAcceptedContentEncodingArray containsObject:@"gzip"])
|
||||
&& ((gzHeader == nil) || ([gzHeader isEqual:@"0"])))
|
||||
|
||||
{
|
||||
NSDate* compressStartDate=[NSDate date];
|
||||
NSData* content=[self content];
|
||||
|
|
|
@ -59,16 +59,14 @@ static int gzHeaderSize=10;
|
|||
int err=Z_OK;
|
||||
unsigned int selfLength=[self length];
|
||||
|
||||
c_stream.zalloc = (alloc_func)0;
|
||||
c_stream.zfree = (free_func)0;
|
||||
c_stream.opaque = (voidpf)0;
|
||||
memset (&c_stream, 0, sizeof(c_stream));
|
||||
|
||||
err = deflateInit2(&c_stream,
|
||||
Z_BEST_COMPRESSION,
|
||||
Z_DEFLATED,
|
||||
-15,
|
||||
9,
|
||||
Z_DEFAULT_STRATEGY);
|
||||
err = deflateInit2(&c_stream, /* z_streamp strm */
|
||||
4, /* int level */
|
||||
Z_DEFLATED, /* int method */
|
||||
-15, /* int windowBits */
|
||||
8, /* int memLevel */
|
||||
Z_DEFAULT_STRATEGY); /* int strategy */
|
||||
if (err!=Z_OK)
|
||||
{
|
||||
LOGError(@"deflateInit2 error: %d",err);
|
||||
|
|
Loading…
Reference in a new issue