Comressed www

Comressed www

Post by Yusuf Motiwal » Sat, 16 Nov 1996 04:00:00



Hi,

I'm sorry if this is not a proper place for this discussion. I'm new to
Linux and Networking, i need your help.

I was thinking about the compressed home pages. If the HTML document can be
kept in compressed form, the www can be more faster. If the binary files
can not be compressed well, atleast big text files can be kept compressed.
The compatability issue can be solved by adding buffer daemon between
web browsers and internet. I tried this out, and it works very well.
what i done is

1. Wrote a buffer daemon which connects to internet, and gives data to
   web browsers. It checks for the file start with "<www-pack>", and
   if file start with "<www-pack>", it decompress it and pass it to
   web browser, otherwise pass the the data directly.

2. created a service in /etc/service and run daemon from inetd

3. Set manual proxy in Netscape

I have kept the comressed and normal file at

Normal HTML:
http://www.geocities.com/SiliconValley/Park/4863/pack.html
Size 24K

Compressed HTML:
http://www.geocities.com/SiliconValley/Park/4863/pack1.html
Size 9K

Here is the source of buffer daemon. Please, don't look at the code style.
You have to change the PROXY_SERV and P_PORT.

Is it practical ? Please give your opinions.

Bye

Yusuf

------------------------------ cut here -----------------------------------

/*


*/

#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netdb.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>

#define PROXY_SERV "ee"
#define P_PORT 8080
#define F_NAME "/tmp/www000001.gz"

main()
{

int s;
int len;
struct sockaddr_in sa;
struct hostent *hp;
struct servent *sp;
char buf[BUFSIZ+1];
FILE *fp;
int handle,i,i1,packed=0;

if((hp=gethostbyname(PROXY_SERV))==NULL)
        {
        fprintf(stderr,"Unreachable host \n");
        exit(1);
        }

bcopy((char *) hp->h_addr, (char *)&sa.sin_addr,hp->h_length);
sa.sin_family=hp->h_addrtype;

sa.sin_port=htons(P_PORT);

if((s=socket(hp->h_addrtype, SOCK_STREAM, 0)) < 0 )
        {
        fprintf(stderr,"socket Error");
        exit(1);
        }

if(connect(s, &sa, sizeof sa) < 0)
        {
        fprintf(stderr,"connect error");
        exit(1);
        }

        len=read(0, buf, BUFSIZ);
        len=write(s, buf, len);

        len=BUFSIZ;
        i1=0;
        handle=0;
        fflush(fp);
        while(len>0)
        {
        len=read(s, buf, BUFSIZ);

        for (i=0; i<len && i1<1024 && packed == 0;i++,i1++)
                if((strncmp("<www-pack>",&buf[i],10))==0)
                        {
                        i+=9;
                        packed=1;
                        handle=open("/tmp/www000001.gz",O_CREAT|O_RDWR|O_TRUNC);
                        }
        if(packed)
                {
                len=write(handle, &buf[i], len-i);
                }
        else
                write(handle,buf,len);  
        }
        if(packed)
                {

                close(handle);
                system("zcat /tmp/www000001.gz");
                unlink("/tmp/www000001.gz");
                }

close(s);
exit(0);

Quote:}

----------------------------------------------------------------------------

+--------------------------[ Yusuf Motiwala ]---------------------------+
| H-6/#60,Indian Institute of Technology,                               |
| Powai, Mumbai - 400 076, INDIA                                        |

| Phone : 91-22-578 2545 ext 2448 (O), 91-22-578 1023 (R)               |
+-----------------------------------------------------------------------+

 
 
 

Comressed www

Post by B.A.McCau.. » Mon, 18 Nov 1996 04:00:00



Quote:>I'm sorry if this is not a proper place for this discussion. I'm new to
>Linux and Networking, i need your help.

But surely you can see this is not a Linux matter?

Quote:>I was thinking about the compressed home pages. If the HTML document can be
>kept in compressed form, the www can be more faster.

Yes and the latest versions of HTTP support this - it won't be long
until we start to see more and more HTTP servers/clients supporting it.

Quote:>If the binary files
>can not be compressed well, atleast big text files can be kept compressed.
>The compatability issue can be solved by adding buffer daemon between
>web browsers and internet. I tried this out, and it works very well.
>what i done is

>1. Wrote a buffer daemon which connects to internet, and gives data to
>   web browsers. It checks for the file start with "<www-pack>", and
>   if file start with "<www-pack>", it decompress it and pass it to
>   web browser, otherwise pass the the data directly.

It would be better to add compression mode covertion support to
existing HTTP proxy s/w (if it's not already there).

By having a compressing proxy on your local box, taking to a a
compressing proxy on the other side of your slow link to can get the
same benefit without being incompatible with future developments.

--

 .  _\\__[oo       from       | Phones: +44 121 471 3789 (home)

.  l___\\    /~~) /~~[  /   [ | PGP-fp: D7 03 2A 4B D8 3A 05 37...
 # ll  l\\  ~~~~ ~   ~ ~    ~ | http://wcl-l.bham.ac.uk/~bam/


 
 
 

1. LBX or aother comressed X

I have been looking at finding a way to run X over a 28.8 PPP line and I
have been looking at a way to use some type of compressed X.  I have
found 2 possibilities.  One is using LBX but I don't think that I have
the space to compile XFree+lbx.  Are the binaries on sunsite or in
slackware or any where have this option compiled in.  I am currently
using 3.1 from Slackware 2.1 but I will use any binary I can find.

the other option doesn't really belong here but if any one know where I
can find sxpc that has been ported to sunOS 5.4 I would be greatly
appreciative.  

--
-brendan                     -=Have you tried Linux today?=-

"I think animal testing is a terrible idea;
they get all nervous and give the wrong answers."
                                - _A Bit of Fry and Laurie_
                  *finger for pgp*

2. Win 95 Nightmare.

3. Comressing (gzip and tar)

4. 2.5.54 problem with IDE ICH4 and aic7xxx

5. WWW: Request for Feedback on WWW site on Linux distributions

6. Dynamic device reconfiguration

7. Repocopy request: www/jakarta-tomcat4 -> www/jakarta-tomcat4-devel

8. MS Word synonymous with ".doc"?

9. Just noticed this on comp.infosystems.www (Re: WWW Announcement at PC Week)

10. WWW: Linux BYTE Benchmarks WWW Site

11. Repocopy request: www/jakarta-tomcat4 -> www/jakarta-tomcat41

12. WWW: linux for starters WWW-page

13. LOCAL/WWW: Czech Linux WWW page