This module extends net/url’s http functions with all the tricks I’ve accumulated for dealing with the various peculiarities of HTTP. It handles redirection (sort of), resuming unfinished downloads, getting the code of the HTTP response (which net/url can’t do), and extracting the modified date of pages as a srfi/19 date structure.
Originally this was supposed to be a HTTP/1.1 client, but then I found that in creating such a thing I was basically rewriting squid, so if you want HTTP/1.1 install squid and set (current-proxy-servers) to ’(("http" "localhost" 3128))
Still doesn’t do SSL right (I think).
(require (prefix-in http: (planet synx/http/2))) (require srfi/19) (http:get (string->url "http://some.where/something") (λ (code type modified headers input) (display headers) (newline) (display (port->string input)) (newline))) (let-values ([(type modified) (download (string->url "http://some.where/something.jpg") (build-path "something.jpg"))]) (file-or-directory-modify-seconds (build-path "something.jpg") (time-second (date->time-utc modified))))