472,325 Members | 2,300 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,325 software developers and data experts.

gzip and binarysend

hi. i have recently enabled gzip compression on my server and it works
fine. but i have noticed something wierd.

To protect my self from hotlinking i use a simple code to send my
download with binarysend method. here is the code for an image
download.

Set objStream = Server.CreateObject("ADODB.Stream")
Response.ContentType="image/jpeg"
'response.addheader "content-transfer-encoding", "binary"
response.addheader "Content-Disposition", "attachment;filename="&
filename & ";"
'Response.AddHeader "Content-Length", objStream.Size
objStream.Open
objStream.Type = 1
objStream.LoadFromFile strFilePath
Response.BinaryWrite objStream.Read
objStream.Close
Set objStream = Nothing
when i use this code without gzip compression (although size section
commented) it would send
Content-Length and filename correctly.

after enabling gzip this code stopped to send Content-Length and
filename.

any idea why it does that? is it my coding?

thanks
Apr 25 '07 #1
2 4354
after further test i couldn get

Response.AddHeader "Content-Length", objStream.Size

working. iis or asp refuses to send it but sends following

HTTP/1.1 200 OK
Cache-Control: private
Date: Wed, 25 Apr 2007 16:39:24 GMT
Content-Type: image/jpeg
Content-Disposition: attachment;filename=a.jpg;
Set-Cookie: ASPSESSIONIDQADTRBBQ=ACECKAMDNIDIFPIEEPODKIPH; path=/
Content-Encoding: gzip
Vary: Accept-Encoding
Transfer-Encoding: chunked
is it because Transfer-Encoding: chunked i cant get size working?

".nLL" <no***@here.comwrote in message
news:Ba*******************@fe3.news.blueyonder.co. uk...
hi. i have recently enabled gzip compression on my server and it works
fine. but i have noticed something wierd.

To protect my self from hotlinking i use a simple code to send my
download with binarysend method. here is the code for an image
download.

Set objStream = Server.CreateObject("ADODB.Stream")
Response.ContentType="image/jpeg"
'response.addheader "content-transfer-encoding", "binary"
response.addheader "Content-Disposition", "attachment;filename="&
filename & ";"
'Response.AddHeader "Content-Length", objStream.Size
objStream.Open
objStream.Type = 1
objStream.LoadFromFile strFilePath
Response.BinaryWrite objStream.Read
objStream.Close
Set objStream = Nothing
when i use this code without gzip compression (although size section
commented) it would send
Content-Length and filename correctly.

after enabling gzip this code stopped to send Content-Length and
filename.

any idea why it does that? is it my coding?

thanks


Apr 25 '07 #2

".nLL" <no***@here.comwrote in message
news:Qd*******************@fe3.news.blueyonder.co. uk...
after further test i couldn get

Response.AddHeader "Content-Length", objStream.Size

working. iis or asp refuses to send it but sends following

HTTP/1.1 200 OK
Cache-Control: private
Date: Wed, 25 Apr 2007 16:39:24 GMT
Content-Type: image/jpeg
Content-Disposition: attachment;filename=a.jpg;
Set-Cookie: ASPSESSIONIDQADTRBBQ=ACECKAMDNIDIFPIEEPODKIPH; path=/
Content-Encoding: gzip
Vary: Accept-Encoding
Transfer-Encoding: chunked
is it because Transfer-Encoding: chunked i cant get size working?

You should not attempt to set the content-size header, IIS will do that for
you.

The whole point behind Chunked encoding is to be able to stream an as yet
undetermined number of bytes to the client. The chunks are encoded with
their own size. Chunked encoding has a final packet which when received
allows the total content size to be calculated.
>

".nLL" <no***@here.comwrote in message
news:Ba*******************@fe3.news.blueyonder.co. uk...
hi. i have recently enabled gzip compression on my server and it works
fine. but i have noticed something wierd.

To protect my self from hotlinking i use a simple code to send my
download with binarysend method. here is the code for an image
download.

Set objStream = Server.CreateObject("ADODB.Stream")
Response.ContentType="image/jpeg"
'response.addheader "content-transfer-encoding", "binary"
response.addheader "Content-Disposition", "attachment;filename="&
filename & ";"
'Response.AddHeader "Content-Length", objStream.Size
objStream.Open
objStream.Type = 1
objStream.LoadFromFile strFilePath
Response.BinaryWrite objStream.Read
objStream.Close
Set objStream = Nothing
when i use this code without gzip compression (although size section
commented) it would send
Content-Length and filename correctly.

after enabling gzip this code stopped to send Content-Length and
filename.

any idea why it does that? is it my coding?

thanks


Apr 26 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: bmgz | last post by:
I am having problems trying to use the gzip module, I do the followig >>>import gzip >>>file = gzip.GzipFile("testfile.txt") >>>file.write()...
10
by: Xah Lee | last post by:
today i need to use Python to decompress gzip files. since i'm familiar with Python doc and have 10 years of computing experience with 4 years in...
2
by: comp.lang.php | last post by:
I am simply trying to zip together selected files into a single ZIP file. Windows XP doesn't have a native process by which you can do this, so I...
25
by: Xah Lee | last post by:
Python Doc Problem Example: gzip Xah Lee, 20050831 Today i need to use Python to compress/decompress gzip files. Since i've read the official...
14
by: Bill | last post by:
I've written a small program that, in part, reads in a file and parses it. Sometimes, the file is gzipped. The code that I use to get the file...
4
by: Aidan | last post by:
Hi, I'm having a bit of trouble with a python script I wrote, though I'm not sure if it's related directly to python, or one of the other...
1
by: Nader | last post by:
Hello, I have a gzip file and I try to read from this file withe the next statements: gunziped_file = gzip.GzipFile('gzip-file') input_file =...
0
by: Gabriel Genellina | last post by:
En Wed, 19 Nov 2008 13:25:03 -0200, Barak, Ron <Ron.Barak@lsi.com> escribió: Note *where* the exception is raised. Until something is actually...
0
by: Barak, Ron | last post by:
Thanks Gabriel, Okay, I get it: I was under the impression that the format check would be done on the open. Bye, Ron. -----Original...
0
by: tammygombez | last post by:
Hey fellow JavaFX developers, I'm currently working on a project that involves using a ComboBox in JavaFX, and I've run into a bit of an issue....
0
by: tammygombez | last post by:
Hey everyone! I've been researching gaming laptops lately, and I must say, they can get pretty expensive. However, I've come across some great...
0
by: concettolabs | last post by:
In today's business world, businesses are increasingly turning to PowerApps to develop custom business applications. PowerApps is a powerful tool...
0
better678
by: better678 | last post by:
Question: Discuss your understanding of the Java platform. Is the statement "Java is interpreted" correct? Answer: Java is an object-oriented...
0
by: CD Tom | last post by:
This happens in runtime 2013 and 2016. When a report is run and then closed a toolbar shows up and the only way to get it to go away is to right...
0
by: CD Tom | last post by:
This only shows up in access runtime. When a user select a report from my report menu when they close the report they get a menu I've called Add-ins...
0
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge...
0
by: Matthew3360 | last post by:
Hi there. I have been struggling to find out how to use a variable as my location in my header redirect function. Here is my code. ...
0
by: AndyPSV | last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.