Re: http serving..

Juergen Schoenwaelder (schoenw@cs.utwente.nl)
Thu, 30 May 1996 15:09:18 +0200

Garry Grimes <grimesg@ul.ie> wrote:

> 1) Can I run a http server on the same host as the 'smart' SNMP agent and
> use 'http put' from another host to download script files to the agent ?
> If not then the method from the scotty examples will be fine, ie. SNMP
> variables indicating URL and filename.

This should work although I did not do test it myself.

> 2) When I do use the 'http server' command to turn a host into a server
> how do I then use a corresponding 'http get' to retrieve a file via
> the server ? My understanding of URL's is a bit hazy, and I don't know
> how to specify one when doing a 'http get'. It obviously involves more
> than something like: http get http://ash.ece.ul.ie/anything.txt
> or I would at least be able to connect to the server.

Here is a small example what you should do. Lets first look at the
server script:

http server 5555
http bind motd get {
puts stderr "Got a put request from %A for %P."
return /etc/motd
}

A binding usually returns the local file name that is send back to the
client. You can create these files on the fly if you like. A script
may also return a HTTP error name which will cause the server to send
a corresponding error response.

A HTTP client can now get the exported /etc/motd file using:

http get http://server:5555/motd /tmp/motd

Note that you have to specify the port number on which the scotty HTTP
server is running. Otherwise you will connected to the default HTTP
port 80 which is probably not what you want. Writing a document via
put methods does not work correctly right now. Scotty should write the
received object into a temporary file name and pass the name of the
file to the script using another % escape. This need some more work.

Juergen