diff --git a/pkgs/typed-racket-pkgs/typed-racket-doc/typed-racket/scribblings/reference/libraries.scrbl b/pkgs/typed-racket-pkgs/typed-racket-doc/typed-racket/scribblings/reference/libraries.scrbl index 60881d89b8..7a08d3f9aa 100644 --- a/pkgs/typed-racket-pkgs/typed-racket-doc/typed-racket/scribblings/reference/libraries.scrbl +++ b/pkgs/typed-racket-pkgs/typed-racket-doc/typed-racket/scribblings/reference/libraries.scrbl @@ -57,6 +57,7 @@ The following libraries are included with Typed Racket in the @defmodule/incl[typed/net/ftp] @defmodule/incl[typed/net/gifwrite] @defmodule/incl[typed/net/head] +@defmodule/incl[typed/net/http-client] @defmodule/incl[typed/net/imap] @defmodule/incl[typed/net/mime] @defmodule/incl[typed/net/nntp] diff --git a/pkgs/typed-racket-pkgs/typed-racket-more/typed/net/http-client.rkt b/pkgs/typed-racket-pkgs/typed-racket-more/typed/net/http-client.rkt new file mode 100644 index 0000000000..a5cc778e1c --- /dev/null +++ b/pkgs/typed-racket-pkgs/typed-racket-more/typed/net/http-client.rkt @@ -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))])