Add a simple Gif and explain how to use it in the README.md
This commit is contained in:
parent
d61f8b8195
commit
542585e529
32
README.md
32
README.md
@ -1,33 +1,25 @@
|
||||
# A simple HTTP client (http/1.1 & h2) with [Miou][miou]
|
||||
|
||||

|
||||
|
||||
```ocaml
|
||||
let getaddrinfo dns =
|
||||
{ Happy.getaddrinfo = fun record host -> Dns_miou.getaddrinfo dns record host }
|
||||
|
||||
let () = Mirage_crypto_rng_unix.initialize (module Mirage_crypto_rng.Fortuna)
|
||||
|
||||
let () =
|
||||
Miou_unix.run @@ fun () ->
|
||||
let daemon, resolver = Happy.stack () in (* happy-eyeballs *)
|
||||
let dns = Dns_miou.create resolve in
|
||||
Happy.inject_resolver ~getaddrinfo:(getaddrinfo dns) resolver; (* dns x happy-eyeballs *)
|
||||
let acc = Buffer.create 0x100 in
|
||||
let f buf str = Buffer.add_string buf str; buf in
|
||||
begin match Httpcats.request ~resolver ~f ~uri:"https://blog.osau.re/" acc with
|
||||
| Ok (_response, buf) ->
|
||||
Format.printf "%s%!" (Buffer.contents buf)
|
||||
| Error err ->
|
||||
Format.eprintf "Got an error: %a\n%!" Httpcats.pp_error err
|
||||
end;
|
||||
Happy.kill daemon
|
||||
$ git clone https://github.com/robur-coop/httpcats
|
||||
$ cd httpcats
|
||||
$ opam pin add -yn .
|
||||
$ dune build app/pars.exe
|
||||
$ cat >to_download.txt <<EOF
|
||||
https://builds.osau.re/job/bob/build/latest/f/bin/bob.com
|
||||
EOF
|
||||
$ dune exec app/pars.exe -- < to_download.txt
|
||||
```
|
||||
|
||||
**NOTE**: it requires the upstream version of `miou`!
|
||||
|
||||
- [ ] Fix the issue between HTTP/1.1 and TLS (and close-notify)
|
||||
- [x] Fix the issue between HTTP/1.1 and TLS (and close-notify)
|
||||
- [ ] Implement some tests
|
||||
- [ ] Documentation (.ml & .mli)
|
||||
- [ ] DNS resolution over UDP
|
||||
- [ ] DNS over TLS
|
||||
- [ ] happy-eyeballs
|
||||
|
||||
[miou]: https://github.com/robur-coop/miou
|
||||
|
||||
BIN
httpcats.gif
Normal file
BIN
httpcats.gif
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 698 KiB |
Loading…
x
Reference in New Issue
Block a user