[plt-scheme] WebFetchingHttpsUrl

From: Eli Barzilay (eli at barzilay.org)
Date: Tue Sep 11 19:54:30 EDT 2007

On Sep 11, troels knak-nielsen wrote:
> Hi list
> (newbie alert)
> I've found the following page:
> http://schemecookbook.org/Cookbook/WebFetchingHttpsUrl
> Unfortunately, I can't get it to work. When I include the file I
> get: ssl-url.scm:12:9: compile: unbound variable in module in:
> define-compound-unit
> What am I missing?

I'm not sure what's the problem with the example on the page, but if
you just need something that works now, this is some quick code I have
that gives you `ssl:'-prefixed bindings that use https.  (The cookbook
page looks like a more-organized solution.)  (In any case, I think
that at some point it is better to just have a single module that can
deal with both http and https.)

  ;; This will give us ssl:--- for an ssl version of url.ss, but still need an
  ;; explicit port number specification since url.ss does not handle that
  (require (lib "unit.ss")
           (lib "url-sig.ss" "net") (lib "url-unit.ss" "net")
           (lib "tcp-sig.ss" "net") (lib "tcp-unit.ss" "net")
           (lib "ssl-tcp-unit.ss" "net"))
    (compound-unit/infer (import) (export url^) (link tcp@ url@))
    (import) (export url^))
  (define ssl-tcp@ (make-ssl-tcp@ #f #f #f #f #f #f #f))
    (compound-unit (import) (export URL)
      (link [((TCP : tcp^)) ssl-tcp@]
            [((URL : url^)) url@ TCP]))
    (import) (export (prefix ssl: url^)))

          ((lambda (x) (x x)) (lambda (x) (x x)))          Eli Barzilay:
                  http://www.barzilay.org/                 Maze is Life!

Posted on the users mailing list.