?
Solved

How can I decompress the gzip file???

Posted on 2003-03-30
6
Medium Priority
?
293 Views
Last Modified: 2010-04-04
When I receive some content from the TClientSocket Component. The header is:

HTTP/1.1 200 OK
Date: Thu, 27 Mar 2003 16:03:15 GMT
Server: Apache/1.3.22 (Unix) mod_gzip/1.3.19.1a mod_cache/1.0.0
mod_baidu/4.1.1
Status: 0
Connection: close
Content-Type: text/html
Content-Encoding: gzip
Content-Length: 5428


How can I read the zip content of "Content-Encoding: gzip" in Delphi5???

HELP!!!
0
Comment
Question by:honestman
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 

Expert Comment

by:Spetson
ID: 8235818
humm...
What component type are you using to make the connection to the Host?
What type of allowed content/type you specified for this component?
Can you post some more details about your project?
0
 
LVL 1

Accepted Solution

by:
Spida_81 earned 2000 total points
ID: 8237590
I am working on that, too.
I am using Delphi-zlib from
http://www.gewis.win.tue.nl/info/delphizlib/delphizlib.zip

I had to patch it a bit, seems to be made for some earlier version of delphi.
Mostly you'll have to remove every mention of
RegisterPropertyEditor and DsgnIntf in some uses-clauses has become DesignIntf

================================================

uses ..., classes, gzio;

procedure read(FileName:String)
var File:TMemoryStream;
    Input:TStringStream;
    zippedfile:gzfile;
begin
   File := TMemoryStream.Create();
   Input := TStringStream.Create('');

   File.LoadFromFile(FileName);
   zippedfile:=gzopen(FileName,'r',0);
   gzread (zippedfile, File.Memory, File.Size);
   gzclose(zippedfile);
   Input.CopyFrom(File, LFile.Size);

   //Here you have your file in the Stringstream Input

   File.free;
   Input.free;
end;
0
 
LVL 9

Expert Comment

by:mocarts
ID: 8237891
...and RegisterPropertyEditor has moved to DesignEditors :)
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 1

Expert Comment

by:Spida_81
ID: 8238021
I am working with this, too.

Currently I am using DelphiZlib
http://www.gewis.win.tue.nl/info/delphizlib/delphizlib.zip

You'll have to patch it a bit, it seems to be written for an earlier version of Delphi.
You'll have to delete every occurence of "RegisterPropertyEditor"
and change "DsgnIntf" to "DesignIntf" in every uses-clause.

You can the use it with:

uses classes, gzio;

Procedure Readfile(FileName:String);
var File:TMemoryStream;
    Input:TStringStream;
    zippedfile:gzfile;
begin
   File := TMemoryStream.Create();
   Input := TStringStream.Create('');
   File.LoadFromFile(FileName);
   zippedfile:=gzopen(OpenDialog.FileName,'r',0);
   gzread (zippedfile, File.Memory, File.Size);
   gzclose(zippedfile);
   Input.CopyFrom(File, File.Size);
   
   //here you have your files in the Memorystream "File" or in Stringstream Input
   
   File.free;
   Input.free;
end;
0
 
LVL 1

Expert Comment

by:Spida_81
ID: 8238026
sorry for repost, it did come up on my cached version of the page
0
 

Author Comment

by:honestman
ID: 8242382
Test is passed.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
Suggested Courses
Course of the Month13 days, 7 hours left to enroll

800 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question