|
|||
|
Hi:
Would like to know if xHarbour has a function which uses the GZIP protocol as a 'compressor' ? I know my Apache Server can use gzip, but would like to know if I can 'pre-zip' a massive page (using the gzip protocol) in my xHarbour CGI 'script', and then send it to my Apache server -- which will pass it to various browsers where it will be 'unzipped'. btw, I use the 7ZIP frequently, and *it* has a gzip mode a(among several others) So, is there a xHarbour function available that would work similarly to the following: cZipString := hb_gzip(cMyLong String) Thanks. -Mel Smith -- Mel Smith |
|
|
||||
|
||||
|
|
|
|||
|
Hi Mel,
Can't the compression/decompression be handled by xHarbour's native function? There's hb_compress( string ) functionality ( see tests/compress.prg ) Andi On Mon, 6 Sep 2010 16:53:00 -0600, "Mel Smith" <med_cutout_syntel@aol.com> wrote: >Hi: > > Would like to know if xHarbour has a function which uses the GZIP >protocol as a 'compressor' ? > > I know my Apache Server can use gzip, but would like to know if I can >'pre-zip' a massive page (using the gzip protocol) in my xHarbour CGI >'script', and then send it to my Apache server -- which will pass it to >various browsers where it will be 'unzipped'. > > btw, I use the 7ZIP frequently, and *it* has a gzip mode a(among several >others) > > So, is there a xHarbour function available that would work similarly to >the following: > > cZipString := hb_gzip(cMyLong String) > >Thanks. > >-Mel Smith |
|
|||
|
Andi said:
> Can't the compression/decompression be handled by xHarbour's native > function? > > There's hb_compress( string ) functionality ( see tests/compress.prg ) >> Would like to know if xHarbour has a function which uses the GZIP >>protocol as a 'compressor' ? >> >> I know my Apache Server can use gzip, but would like to know if I can >>'pre-zip' a massive page (using the gzip protocol) in my xHarbour CGI >>'script', and then send it to my Apache server -- which will pass it to >>various browsers where it will be 'unzipped'. >> >> btw, I use the 7ZIP frequently, and *it* has a gzip mode a(among >> several >>others) >> >> So, is there a xHarbour function available that would work similarly >> to >>the following: >> >> cZipString := hb_gzip(cMyLong String) Andi: As I posted above, I must have a GZIP compression function, and also: I must use the 'DEFLATE' methods for that function. Most modern browsers are able use to the gzip method to 're-inflate' large pages on arrival at the client. So, my question is: Has anybody implemented the GZIP method of compression as a function in xHarbour ?? I do know that 7ZIP people have within their 7z.exe executable a method to properly use gzip method (among several other methods). As a last resort I'll try to include 7Zip's program to do the zipping. But, I'd much rather have an xHarbour function to do the job My main problem: I have a massive page (5000 lines of 5 columns) which I use xHarbour (i.e., my CGI program) to build the page, and then stdout(that page) to my Apache Server. MY Apache Server will then transmit the page to my (future) clients I know this page will be viewed approximately 100 times for every time it is modified. Therefore, I don't want to bother having Apache 'deflate' it every one of those ~100 times. I would rather 'pre-zip' the page, and have it ready for Apache to send out across the net *without* going thru its 'deflate' process every time. This saves a *lot* of bandwith for me: the page size is 1Meg+ in size. When it is deflated, it is approx 130Kbutes. So, if 50 clients are entering the site at the same time, I have a lot of processing involved -- both for Apache and for my xHarbour executable. *and* lots of bandwidth used up too ! Thanks for your comments ! -Mel Smith |
|
|||
|
Dear Mel Smith:
On Sep 7, 8:17*am, "Mel Smith" <med_cutout_syn...@aol.com> wrote: > > Can't the compression/decompression be handled by > > xHarbour's native function? .... > * * As I posted above, I must have a GZIP compression > function, and also: *I must use the 'DEFLATE' methods > for that function. *Most modern browsers are able use > to the gzip method to 're-inflate' large pages on arrival > at the client. > > * * So, my question is: *Has anybody implemented the > GZIP method of compression as a function in xHarbour *?? .... The source code is here: http://www.gzip.org/#sources .... available in C. So it should be a "small" matter to make a lib from it, for someone that knows how. David A. Smith |
|
|||
|
On Sep 7, 8:19*pm, dlzc <dl...@cox.net> wrote:
> Dear Mel Smith: > > On Sep 7, 8:17*am, "Mel Smith" <med_cutout_syn...@aol.com> wrote:> > Can't the compression/decompression be handled by > > > xHarbour's native function? > ... > > * * As I posted above, I must have a GZIP compression > > function, and also: *I must use the 'DEFLATE' methods > > for that function. *Most modern browsers are able use > > to the gzip method to 're-inflate' large pages on arrival > > at the client. > > > * * So, my question is: *Has anybody implemented the > > GZIP method of compression as a function in xHarbour *?? > > ... > > The source code is here:http://www.gzip.org/#sources > ... available in C. *So it should be a "small" matter to make a lib > from it, for someone that knows how. > > David A. Smith This is only one of the possible client-side issues: http://support.microsoft.com/kb/837251 Otherwise at gzip.org I've found a small "dll hell", so at server-side each Windows version needs a specific .dll cocktail to be added to the OS folder. Does it really worth in case of tiny traffic ( less than 200 hits for a page ) ? Ella |
|
|||
|
David said:
The source code is here: http://www.gzip.org/#sources .... available in C. So it should be a "small" matter to make a lib from it, for someone that knows how. David: I may not know 'how', but I'll look at the source anyway ![]() -Mel .. |
|
|||
|
Ella said:
This is only one of the possible client-side issues: http://support.microsoft.com/kb/837251 Otherwise at gzip.org I've found a small "dll hell", so at server-side each Windows version needs a specific .dll cocktail to be added to the OS folder. Does it really worth in case of tiny traffic ( less than 200 hits for a page ) ? Ella: There will likely be 1000s (to many thousands -- I hope) of hits, but 'probably' only a few out of every hundred hits will result in my rebuilding the page, and gzipping it again. So, I want to gzip this massive page and pass it to Apache already 'gzipped-up' so I dont have to have Apache performing its own 'DEFLATE' procedure for *every* hit on the page -- and its my First/Main Page too. There is no real way of telling Apache to only deflate certain pages, because my xHarbour CGI app builds every page from templates, and then passes them as a string of chars to my Apache Server -- so there is no 'filename' to pass to Apache. But, can I *hope* that some guru here will 'contrib' an hb_gzip() function for our use ?? Thanks, -Mel |
|
|||
|
Dear Mel Smith
On Sep 7, 3:17*pm, "Mel Smith" <med_cutout_syn...@aol.com> wrote: > David said: > >> The source code is here:http://www.gzip.org/#sources >> ... available in C. *So it should be a "small" matter to >> make a lib from it, for someone that knows how. > > * * I may not know 'how', *but I'll look at the source anyway ![]() They offered a command line interface too, so you could just RUN it. It'd sure pave over the issues that Ella mentioned. David A. Smith |
|
|||
|
Been able to compile it. Now what functionality is needed?
(sorry I am not familiar with gzip nor with Mel's needs) The options are as follows: -- 8< -- gzip 1.2.4 (18 Aug 93) usage: gzip [-acdfhlLnNtvV19] [-S suffix] [file ...] -a --ascii ascii text; convert end-of-lines using local conventions -c --stdout write on standard output, keep original files unchanged -d --decompress decompress -f --force force overwrite of output file and compress links -h --help give this help -l --list list compressed file contents -L --license display software license -n --no-name do not save or restore the original name and time stamp -N --name save or restore the original name and time stamp -q --quiet suppress all warnings -S .suf --suffix .suf use suffix .suf on compressed files -t --test test compressed file integrity -v --verbose verbose mode -V --version display version number -1 --fast compress faster -9 --best compress better file... files to (de)compress. If none given, use standard input. -- 8< -- We can easily interface those to xHarbour via hb_gzip(). Andi On Tue, 7 Sep 2010 17:15:03 -0700 (PDT), dlzc <dlzc1@cox.net> wrote: >Dear Mel Smith > >On Sep 7, 3:17*pm, "Mel Smith" <med_cutout_syn...@aol.com> wrote: >> David said: >> >>> The source code is here:http://www.gzip.org/#sources >>> ... available in C. *So it should be a "small" matter to >>> make a lib from it, for someone that knows how. >> >> * * I may not know 'how', *but I'll look at the source anyway ![]() > >They offered a command line interface too, so you could just RUN it. >It'd sure pave over the issues that Ella mentioned. > >David A. Smith |
|
|||
|
On 7 Wrz, 00:53, "Mel Smith" <med_cutout_syn...@aol.com> wrote:
Hi, > * * So, is there a xHarbour function available that would work similarly to > the following: > * * * * cZipString := hb_gzip(cMyLong String) Harbour has support GZIP functions from ZLIB but it does not support in-memory GZIP compression so you will have to use files, i.e.: hb_gzWrite( hb_gzOpen( "myfile.gz", "w" ), cData ) cGZipData := hb_memoread( "myfile.gz" ) It's possible to create function for in-memory GZIP compression but please remember that GZIP header contains file system information with original file parameters (names, dates, attributes, comments,...) which may be important for the destination process so at least some of them should be set using such function parameters. best regards, Przemek |
|
|||
|
Andi said:
> Been able to compile it. Now what functionality is needed? > (sorry I am not familiar with gzip nor with Mel's needs) > > The options are as follows: > > -- 8< -- > gzip 1.2.4 (18 Aug 93) > > usage: gzip [-acdfhlLnNtvV19] [-S suffix] [file ...] > -a --ascii ascii text; convert end-of-lines using local conventions > -c --stdout write on standard output, keep original files unchanged > -d --decompress decompress > -f --force force overwrite of output file and compress links > -h --help give this help > -l --list list compressed file contents > -L --license display software license > -n --no-name do not save or restore the original name and time stamp > -N --name save or restore the original name and time stamp > -q --quiet suppress all warnings > -S .suf --suffix .suf use suffix .suf on compressed files > -t --test test compressed file integrity > -v --verbose verbose mode > -V --version display version number > -1 --fast compress faster > -9 --best compress better > file... files to (de)compress. If none given, use standard input. > -- 8< -- > > We can easily interface those to xHarbour via hb_gzip(). Andi : I'm going golfing for the day, and will be back at my machines tomorrow. Also, 7-ZIP has a complete section ongzip which I was going to look at (since I have 7zip on my machine). I note that the source is 17 years old, and the links that David sent me showed the binaris were creatd in 1997 ?? Also, apparently, 7-ZIP has a dll package that encompassing the gzip deflate needs ? I guess I have to look into the Apache Server requirements, and how it treats a stream of data coming to it under the 'content-type application/x-gzip'. Then see what happens when I send a 'deflated' bunch of stuff to Apache. I'm in over my head here I think ! Thanks for thinking of this. Back tomorrow ! -Mel Smith |
|
|||
|
Przemek said:
Harbour has support GZIP functions from ZLIB but it does not support in-memory GZIP compression so you will have to use files, i.e.: hb_gzWrite( hb_gzOpen( "myfile.gz", "w" ), cData ) cGZipData := hb_memoread( "myfile.gz" ) Przemek: I have no library with the hb_gzwrite() or hb_gzopen() functions in *xHarbour* Altho I note that 'Harbour' has these functions in hbextern.lib Does anyone have the hbextern.lib for xHarbour ?? Thanks -Mel Smith |
|
|||
|
On Thu, 9 Sep 2010 13:04:22 -0600, "Mel Smith"
<med_cutout_syntel@aol.com> wrote: >Does anyone have the hbextern.lib for xHarbour ?? Do you really need it? If yes, we can put a two liner code eg.: #include "hbextern.ch" PROC ___EXTERN() Compile it and link it as hbextern.lib. Andi |
|
|||
|
Andi said::
> Do you really need it? > If yes, we can put a two liner code eg.: > > #include "hbextern.ch" > PROC ___EXTERN() > > Compile it and link it as hbextern.lib. Hi Andi: Thank you for thinking of me ! But right now, I'm getting some 'grief' from the Apache Configuration ng telling me that I shouldn't do this or that, or that I don't understand what I'm asking for, or that I should do it a lot differently ![]() So, I'm puzzled and discouraged over this problem. I guess I misunderstand when Apache allows 'Content-Type: application/x-gzip' as the header for a stream of data that I can send to my Apache Server, and yet everyone says this is a 'no-no'. So, for right now, I use Apache itself to 'deflate' my massive 5000-line page (1 Meg +) *every time* somebody visits my site. If I can find a way to send a stream of 'condensed' text to Apache, then I could deflate it myself *1* time out of a hundred, and just pass the condensed stream instead of having Apache go thru its 'deflate' procedure every single time for every page I pass. Please don't waste anymore time on this for me. I've wasted enough of your time already. Thank you. -Mel Smith |
|
|||
|
Hi Mel,
Following is a URL that may relate to your problem. Perhaps you may want to take a look. It talks about gzip/gunzip. http://www.innerjoin.org/apache-compression/howto.html Andi On Thu, 9 Sep 2010 18:10:21 -0600, "Mel Smith" <med_cutout_syntel@aol.com> wrote: >Andi said:: > >> Do you really need it? >> If yes, we can put a two liner code eg.: >> >> #include "hbextern.ch" >> PROC ___EXTERN() >> >> Compile it and link it as hbextern.lib. > > >Hi Andi: > > Thank you for thinking of me ! > > But right now, I'm getting some 'grief' from the Apache Configuration ng >telling me that I shouldn't do this or that, or that I don't understand what >I'm asking for, or that I should do it a lot differently ![]() > > So, I'm puzzled and discouraged over this problem. > > I guess I misunderstand when Apache allows 'Content-Type: >application/x-gzip' as the header for a stream of data that I can send to my >Apache Server, and yet everyone says this is a 'no-no'. > > So, for right now, I use Apache itself to 'deflate' my massive 5000-line >page (1 Meg +) *every time* somebody visits my site. If I can find a way to >send a stream of 'condensed' text to Apache, then I could deflate it myself >*1* time out of a hundred, and just pass the condensed stream instead of >having Apache go thru its 'deflate' procedure every single time for every >page I pass. > >Please don't waste anymore time on this for me. > >I've wasted enough of your time already. > >Thank you. > >-Mel Smith > |
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|