FoxPro Programming
WinHttpRequest
Gravatar is a globally recognized avatar based on your email address. WinHttpRequest
  LeonCris
  All
  Feb 17, 2019 @ 09:24pm

Hi All

Before I enabled compression in IIS 7, the response text using httpRequest object in VFP was readable as expected. When I enable compression, looking at the response.body I guess the compression indeed is working, BUT the response.text is unreadable. I guess the response.text was gzipped. How do I decompress the response to get the original text from the web page or web server. I made sure that the accept-encoding is gzip,deflate.

loHTTP.setRequestHeader("Accept-encoding", "gzip,deflate")

Thanks a lot

Gravatar is a globally recognized avatar based on your email address. re: WinHttpRequest
  Rick Strahl
  LeonCris
  Feb 17, 2019 @ 10:26pm

You have to manually decompress the content - the WinInet/WinHttp libraries do not support automatic decompressions.

This is handled in our wwHttp class automatically via the loHttp.lAllowGzip which if it detects GZip automatically unpackages it. I don't recall what I do for that exactly, but I use zlib to handle the decompression.

You can prevent the server from sending GZip content to you by not sending the Accept-Encoding header which basically lets the server know that your client doesn't support gzip and so should send uncompressed content. Other clients (like browsers) can however get the gzipped content.

Access Http Content with wwHttp

+++ Rick ---

© 1996-2019