[racket] retrieving an https url
25 minutes ago, Greg Hendershott wrote:
> I also agree.
>
> It should be a very simple change in url-unit.rkt. The last line of
> `make-ports' is where `tcp-connect' is hardwired: [...]
Yeah, that part isn't complicated, but it was tricky to get things to
conform to the same API it has now. I did a hack that did that, then
Matthew un-hacked it by a minor extension to the API (one new unit).
The bottom line -- which I should have posted here but forgot -- is
that for almost everyone (= people who just require `net/url') it just
works for https now. (It's also possible to install trusted certs if
you need that level of security.)
> ;; connector : url -> (string? (integer-in 1 65535) -> input-port? output-port?)
> ;; returns either tcp-connect or ssl-connect
> (define (connector url)
> (let ([scheme (url-scheme url)])
> (cond [(not scheme) tcp-connect]
> [(string=? scheme "http") tcp-connect]
> [(string=? scheme "https") ssl-connect]
> [else (url-error "Scheme ~a not supported" (url-scheme url))])))
> [...]
FWIW, the implementation adds a `current-connect-scheme' parameter
that gets set to the scheme, then it's possible to wire in a
`tcp-connect' that uses the tcp version or the ssl version based on
that.
--
((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay:
http://barzilay.org/ Maze is Life!