inspired by this thread about getNetText and Proxies a couple of days ago, I’ve now written a little parent script (“HTTP Class”) for using MultiUser xtra for all kind of HTTP requests. It’s far from beeing perfect, but maybe a good starting-point for further customizing.
It has the following features/advantages over standard net lingo:
– supports all HTTP/1.1 methods: GET, POST, HEAD, TRACE, OPTIONS, PUT
(e.g. HEAD can be useful to check if a server is running, or to find out the size of some file without actually downloading it; TRACE can be used to find out which Proxy-Server(s) exactly is/are used; …)
– accessing password protected resources (Basic Authentication, like common Apache .htaccess/.htpasswd protection)
– using Proxy-Servers (without or with Basic Authentication)
– sending arbitrary HTTP-Headers
– supports file uploads with POST (data is automatically base64-encoded, script on the server has to decode it again) and PUT method
– Cookie-Support (send and receive session-cookies; support of persistent cookies could easily be added)
– Session-Support (by automatic resending of session-cookie)
– resuming of interrupted downloads (simply by adding “Range: bytes=
-” and “If-Range: ” HTTP headers
Included in the zip/sit is also a little tool called “HTTP Sniffer” that’s based on HTTP class. I allows to quickly send arbitrary HTTP requests to any URL, and analyze the response (a bit like the “Live HTTP headers” Firefox extension, but more powerfull). Maybe it can be useful to examine http-network problems or debug server scripts…
Feedbacks and ideas for improvements welcome.