SWebget

This program does nothing else but get you a webpage an prints it to stdout. I first called it webget, but jfriedl@omron.co.jp wrote a perl-program with the same name and more functionality. So I Added an S for Slim.

It was created as part of a shell-script that downloads some daily comics of the net, but that's long gone now. I first used webcopy, but this one caused in my opinion too much load for getting just one page, so I downloaded myself a template for a tcp connection (I think it was called gnu-finger 1.37 ;-) and modified it (mainly stripped it down) to fit my needs. Later a bug was fixed (it was first running only under solaris, because of getservbynumber), two features were added (size check and additional header lines).

And now it's open to the public, in case anyone might have a use for it.

Download


SWebget Documentation

SWebget is a simple program that prints a webpage to stdout. It was meant to be ultra lightweight, so don't look for any (unnecessary) features here.

The syntax is: SWebget <request-string> <host> (port) (additional header lines)

request-string: is the page to be gotten on the server (NOT the url, at least not in a direct connection)
host: the web host from where to get the page from
port: guess (default: 80)
additional header lines: for http-experts ;-) ... explaned later.

Examples:
get the url http://www.uni-hildesheim.de/~smol0075/swebget/ directly
$ swebget  /~smol0075/swebget/  www.uni-hildesheim.de
as you can easily see, you'll have to split the url yourself into host and path.
get the same url with a proxy server named proxy.my.org at port 8080
$ swebget http://www.uni-hildesheim.de/~smol0075/swebget/ proxy.my.org 8080
see: when you use a proxy server, you can enter a normal url.

What it does:

  1. It opens a connection to <host> at port <port>
    (just like telnet <host> <port>)
  2. It sends the request header
    (GET <request-string> HTTP/1.0)
  3. It sends the additional header lines
  4. It ends the request header
  5. It gets the response header and dumps it, except for "Content-Length:"
  6. It gets the response data and prints them to stdout.
  7. After getting and printing the data, it ends.
  8. If a "Content Length:" was given and the gotten data is smaller it will return with an exit code of 42, else 0.

What it does EXACTLY:

I don't know. [ Well, I didn't know back then in 1998. Now I'm wiser ;-) ] I just "borrowed" the code from the gnu finger an adopted it to my needs. Later one bug was fixed looking at the source of lynx. Somehow it does work. Why should I know? It's not part of my plan for world domination. This will be services manager, coming soon.

This program has intentionally no version number, since I hope there will be no other release needed.

If you wanna drop me a line what kind of bullshit this peace of code is, feel free: svolli@svolli.de.


Valid HTML 4.01!