Update typed/net/url

Closes PR 14330

original commit: f1adc8e856109b7740c191a9ab2a964643c569f7
This commit is contained in:
Asumu Takikawa 2014-01-31 11:35:30 -05:00
parent ae0a62c106
commit b93b0de228

View File

@ -18,17 +18,24 @@
(require/opaque-type URL-Exception url-exception? net/url)
(provide URL-Exception url-exception?)
(require/opaque-type HTTP-Connection http-connection? net/url)
(provide HTTP-Connection http-connection?)
(define-type-alias PortT (case-lambda (url -> Input-Port) (url (Listof String)-> Input-Port)))
(define-type-alias PortT/String (case-lambda (url String -> Input-Port) (url String (Listof String)-> Input-Port)))
(define-type-alias PortT/Bytes (case-lambda (url Bytes -> Input-Port) (url Bytes (Listof String)-> Input-Port)))
(provide PortT PortT/String PortT/Bytes)
(require/typed/provide net/url
[path->url (Path -> url)]
[path->url (Path-String -> url)]
[url->path (case-lambda (url -> Path) (url (U 'unix 'windows) -> Path))]
[file-url-path-convention-type (Parameter (U 'unix 'windows))]
[get-pure-port PortT]
[get-pure-port
(case-> (url [#:redirections Natural] -> Input-Port)
(url (Listof String) [#:redirections Natural] -> Input-Port))]
[head-pure-port PortT]
[delete-pure-port PortT]
@ -36,19 +43,40 @@
[head-impure-port PortT]
[delete-impure-port PortT]
[post-pure-port PortT/String]
[put-pure-port PortT/String]
[post-pure-port PortT/Bytes]
[put-pure-port PortT/Bytes]
[post-impure-port PortT/String]
[put-impure-port PortT/String]
[post-impure-port PortT/Bytes]
[put-impure-port PortT/Bytes]
[display-pure-port (Input-Port -> Void)]
[purify-port (Input-Port -> String)]
[get-pure-port/headers
(case-> (url [#:redirections Natural]
[#:status? Boolean]
[#:connection (Option HTTP-Connection)]
-> (values Input-Port String))
(url (Listof String)
[#:redirections Natural]
[#:status? Boolean]
[#:connection (Option HTTP-Connection)]
-> (values Input-Port String)))]
[make-http-connection (-> HTTP-Connection)]
[http-connection-close (HTTP-Connection -> Void)]
[call/input-url (case-lambda [url url (Input-Port -> Any) -> Any])] ;;FIXME - need polymorphism
[current-proxy-servers (Parameter (Listof (List String String Integer)))]
[http-sendrecv/url
(url [#:method (U Bytes String Symbol)]
[#:headers (Listof (U Bytes String))]
[#:data (Option (U Bytes String))]
[#:content-decode (Listof Symbol)]
-> (values Bytes (Listof Bytes) Input-Port))]
[netscape/string->url (String -> url)]
[string->url (String -> url)]
[url->string (url -> String)]