LoginSignup
5
5

More than 5 years have passed since last update.

GaucheでURIからファイルGET

Posted at

httpにしか対応してないし例外処理も甘いけど、書き捨て程度なら。
Gaucheでしかテストしてないので「Schemeで」とは言えないかな。
標準ライブラリに同等の機能は無いものなのか?

uri-get.scm
(use rfc.http)
(use rfc.uri)

(define (uri-get uri)
  (receive (code status body)
    (receive (scheme user-info hostname port path query frament)
      (uri-parse uri)
      (if (eq? path #f)
        (http-get hostname "/")
        (http-get hostname path)))
    body))

(print (uri-get "http://example.com"))
5
5
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
5
5