Add net/http-client to Typed Racket
This commit is contained in:
parent
0b045ba77b
commit
7ed93e6fba
|
@ -57,6 +57,7 @@ The following libraries are included with Typed Racket in the
|
||||||
@defmodule/incl[typed/net/ftp]
|
@defmodule/incl[typed/net/ftp]
|
||||||
@defmodule/incl[typed/net/gifwrite]
|
@defmodule/incl[typed/net/gifwrite]
|
||||||
@defmodule/incl[typed/net/head]
|
@defmodule/incl[typed/net/head]
|
||||||
|
@defmodule/incl[typed/net/http-client]
|
||||||
@defmodule/incl[typed/net/imap]
|
@defmodule/incl[typed/net/imap]
|
||||||
@defmodule/incl[typed/net/mime]
|
@defmodule/incl[typed/net/mime]
|
||||||
@defmodule/incl[typed/net/nntp]
|
@defmodule/incl[typed/net/nntp]
|
||||||
|
|
|
@ -0,0 +1,48 @@
|
||||||
|
#lang typed/racket/base
|
||||||
|
|
||||||
|
(define-type BString (U Bytes String))
|
||||||
|
|
||||||
|
(require (only-in typed/openssl
|
||||||
|
SSL-Client-Context))
|
||||||
|
|
||||||
|
(require/typed/provide net/http-client
|
||||||
|
[#:opaque HTTP-Connection http-conn?]
|
||||||
|
[http-conn (-> HTTP-Connection)]
|
||||||
|
[http-conn-live? (-> HTTP-Connection Boolean)]
|
||||||
|
|
||||||
|
[http-conn-open!
|
||||||
|
(->* [HTTP-Connection BString]
|
||||||
|
[#:ssl? (U Boolean Symbol SSL-Client-Context) #:port Positive-Integer]
|
||||||
|
Void)]
|
||||||
|
|
||||||
|
[http-conn-open
|
||||||
|
(->* [BString]
|
||||||
|
[#:ssl? (U Boolean Symbol SSL-Client-Context) #:port Positive-Integer]
|
||||||
|
HTTP-Connection)]
|
||||||
|
|
||||||
|
[http-conn-close! (-> HTTP-Connection Void)]
|
||||||
|
[http-conn-abandon! (-> HTTP-Connection Void)]
|
||||||
|
|
||||||
|
[http-conn-send!
|
||||||
|
(->* [HTTP-Connection BString]
|
||||||
|
[#:version BString #:method (U BString Symbol) #:close? Boolean #:headers (Listof BString)
|
||||||
|
#:content-decode (Listof Symbol) #:data (Option BString)]
|
||||||
|
Void)]
|
||||||
|
|
||||||
|
[http-conn-recv!
|
||||||
|
(->* [HTTP-Connection]
|
||||||
|
[#:content-decode (Listof Symbol) #:close? Boolean]
|
||||||
|
(values Bytes (Listof Bytes) Input-Port))]
|
||||||
|
|
||||||
|
[http-conn-sendrecv!
|
||||||
|
(->* [HTTP-Connection BString]
|
||||||
|
[#:version BString #:method (U BString Symbol) #:headers (Listof BString)
|
||||||
|
#:data (Option BString) #:content-decode (Listof Symbol) #:close? Boolean]
|
||||||
|
(values Bytes (Listof Bytes) Input-Port))]
|
||||||
|
|
||||||
|
[http-sendrecv
|
||||||
|
(->* [BString BString]
|
||||||
|
[#:ssl? (U Boolean Symbol SSL-Client-Context) #:port Positive-Integer #:version BString
|
||||||
|
#:method (U BString Symbol) #:headers (Listof BString) #:data (Option BString)
|
||||||
|
#:content-decode (Listof Symbol)]
|
||||||
|
(values Bytes (Listof Bytes) Input-Port))])
|
Loading…
Reference in New Issue
Block a user