INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

gzip

gzip

(OP)
I am looking at receiving a gzipped CSV data from the internet.
WinHTTP doesnt seem to unzip files whereas WINinet does.
Is there a way of using the data received by WinHTTP and separately unzipping the text data in vb6?
It is not an actual file at any stage, just data.

RE: gzip

The server should never be using GZIP or deflate compression unless you have added an Accept-Encoding header specifying one or both. It it does, it's a broken server.

However in order to deal with that you would have to use a 3rd party library such as zlibwapi, which is a StdCall-compiled version of zlib with some extra zlib stuff in it.

Look at the first answer under How can I decompress a gzip stream with zlib?

RE: gzip

(OP)
Thanks,
The client has decided not to compress it but may in the future.
This 'server' is dedicated just for this use so maybe it doesn't matter whether is 'broken' or not

RE: gzip

Well "broken" is in the eye of the beholder after all. Those RFCs can sometimes be interpreted different ways.

I think I have GZip-format deflate and inflate working using zlibwapi but it was a little tricky. It turns out that zlibwapi has changed a few function signatures for some reason, and it doesn't seem to be documented anywhere. I found some awkward VB6 code that only inflates but that gave me enough clues to start experimenting.

My code works with itself, but I need to verify it against existing servers and clients.


Here are those functions that are altered:

CODE

'This zlibwapi function signature varies from the standard zlib function
'for some strange reason, and it does not seem to be documented anywhere.
'It has two additional parameters:
Private Declare Function deflateInit2_ Lib "zlibwapi" ( _
    ByRef strm As z_stream, _
    ByVal level As Long, _
    ByVal method As Long, _
    ByVal windowBits As Long, _
    ByVal memLevel As Long, _
    ByVal strategy As Long, _
    ByVal pszZLibVersion As Long, _
    ByVal cbStrm As Long) As Long

'This zlibwapi function signature varies from the standard zlib function
'for some strange reason, and it does not seem to be documented anywhere.
'It has two additional parameters:
Private Declare Function inflateInit2_ Lib "zlibwapi" ( _
    ByRef strm As z_stream, _
    ByVal windowBits As Long, _
    ByVal pszZLibVersion As Long, _
    ByVal cbStrm As Long) As Long 

RE: gzip

Yep, using zlibwapi.dll for gzip compression works fine. Tested with IE 9 and Maxthon 3.3.9 Portable browsers (the only ones handy) and it works with them so I'd trust it.

Just not for deflate compression due to long-standing problems with how Microsoft HTTP clients have incorrectly implemented it. This is why almost nobody's servers support deflate anymore.

RE: gzip

(OP)
Thanks, I'll keep it for the near future.

RE: gzip


concerning the decimal separators, the Cap project doesn't seem to be local aware

RE: gzip

Quote:

concerning the decimal separators, the Cap project doesn't seem to be local aware

Cab project?

I'm not sure where locale settings become an issue there. There isn't any data display or entry involved. And the data passed from Cab to CabTrack takes place in ADO's binary ADTG or textual XML formats, neither of which are locale-specific.

In XML data true is always "true" and numeric values always use "." as decimal point, etc. You only see exceptions in "pidgeon XML" people whang together while ignoring the rules.

Or is there a locale issue somewhere else I missed? If so perhaps you can correct it if it offends your sensibilities. wink

Can you spell "demo?"

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close