Quantcast
Channel: West Wind Message Board Messages
Viewing all articles
Browse latest Browse all 10393

Re: GZipCompression

$
0
0
Re: GZipCompression
Web Connection 5.0
Re: GZipCompression
Nov. 13, 2012
02:10 pm
3N60UDR6LShow this entire thread in new window
Gratar Image based on email address
From:Rick Strahl
To:Rick Steinwand
Rick,

Access and Assign methods are a FoxPro feature. Take a look in the FoxPro help file.

The Assign method is fired automatically when a value is assigned to it. So if you assign the value is set based on the accept header. Now when you read the value it'll reflect the proper value based on the accept header.

+++ Rick ---



Was the gzip code completed? I see code to compress it, but nothing that checks to see if the client sent an "Accept-Encoding:gzip" header.

I mention this because setting GZipCompression = .T. as the default in the response class worked great with a browser, but not so good with a dotNet app that didn't send accept gzip headers.

This is the gzip code I hit with response.write that gzipped it:

IFTHIS.GZipCompression AND LEN(THIS.cOutput) >= GZIP_MIN_COMPRESSION_SIZEthis.AppendHeader("Content-Encoding","gzip")this.cOutput = GzipCompressString(THIS.cOutput)ENDIF

Maybe I'm missing something. I also had lAllowGzip = .T. enabled as default in the wwHttp class.

From the documentation for 5.35 (GZipCompression):

If set to .T. automatically encodes the Response output to GZip compressed format. When set Web Connection automatically checks whether the client supports GZip compression and only compresses content if it does.

I don't see this function being called anywhere, but might do what the documentation suggests:

*** When .T. use GZip Compression when sending response *** This property compresses the body and adds the appropriate headers GZipCompression = .F. FUNCTION GzipCompression_Assign(llValue)IF llValueIFVARTYPE(Request) = "O"IFATC("gzip",Request.GetExtraHeader("HTTP_ACCEPT_ENCODING")) > 0 llValue = .T.ELSE llValue = .F.ENDIFELSE llValue = .F.ENDIFENDIFthis.GZipCompression = llValueENDFUNC

Thanks Rick.


Thanks Rick,

Fixed on this end.

For clarification of the problem:

The missing backslash causes a local filename to be created, which works fine as long as the application has rights to write into the current folder. However, with User Account Control enabled access to the local folder (in program files or whereever) is typically not allowed so it will fail.

Fixing the backslash as suggested by Rick writes the file where it's intended to be written which is the temp path which does allow writing of files in non-admin mode.

Thanks Rick,

+++ Rick ---




Rick Strahl
West Wind Technologies


from Maui, Hawaii

Making waves on the Web


Viewing all articles
Browse latest Browse all 10393

Trending Articles