Browse Source

Switch to cohttp(lwt) instead of curl (#57)

This PR makes the fnm binary not to be dependent on `curl`!
remotes/origin/add-simple-redirecting-site
tatchi 6 years ago committed by Gal Schlezinger
parent
commit
3beebc89fa
  1. 2
      Dockerfile
  2. 1
      README.md
  3. 1965
      esy.lock/index.json
  4. 38
      esy.lock/opam/astring.0.8.3/opam
  5. 9
      esy.lock/opam/base-bytes.base/opam
  6. 34
      esy.lock/opam/base64.3.1.0/opam
  7. 50
      esy.lock/opam/cohttp-lwt-unix.2.0.0/opam
  8. 46
      esy.lock/opam/cohttp-lwt.2.0.0/opam
  9. 59
      esy.lock/opam/cohttp.2.0.0/opam
  10. 34
      esy.lock/opam/conduit-lwt-unix.1.4.0/opam
  11. 29
      esy.lock/opam/conduit-lwt.1.4.0/opam
  12. 53
      esy.lock/opam/conduit.1.4.0/opam
  13. 22
      esy.lock/opam/conf-openssl.1/files/osx-build.sh
  14. 30
      esy.lock/opam/conf-openssl.1/opam
  15. 38
      esy.lock/opam/conf-pkg-config.1.1/opam
  16. 43
      esy.lock/opam/fmt.0.8.5/opam
  17. 47
      esy.lock/opam/ipaddr.3.0.0/opam
  18. 37
      esy.lock/opam/jsonm.1.0.1/opam
  19. 57
      esy.lock/opam/logs.0.6.2/opam
  20. 28
      esy.lock/opam/lwt_ssl.1.1.2/opam
  21. 38
      esy.lock/opam/macaddr.3.0.0/opam
  22. 38
      esy.lock/opam/magic-mime.1.1.1/opam
  23. 24
      esy.lock/opam/ssl.0.5.7/opam
  24. 27
      esy.lock/opam/stringext.1.5.0/opam
  25. 33
      esy.lock/opam/uri.2.2.0/opam
  26. 5
      esy.lock/overrides/opam__s__conf_pkg_config_opam__c__1.1_opam_override/package.json
  27. 2
      executable/dune
  28. 69
      library/Http.re
  29. 2
      library/dune
  30. 14
      package.json

2
Dockerfile

@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
FROM frolvlad/alpine-glibc
RUN apk add --no-cache nodejs bash npm curl g++ make m4 patch gmp-dev perl git jq perl-utils
RUN apk add --no-cache nodejs bash npm curl g++ make m4 patch gmp-dev perl git jq perl-utils libressl-dev
USER root

1
README.md

@ -95,7 +95,6 @@ Prints the required shell commands in order to configure your shell, Bash compli @@ -95,7 +95,6 @@ Prints the required shell commands in order to configure your shell, Bash compli
- [ ] Feature: `fnm install lts`?
- [ ] OSX: Add to homebrew?
- [ ] Windows Support?
- [ ] Linux: Replace `curl` usage with `cohttp`/`ocurl` or something else which is statically-linkable
- [ ] Linux: Replace `tar` with a statically linked library too (for ungzip + untar)
## Contributing

1965
esy.lock/index.json

File diff suppressed because it is too large Load Diff

38
esy.lock/opam/astring.0.8.3/opam

@ -0,0 +1,38 @@ @@ -0,0 +1,38 @@
opam-version: "2.0"
maintainer: "Daniel Bünzli <daniel.buenzl i@erratique.ch>"
authors: ["Daniel Bünzli <daniel.buenzl i@erratique.ch>"]
homepage: "http://erratique.ch/software/astring"
doc: "http://erratique.ch/software/astring/doc"
dev-repo: "git+http://erratique.ch/repos/astring.git"
bug-reports: "https://github.com/dbuenzli/astring/issues"
tags: [ "string" "org:erratique" ]
license: "ISC"
depends: [
"ocaml" {>= "4.01.0"}
"ocamlfind" {build}
"ocamlbuild" {build}
"topkg" {build}
"base-bytes"
]
build: [[
"ocaml" "pkg/pkg.ml" "build"
"--pinned" "%{pinned}%" ]]
synopsis: "Alternative String module for OCaml"
description: """
Astring exposes an alternative `String` module for OCaml. This module
tries to balance minimality and expressiveness for basic, index-free,
string processing and provides types and functions for substrings,
string sets and string maps.
Remaining compatible with the OCaml `String` module is a non-goal. The
`String` module exposed by Astring has exception safe functions,
removes deprecated and rarely used functions, alters some signatures
and names, adds a few missing functions and fully exploits OCaml's
newfound string immutability.
Astring depends only on the OCaml standard library. It is distributed
under the ISC license."""
url {
src: "http://erratique.ch/software/astring/releases/astring-0.8.3.tbz"
checksum: "md5=c5bf6352b9ac27fbeab342740f4fa870"
}

9
esy.lock/opam/base-bytes.base/opam

@ -0,0 +1,9 @@ @@ -0,0 +1,9 @@
opam-version: "2.0"
maintainer: " "
authors: " "
homepage: " "
depends: [
"ocaml" {>= "4.02.0"}
"ocamlfind" {>= "1.5.3"}
]
synopsis: "Bytes library distributed with the OCaml compiler"

34
esy.lock/opam/base64.3.1.0/opam

@ -0,0 +1,34 @@ @@ -0,0 +1,34 @@
opam-version: "2.0"
maintainer: "mirageos-devel@lists.xenproject.org"
authors: [ "Thomas Gazagnaire"
"Anil Madhavapeddy"
"Peter Zotov" ]
license: "ISC"
homepage: "https://github.com/mirage/ocaml-base64"
doc: "http://mirage.github.io/ocaml-base64/"
bug-reports: "https://github.com/mirage/ocaml-base64/issues"
dev-repo: "git+https://github.com/mirage/ocaml-base64.git"
synopsis: "Base64 encoding for OCaml"
description: """
Base64 is a group of similar binary-to-text encoding schemes that represent
binary data in an ASCII string format by translating it into a radix-64
representation. It is specified in RFC 4648.
"""
depends: [
"ocaml" {>="4.03.0"}
"base-bytes"
"dune" {build & >= "1.0.1"}
"bos" {with-test}
"rresult" {with-test}
"alcotest" {with-test}
]
build: [
["dune" "subst"]
["dune" "build" "-p" name "-j" jobs]
["dune" "runtest" "-p" name] {with-test}
]
url {
src:
"https://github.com/mirage/ocaml-base64/releases/download/v3.1.0/base64-v3.1.0.tbz"
checksum: "md5=9847073feb4272e513d8c832904e1af7"
}

50
esy.lock/opam/cohttp-lwt-unix.2.0.0/opam

@ -0,0 +1,50 @@ @@ -0,0 +1,50 @@
opam-version: "2.0"
maintainer: "anil@recoil.org"
authors: [
"Anil Madhavapeddy"
"Stefano Zacchiroli"
"David Sheets"
"Thomas Gazagnaire"
"David Scott"
"Rudi Grinberg"
"Andy Ray"
]
synopsis: "CoHTTP implementation for Unix and Windows using Lwt"
description: """
An implementation of an HTTP client and server using the Lwt
concurrency library. See the `Cohttp_lwt_unix` module for information
on how to use this. The package also installs `cohttp-curl-lwt`
and a `cohttp-server-lwt` binaries for quick uses of a HTTP(S)
client and server respectively.
Although the name implies that this only works under Unix, it
should also be fine under Windows too."""
license: "ISC"
tags: ["org:mirage" "org:xapi-project"]
homepage: "https://github.com/mirage/ocaml-cohttp"
doc: "https://mirage.github.io/ocaml-cohttp/"
bug-reports: "https://github.com/mirage/ocaml-cohttp/issues"
depends: [
"ocaml" {>= "4.04.1"}
"dune" {build & >= "1.1.0"}
"conduit-lwt-unix" {>= "1.0.3"}
"cmdliner"
"magic-mime"
"logs"
"fmt" {>= "0.8.2"}
"cohttp-lwt"
"lwt" {>= "3.0.0"}
"base-unix"
"ounit" {with-test}
]
build: [
["dune" "subst"] {pinned}
["dune" "build" "-p" name "-j" jobs]
["dune" "runtest" "-p" name "-j" jobs] {with-test}
]
dev-repo: "git+https://github.com/mirage/ocaml-cohttp.git"
url {
src:
"https://github.com/mirage/ocaml-cohttp/releases/download/v2.0.0/cohttp-v2.0.0.tbz"
checksum: "md5=c354599fdb4f2625b6510182de0fc86b"
}

46
esy.lock/opam/cohttp-lwt.2.0.0/opam

@ -0,0 +1,46 @@ @@ -0,0 +1,46 @@
opam-version: "2.0"
maintainer: "anil@recoil.org"
authors: [
"Anil Madhavapeddy"
"Stefano Zacchiroli"
"David Sheets"
"Thomas Gazagnaire"
"David Scott"
"Rudi Grinberg"
"Andy Ray"
]
synopsis: "CoHTTP implementation using the Lwt concurrency library"
description: """
This is a portable implementation of HTTP that uses the Lwt
concurrency library to multiplex IO. It implements as much of the
logic in an OS-independent way as possible, so that more specialised
modules can be tailored for different targets. For example, you
can install `cohttp-lwt-unix` or `cohttp-lwt-jsoo` for a Unix or
JavaScript backend, or `cohttp-mirage` for the MirageOS unikernel
version of the library. All of these implementations share the same
IO logic from this module."""
license: "ISC"
tags: ["org:mirage" "org:xapi-project"]
homepage: "https://github.com/mirage/ocaml-cohttp"
doc: "https://mirage.github.io/ocaml-cohttp/"
bug-reports: "https://github.com/mirage/ocaml-cohttp/issues"
depends: [
"ocaml" {>= "4.04.1"}
"dune" {build & >= "1.1.0"}
"cohttp" {>= "1.0.0"}
"lwt" {>= "2.5.0"}
"sexplib0" {< "v0.12"}
"ppx_sexp_conv" {>= "v0.9.0" & < "v0.12"}
"logs"
]
build: [
["dune" "subst"] {pinned}
["dune" "build" "-p" name "-j" jobs]
["dune" "runtest" "-p" name "-j" jobs] {with-test}
]
dev-repo: "git+https://github.com/mirage/ocaml-cohttp.git"
url {
src:
"https://github.com/mirage/ocaml-cohttp/releases/download/v2.0.0/cohttp-v2.0.0.tbz"
checksum: "md5=c354599fdb4f2625b6510182de0fc86b"
}

59
esy.lock/opam/cohttp.2.0.0/opam

@ -0,0 +1,59 @@ @@ -0,0 +1,59 @@
opam-version: "2.0"
maintainer: "anil@recoil.org"
authors: [
"Anil Madhavapeddy"
"Stefano Zacchiroli"
"David Sheets"
"Thomas Gazagnaire"
"David Scott"
"Rudi Grinberg"
"Andy Ray"
]
synopsis: "An OCaml library for HTTP clients and servers"
description: """
Cohttp is an OCaml library for creating HTTP daemons. It has a portable
HTTP parser, and implementations using various asynchronous programming
libraries.
See the cohttp-async, cohttp-lwt, cohttp-lwt-unix, cohttp-lwt-jsoo and
cohttp-mirage libraries for concrete implementations for particular
targets.
You can implement other targets using the parser very easily. Look at the `IO`
signature in `lib/s.mli` and implement that in the desired backend.
You can activate some runtime debugging by setting `COHTTP_DEBUG` to any
value, and all requests and responses will be written to stderr. Further
debugging of the connection layer can be obtained by setting `CONDUIT_DEBUG`
to any value."""
license: "ISC"
tags: ["org:mirage" "org:xapi-project"]
homepage: "https://github.com/mirage/ocaml-cohttp"
doc: "https://mirage.github.io/ocaml-cohttp/"
bug-reports: "https://github.com/mirage/ocaml-cohttp/issues"
depends: [
"ocaml" {>= "4.04.1"}
"dune" {build & >= "1.1.0"}
"re" {>= "1.7.2"}
"uri" {>= "2.0.0"}
"fieldslib" {< "v0.12"}
"sexplib0" {< "v0.12"}
"ppx_fields_conv" {>= "v0.9.0" & < "v0.12"}
"ppx_sexp_conv" {>= "v0.9.0" & < "v0.12"}
"stringext"
"base64" {>= "3.1.0"}
"fmt" {with-test}
"jsonm" {build}
"alcotest" {with-test}
]
build: [
["dune" "subst"] {pinned}
["dune" "build" "-p" name "-j" jobs]
["dune" "runtest" "-p" name "-j" jobs] {with-test}
]
dev-repo: "git+https://github.com/mirage/ocaml-cohttp.git"
url {
src:
"https://github.com/mirage/ocaml-cohttp/releases/download/v2.0.0/cohttp-v2.0.0.tbz"
checksum: "md5=c354599fdb4f2625b6510182de0fc86b"
}

34
esy.lock/opam/conduit-lwt-unix.1.4.0/opam

@ -0,0 +1,34 @@ @@ -0,0 +1,34 @@
opam-version: "2.0"
maintainer: "anil@recoil.org"
authors: [
"Anil Madhavapeddy" "Thomas Leonard" "Thomas Gazagnaire" "Rudi Grinberg"
]
license: "ISC"
tags: "org:mirage"
homepage: "https://github.com/mirage/ocaml-conduit"
bug-reports: "https://github.com/mirage/ocaml-conduit/issues"
depends: [
"ocaml" {>= "4.03.0"}
"dune" {build}
"base-unix"
"ppx_sexp_conv" {< "v0.12"}
"conduit-lwt" {>="1.4.0"}
"lwt" {>= "3.0.0"}
"uri" {>= "1.9.4"}
"ipaddr" {>= "3.0.0"}
]
depopts: ["tls" "lwt_ssl" "launchd"]
conflicts: [
"tls" {< "0.8.0"}
]
build: [
["dune" "subst"] {pinned}
["dune" "build" "-p" name "-j" jobs]
]
dev-repo: "git+https://github.com/mirage/ocaml-conduit.git"
synopsis: "A network connection establishment library for Lwt_unix"
url {
src:
"https://github.com/mirage/ocaml-conduit/releases/download/v1.4.0/conduit-v1.4.0.tbz"
checksum: "md5=204222b8a61692083b79c67c8967fb28"
}

29
esy.lock/opam/conduit-lwt.1.4.0/opam

@ -0,0 +1,29 @@ @@ -0,0 +1,29 @@
opam-version: "2.0"
maintainer: "anil@recoil.org"
authors: [
"Anil Madhavapeddy" "Thomas Leonard" "Thomas Gazagnaire" "Rudi Grinberg"
]
license: "ISC"
tags: "org:mirage"
homepage: "https://github.com/mirage/ocaml-conduit"
bug-reports: "https://github.com/mirage/ocaml-conduit/issues"
depends: [
"ocaml" {>= "4.03.0"}
"dune" {build}
"base-unix"
"ppx_sexp_conv" {< "v0.12"}
"sexplib" {< "v0.12"}
"conduit" {="1.4.0"}
"lwt" {>= "3.0.0"}
]
build: [
["dune" "subst"] {pinned}
["dune" "build" "-p" name "-j" jobs]
]
dev-repo: "git+https://github.com/mirage/ocaml-conduit.git"
synopsis: "A portable network connection establishment library using Lwt"
url {
src:
"https://github.com/mirage/ocaml-conduit/releases/download/v1.4.0/conduit-v1.4.0.tbz"
checksum: "md5=204222b8a61692083b79c67c8967fb28"
}

53
esy.lock/opam/conduit.1.4.0/opam

@ -0,0 +1,53 @@ @@ -0,0 +1,53 @@
opam-version: "2.0"
maintainer: "anil@recoil.org"
authors: [
"Anil Madhavapeddy" "Thomas Leonard" "Thomas Gazagnaire" "Rudi Grinberg"
]
license: "ISC"
tags: "org:mirage"
homepage: "https://github.com/mirage/ocaml-conduit"
doc: "https://mirage.github.io/ocaml-conduit/"
bug-reports: "https://github.com/mirage/ocaml-conduit/issues"
depends: [
"ocaml" {>= "4.03.0"}
"dune" {build}
"ppx_sexp_conv" {< "v0.12"}
"sexplib" {< "v0.12"}
"astring"
"uri"
"result"
"logs" {>= "0.5.0"}
"ipaddr" {>= "3.0.0"}
]
build: [
["dune" "subst"] {pinned}
["dune" "build" "-p" name "-j" jobs]
]
dev-repo: "git+https://github.com/mirage/ocaml-conduit.git"
synopsis: "A network connection establishment library"
description: """
The `conduit` library takes care of establishing and listening for
TCP and SSL/TLS connections for the Lwt and Async libraries.
The reason this library exists is to provide a degree of abstraction
from the precise SSL library used, since there are a variety of ways
to bind to a library (e.g. the C FFI, or the Ctypes library), as well
as well as which library is used (just OpenSSL for now).
By default, OpenSSL is used as the preferred connection library, but
you can force the use of the pure OCaml TLS stack by setting the
environment variable `CONDUIT_TLS=native` when starting your program.
The useful opam packages available that extend this library are:
- `conduit`: the main `Conduit` module
- `conduit-lwt`: the portable Lwt implementation
- `conduit-lwt-unix`: the Lwt/Unix implementation
- `conduit-async` the Jane Street Async implementation
- `mirage-conduit`: the MirageOS compatible implementation
"""
url {
src:
"https://github.com/mirage/ocaml-conduit/releases/download/v1.4.0/conduit-v1.4.0.tbz"
checksum: "md5=204222b8a61692083b79c67c8967fb28"
}

22
esy.lock/opam/conf-openssl.1/files/osx-build.sh

@ -0,0 +1,22 @@ @@ -0,0 +1,22 @@
#!/bin/sh
if [ -e "$HOME/.nix-profile/lib/pkgconfig/openssl.pc" ]; then
# Nix on macOS
res=$(env PKG_CONFIG_PATH=$HOME/.nix-profile/lib/pkgconfig pkg-config openssl)
if [ $? -eq 0 ]; then
echo $res
exit 0
fi
fi
if [ -e "/usr/local/opt/openssl/lib/pkgconfig/openssl.pc" ]; then
# Homebrew
res=$(env PKG_CONFIG_PATH=/usr/local/opt/openssl/lib/pkgconfig pkg-config openssl)
if [ $? -eq 0 ]; then
echo $res
exit 0
fi
fi
# MacPorts
PKG_CONFIG_PATH=/opt/local/lib/pkgconfig pkg-config openssl

30
esy.lock/opam/conf-openssl.1/opam

@ -0,0 +1,30 @@ @@ -0,0 +1,30 @@
opam-version: "2.0"
maintainer: "David Sheets <sheets@alum.mit.edu>"
authors: ["The OpenSSL Project"]
bug-reports: "https://github.com/ocaml/opam-repository/issues"
homepage: "https://www.openssl.org/"
license: "Apache-1.0"
build: [
["pkg-config" "openssl"]
{os != "macos" & os != "freebsd" & os != "openbsd" & os != "netbsd"}
["./osx-build.sh"] {os = "macos"}
]
depends: ["conf-pkg-config" {build}]
depexts: [
["libssl-dev"] {os-distribution = "debian"}
["libssl-dev"] {os-distribution = "ubuntu"}
["openssl-devel"] {os-distribution = "centos"}
["openssl-devel"] {os-distribution = "oraclelinux"}
["openssl-devel"] {os-distribution = "fedora"}
["openssl"] {os = "macos" & os-distribution = "homebrew"}
["openssl"] {os = "macos" & os-distribution = "macports"}
["libressl-dev"] {os-distribution = "alpine"}
["openssl"] {os-distribution = "nixos"}
["openssl"] {os-distribution = "archlinux"}
["libopenssl-devel"] {os-family = "suse"}
]
synopsis: "Virtual package relying on an OpenSSL system installation"
description:
"This package can only install if OpenSSL is installed on the system."
extra-files: ["osx-build.sh" "md5=978504ca8c262cde48a71da6f11f2073"]
flags: conf

38
esy.lock/opam/conf-pkg-config.1.1/opam

@ -0,0 +1,38 @@ @@ -0,0 +1,38 @@
opam-version: "2.0"
maintainer: "unixjunkie@sdf.org"
authors: ["Francois Berenger"]
homepage: "http://www.freedesktop.org/wiki/Software/pkg-config/"
bug-reports: "https://github.com/ocaml/opam-repository/issues"
license: "GPL"
build: [
["pkg-config" "--help"]
]
install: [
["ln" "-s" "/usr/local/bin/pkgconf" "%{bin}%/pkg-config"] {os = "openbsd"}
]
remove: [
["rm" "-f" "%{bin}%/pkg-config"] {os = "openbsd"}
]
post-messages: [
"conf-pkg-config: A symlink to /usr/local/bin/pkgconf has been installed in the OPAM bin directory (%{bin}%) on your PATH as 'pkg-config'. This is necessary for correct operation." {os = "openbsd"}
]
depexts: [
["pkg-config"] {os-distribution = "debian"}
["pkg-config"] {os-distribution = "ubuntu"}
["pkg-config"] {os-distribution = "archlinux"}
["pkgconfig"] {os-distribution = "fedora"}
["pkgconfig"] {os-distribution = "centos"}
["pkgconfig"] {os-distribution = "mageia"}
["pkgconfig"] {os-distribution = "rhel"}
["pkgconfig"] {os-distribution = "oraclelinux"}
["pkgconfig"] {os-distribution = "alpine"}
["devel/pkgconf"] {os = "freebsd"}
["devel/pkgconf"] {os = "openbsd"}
["pkg-config"] {os = "macos" & os-distribution = "homebrew"}
["pkgconf"] {os = "freebsd"}
]
synopsis: "Virtual package relying on pkg-config installation"
description: """
This package can only install if the pkg-config package is installed
on the system."""
flags: conf

43
esy.lock/opam/fmt.0.8.5/opam

@ -0,0 +1,43 @@ @@ -0,0 +1,43 @@
opam-version: "2.0"
maintainer: "Daniel Bünzli <daniel.buenzl i@erratique.ch>"
authors: [
"Daniel Bünzli <daniel.buenzl i@erratique.ch>"
"Gabriel Radanne"
]
homepage: "http://erratique.ch/software/fmt"
doc: "http://erratique.ch/software/fmt"
dev-repo: "git+http://erratique.ch/repos/fmt.git"
bug-reports: "https://github.com/dbuenzli/fmt/issues"
tags: [ "string" "format" "pretty-print" "org:erratique" ]
license: "ISC"
depends: [
"ocaml" {>= "4.01.0"}
"ocamlfind" {build}
"ocamlbuild" {build}
"topkg" {build & >= "0.9.0"}
"result"
"uchar"
]
depopts: [ "base-unix" "cmdliner" ]
conflicts: [ "cmdliner" {< "0.9.8"} ]
build: [[
"ocaml" "pkg/pkg.ml" "build"
"--dev-pkg" "%{pinned}%"
"--with-base-unix" "%{base-unix:installed}%"
"--with-cmdliner" "%{cmdliner:installed}%" ]]
synopsis: "OCaml Format pretty-printer combinators"
description: """
Fmt exposes combinators to devise `Format` pretty-printing functions.
Fmt depends only on the OCaml standard library. The optional `Fmt_tty`
library that allows to setup formatters for terminal color output
depends on the Unix library. The optional `Fmt_cli` library that
provides command line support for Fmt depends on [`Cmdliner`][cmdliner].
Fmt is distributed under the ISC license.
[cmdliner]: http://erratique.ch/software/cmdliner"""
url {
src: "http://erratique.ch/software/fmt/releases/fmt-0.8.5.tbz"
checksum: "md5=77b64aa6f20f09de28f2405d6195f12c"
}

47
esy.lock/opam/ipaddr.3.0.0/opam

@ -0,0 +1,47 @@ @@ -0,0 +1,47 @@
opam-version: "2.0"
maintainer: "anil@recoil.org"
authors: ["David Sheets" "Anil Madhavapeddy" "Hugo Heuzard"]
synopsis: "A library for manipulation of IP (and MAC) address representations"
description: """
Features:
* Depends only on sexplib (conditionalization under consideration)
* oUnit-based tests
* IPv4 and IPv6 support
* IPv4 and IPv6 CIDR prefix support
* IPv4 and IPv6 [CIDR-scoped address](http://tools.ietf.org/html/rfc4291#section-2.3) support
* `Ipaddr.V4` and `Ipaddr.V4.Prefix` modules are `Map.OrderedType`
* `Ipaddr.V6` and `Ipaddr.V6.Prefix` modules are `Map.OrderedType`
* `Ipaddr` and `Ipaddr.Prefix` modules are `Map.OrderedType`
* `Ipaddr_unix` in findlib subpackage `ipaddr.unix` provides compatibility with the standard library `Unix` module
* `Ipaddr_top` in findlib subpackage `ipaddr.top` provides top-level pretty printers (requires compiler-libs default since OCaml 4.0)
* IP address scope classification
* IPv4-mapped addresses in IPv6 (::ffff:0:0/96) are an embedding of IPv4
* MAC-48 (Ethernet) address support
* `Macaddr` is a `Map.OrderedType`
* All types have sexplib serializers/deserializers
"""
license: "ISC"
tags: ["org:mirage" "org:xapi-project"]
homepage: "https://github.com/mirage/ocaml-ipaddr"
doc: "https://mirage.github.io/ocaml-ipaddr/"
bug-reports: "https://github.com/mirage/ocaml-ipaddr/issues"
depends: [
"ocaml" {>= "4.04.0"}
"dune" {build}
"macaddr"
"sexplib0" {< "v0.12"}
"ounit" {with-test}
"ppx_sexp_conv" {with-test & < "v0.12"}
]
build: [
["dune" "subst"] {pinned}
["dune" "build" "-p" name "-j" jobs]
["dune" "runtest" "-p" name "-j" jobs] {with-test}
]
dev-repo: "git+https://github.com/mirage/ocaml-ipaddr.git"
url {
src:
"https://github.com/mirage/ocaml-ipaddr/releases/download/3.0.0/ipaddr-3.0.0.tbz"
checksum: "md5=29248b09ead9ac272cd0f4c8ae934082"
}

37
esy.lock/opam/jsonm.1.0.1/opam

@ -0,0 +1,37 @@ @@ -0,0 +1,37 @@
opam-version: "2.0"
maintainer: "Daniel Bünzli <daniel.buenzl i@erratique.ch>"
authors: ["Daniel Bünzli <daniel.buenzl i@erratique.ch>"]
homepage: "http://erratique.ch/software/jsonm"
doc: "http://erratique.ch/software/jsonm/doc/Jsonm"
dev-repo: "git+http://erratique.ch/repos/jsonm.git"
bug-reports: "https://github.com/dbuenzli/jsonm/issues"
tags: [ "json" "codec" "org:erratique" ]
license: "ISC"
depends: [
"ocaml" {>= "4.01.0"}
"ocamlfind" {build}
"ocamlbuild" {build}
"topkg" {build}
"uchar"
"uutf" {>= "1.0.0"}
]
build:[[
"ocaml" "pkg/pkg.ml" "build"
"--pinned" "%{pinned}%" ]]
synopsis: "Non-blocking streaming JSON codec for OCaml"
description: """
Jsonm is a non-blocking streaming codec to decode and encode the JSON
data format. It can process JSON text without blocking on IO and
without a complete in-memory representation of the data.
The alternative "uncut" codec also processes whitespace and
(non-standard) JSON with JavaScript comments.
Jsonm is made of a single module and depends on [Uutf][uutf]. It is distributed
under the ISC license.
[uutf]: http://erratique.ch/software/uutf"""
url {
src: "http://erratique.ch/software/jsonm/releases/jsonm-1.0.1.tbz"
checksum: "md5=e2ca39eaefd55b8d155c4f1ec5885311"
}

57
esy.lock/opam/logs.0.6.2/opam

@ -0,0 +1,57 @@ @@ -0,0 +1,57 @@
opam-version: "2.0"
maintainer: "Daniel Bünzli <daniel.buenzl i@erratique.ch>"
authors: ["Daniel Bünzli <daniel.buenzl i@erratique.ch>"]
homepage: "http://erratique.ch/software/logs"
doc: "http://erratique.ch/software/logs/doc"
dev-repo: "git+http://erratique.ch/repos/logs.git"
bug-reports: "https://github.com/dbuenzli/logs/issues"
tags: [ "log" "system" "org:erratique" ]
license: "ISC"
depends: [
"ocaml" {>= "4.01.0"}
"ocamlfind" {build}
"ocamlbuild" {build}
"topkg" {build}
"result"
"mtime" {with-test}
]
depopts: [
"js_of_ocaml"
"fmt"
"cmdliner"
"lwt" ]
conflicts: [ "cmdliner" {< "0.9.8"} ]
build: [[
"ocaml" "pkg/pkg.ml" "build"
"--pinned" "%{pinned}%"
"--with-js_of_ocaml" "%{js_of_ocaml:installed}%"
"--with-fmt" "%{fmt:installed}%"
"--with-cmdliner" "%{cmdliner:installed}%"
"--with-lwt" "%{lwt:installed}%" ]]
synopsis: "Logging infrastructure for OCaml"
description: """
Logs provides a logging infrastructure for OCaml. Logging is performed
on sources whose reporting level can be set independently. Log message
report is decoupled from logging and is handled by a reporter.
A few optional log reporters are distributed with the base library and
the API easily allows to implement your own.
`Logs` depends only on the `result` compatibility package. The
optional `Logs_fmt` reporter on OCaml formatters depends on [Fmt][fmt].
The optional `Logs_browser` reporter that reports to the web browser
console depends on [js_of_ocaml][jsoo]. The optional `Logs_cli` library
that provides command line support for controlling Logs depends on
[`Cmdliner`][cmdliner]. The optional `Logs_lwt` library that provides Lwt logging
functions depends on [`Lwt`][lwt]
Logs and its reporters are distributed under the ISC license.
[fmt]: http://erratique.ch/software/fmt
[jsoo]: http://ocsigen.org/js_of_ocaml/
[cmdliner]: http://erratique.ch/software/cmdliner
[lwt]: http://ocsigen.org/lwt/"""
url {
src: "http://erratique.ch/software/logs/releases/logs-0.6.2.tbz"
checksum: "md5=19f824c02c83c6dddc3bfb6459e4743e"
}

28
esy.lock/opam/lwt_ssl.1.1.2/opam

@ -0,0 +1,28 @@ @@ -0,0 +1,28 @@
opam-version: "2.0"
version: "1.1.2"
homepage: "https://github.com/aantron/lwt_ssl"
doc: "https://github.com/aantron/lwt_ssl/blob/master/src/lwt_ssl.mli"
bug-reports: "https://github.com/aantron/lwt_ssl/issues"
license: "LGPL with OpenSSL linking exception"
authors: [
"Jérôme Vouillon"
"Jérémie Dimino"
]
maintainer: "Anton Bachin <antonbachin@yahoo.com>"
dev-repo: "git+https://github.com/aantron/lwt_ssl.git"
depends: [
"ocaml"
"base-unix"
"jbuilder" {build & >= "1.0+beta10"}
"lwt" {>= "3.0.0"}
"ssl" {>= "0.5.0"}
]
build: [
["jbuilder" "build" "-p" name "-j" jobs]
]
synopsis: "OpenSSL binding with concurrent I/O"
url {
src: "https://github.com/aantron/lwt_ssl/archive/1.1.2.tar.gz"
checksum: "md5=d239353b1e7c6e3fd4192c71a3b25ce2"
}

38
esy.lock/opam/macaddr.3.0.0/opam

@ -0,0 +1,38 @@ @@ -0,0 +1,38 @@
opam-version: "2.0"
maintainer: "anil@recoil.org"
authors: ["David Sheets" "Anil Madhavapeddy" "Hugo Heuzard"]
synopsis: "A library for manipulation of MAC address representations"
description: """
Manipulate 48-bit Ethernet MAC addresses using this library.
There are the following ocamlfind libraries included as part of this
package:
- `macaddr`: The `Macaddr` module for MAC address manipulation.
- `macaddr.top`: Toplevel printers for Macaddr.
- `macaddr.sexp`: S-expression converters for Macaddr.
"""
license: "ISC"
tags: ["org:mirage" "org:xapi-project"]
homepage: "https://github.com/mirage/ocaml-ipaddr"
doc: "https://mirage.github.io/ocaml-ipaddr/"
bug-reports: "https://github.com/mirage/ocaml-ipaddr/issues"
depends: [
"ocaml" {>= "4.04.0"}
"dune" {build}
"sexplib0" {< "v0.12"}
"ounit" {with-test}
"ppx_sexp_conv" {with-test & < "v0.12"}
]
conflicts: [ "ipaddr" {< "3.0.0"} ]
build: [
["dune" "subst"] {pinned}
["dune" "build" "-p" name "-j" jobs]
]
dev-repo: "git+https://github.com/mirage/ocaml-ipaddr.git"
url {
src:
"https://github.com/mirage/ocaml-ipaddr/releases/download/3.0.0/ipaddr-3.0.0.tbz"
checksum: "md5=29248b09ead9ac272cd0f4c8ae934082"
}

38
esy.lock/opam/magic-mime.1.1.1/opam

@ -0,0 +1,38 @@ @@ -0,0 +1,38 @@
opam-version: "2.0"
name: "magic-mime"
synopsis: "Map filenames to common MIME types"
description: """
This library contains a database of MIME types that maps filename extensions
into MIME types suitable for use in many Internet protocols such as HTTP or
e-mail. It is generated from the `mime.types` file found in Unix systems, but
has no dependency on a filesystem since it includes the contents of the
database as an ML datastructure.
For example, here's how to lookup MIME types in the [utop] REPL:
#require "magic-mime";;
Magic_mime.lookup "/foo/bar.txt";;
- : bytes = "text/plain"
Magic_mime.lookup "bar.css";;
- : bytes = "text/css"
"""
maintainer: "Anil Madhavapeddy <anil@recoil.org>"
authors: ["Anil Madhavapeddy" "Maxence Guesdon"]
license: "ISC"
homepage: "https://github.com/mirage/ocaml-magic-mime"
doc: "https://mirage.github.io/ocaml-magic-mime/"
bug-reports: "https://github.com/mirage/ocaml-magic-mime/issues"
dev-repo: "git+https://github.com/mirage/ocaml-magic-mime.git"
depends: [
"ocaml" {>= "4.03.0"}
"dune" {build}
]
build: [
["dune" "subst"] {pinned}
["dune" "build" "-p" name "-j" jobs]
]
url {
src:
"https://github.com/mirage/ocaml-magic-mime/releases/download/v1.1.1/magic-mime-v1.1.1.tbz"
checksum: "md5=8430a2686206517f2753e47c9c038b5c"
}

24
esy.lock/opam/ssl.0.5.7/opam

@ -0,0 +1,24 @@ @@ -0,0 +1,24 @@
opam-version: "2.0"
maintainer: "Christopher Zimmermann <christopher@gmerlin.de>"
homepage: "https://github.com/savonet/ocaml-ssl"
dev-repo: "git+https://github.com/savonet/ocaml-ssl.git"
bug-reports: "https://github.com/savonet/ocaml-ssl/issues"
build: [
["dune" "subst"] {pinned}
["dune" "build" "-p" name "-j" jobs]
]
depends: [
"ocaml" {>= "4.02.0"}
"dune" {build & >= "1.2.1"}
"base-unix"
"conf-openssl"
]
synopsis: "Bindings for OpenSSL"
authors: "Samuel Mimram <samuel.mimram@ens-lyon.org>"
url {
src: "https://github.com/savonet/ocaml-ssl/archive/0.5.7.tar.gz"
checksum: [
"md5=47ce60f1a019ddb9c66c4f1c8b9ed862"
"sha512=b412cbdcd92ee3ba227161d804d20b32c8cbda2e4eb0c195adb5d47b56b25e3ce8c831b9f4fae1c76d21b61df1b151745c9477cb850851f712ebb01146c69e7a"
]
}

27
esy.lock/opam/stringext.1.5.0/opam

@ -0,0 +1,27 @@ @@ -0,0 +1,27 @@
opam-version: "2.0"
maintainer: "rudi.grinberg@gmail.com"
authors: "Rudi Grinberg"
homepage: "https://github.com/rgrinberg/stringext"
bug-reports: "https://github.com/rgrinberg/stringext/issues"
license: "MIT"
dev-repo: "git+https://github.com/rgrinberg/stringext.git"
build: [
["jbuilder" "subst" "-p" name] {pinned}
["jbuilder" "build" "-p" name "-j" jobs]
["jbuilder" "runtest" "-p" name "-j" jobs] {with-test}
]
depends: [
"ocaml" {>= "4.02.3"}
"jbuilder" {build & >= "1.0+beta10"}
"ounit" {with-test}
"qtest" {with-test & >= "2.2"}
"base-bytes"
]
synopsis: "Extra string functions for OCaml"
description: """
Extra string functions for OCaml. Mainly splitting. All functions are in the
`Stringext` module."""
url {
src: "https://github.com/rgrinberg/stringext/archive/1.5.0.zip"
checksum: "md5=867263ea97532f150516677fa994cdf2"
}

33
esy.lock/opam/uri.2.2.0/opam

@ -0,0 +1,33 @@ @@ -0,0 +1,33 @@
opam-version: "2.0"
maintainer: "anil@recoil.org"
authors: ["Anil Madhavapeddy" "David Sheets" "Rudi Grinberg"]
license: "ISC"
tags: ["url" "uri" "org:mirage" "org:xapi-project"]
homepage: "https://github.com/mirage/ocaml-uri"
bug-reports: "https://github.com/mirage/ocaml-uri/issues"
dev-repo: "git+https://github.com/mirage/ocaml-uri.git"
doc: "https://mirage.github.io/ocaml-uri/"
synopsis: "An RFC3986 URI/URL parsing library"
description: """
This is an OCaml implementation of the [RFC3986](http://tools.ietf.org/html/rfc3986) specification
for parsing URI or URLs.
"""
depends: [
"ocaml" {>= "4.04.0"}
"dune" {build & >= "1.2.0"}
"ounit" {with-test & >= "1.0.2"}
"ppx_sexp_conv" {build & >= "v0.9.0" & < "v0.12"}
"re" {>= "1.7.2"}
"sexplib0" {< "v0.12"}
"stringext" {>= "1.4.0"}
]
build: [
["dune" "subst"] {pinned}
["dune" "build" "-p" name "-j" jobs]
["dune" "runtest" "-p" name "-j" jobs] {with-test}
]
url {
src:
"https://github.com/mirage/ocaml-uri/releases/download/v2.2.0/uri-v2.2.0.tbz"
checksum: "md5=e52e17fc6cc3491ab44994e6ebc5664c"
}

5
esy.lock/overrides/opam__s__conf_pkg_config_opam__c__1.1_opam_override/package.json

@ -0,0 +1,5 @@ @@ -0,0 +1,5 @@
{
"dependencies": {
"yarn-pkg-config": "esy-ocaml/yarn-pkg-config#d488cd9321cd5036bd36ec96744ce78c5d45fc49"
}
}

2
executable/dune

@ -7,6 +7,6 @@ @@ -7,6 +7,6 @@
(name FnmApp) ; From package.json main field
; The name of the executable (runnable via esy x fnm.exe)
(public_name fnm.exe) ; From package.json name field
(libraries core cmdliner lwt lwt.unix lambdasoup console.lib pastel.lib fnm.lib ) ; From package.json require field (array of strings)
(libraries core cmdliner lwt lambdasoup console.lib pastel.lib fnm.lib ) ; From package.json require field (array of strings)
(preprocess ( pps lwt_ppx ppx_let )) ; From package.json preprocess field
)

69
library/Http.re

@ -1,3 +1,8 @@ @@ -1,3 +1,8 @@
open Lwt;
open Cohttp;
open Cohttp_lwt;
open Cohttp_lwt_unix;
type response = {
body: string,
status: int,
@ -6,57 +11,29 @@ type response = { @@ -6,57 +11,29 @@ type response = {
let body = response => response.body;
let status = response => response.status;
let rec getBody = listOfStrings =>
switch (listOfStrings) {
| [] => ""
| ["", ...rest] => String.concat("\n", rest)
| [_, ...xs] => getBody(xs)
};
let getStatus = string =>
List.nth(String.split_on_char(' ', string), 1) |> int_of_string;
exception Unknown_status_code(int, response);
exception Not_found(response);
exception Internal_server_error(response);
let verifyStatus = response =>
switch (response.status) {
| 200 => Lwt.return(response)
| x when x / 100 == 4 => Lwt.fail(Not_found(response))
| x when x / 100 == 5 => Lwt.fail(Internal_server_error(response))
| x => Lwt.fail(Unknown_status_code(response.status, response))
};
let rec skipRedirects = (~skipping=false, lines) =>
switch (skipping, lines) {
| (_, []) => failwith("Response is empty")
| (true, ["", ...xs]) => skipRedirects(~skipping=false, xs)
| (true, [x, ...xs]) => skipRedirects(~skipping=true, xs)
| (false, [x, ...xs])
when Str.first_chars(x, 4) == "HTTP" && getStatus(x) / 100 == 3 =>
skipRedirects(~skipping=true, xs)
| (false, xs) => xs
};
let parseResponse = lines => {
let linesAfterRedirect = skipRedirects(lines);
let body = getBody(linesAfterRedirect);
let status = getStatus(linesAfterRedirect |> List.hd);
{body, status};
};
let makeRequest = url => {
let%lwt response =
System.unix_exec("curl", ~args=[|url, "-D", "-", "--silent"|]);
response |> parseResponse |> verifyStatus;
let rec makeRequest = url =>
Uri.of_string(url)
|> Cohttp_lwt_unix.Client.get
>>= (
((resp, body)) => {
let status = resp |> Response.status;
let code_of_status = status |> Code.code_of_status;
let location = resp |> Response.headers |> Header.get_location;
switch (Code.is_redirection(code_of_status), location) {
| (true, Some(uri)) => makeRequest(Uri.to_string(uri))
| _ =>
let%lwt body = body |> Cohttp_lwt.Body.to_string;
Lwt.return({status: code_of_status, body});
};
}
);
let download = (url, ~into) => {
let%lwt response =
System.unix_exec(
"curl",
~args=[|url, "-L", "-D", "-", "--silent", "-o", into|],
);
response |> parseResponse |> verifyStatus;
let%lwt _ = makeRequest(url) >>= (({body}) => Fs.writeFile(into, body));
Lwt.return();
};

2
library/dune

@ -7,6 +7,6 @@ @@ -7,6 +7,6 @@
(name Fnm)
; Other libraries list this name in their package.json 'require' field to use this library.
(public_name fnm.lib)
(libraries str core lwt lwt.unix lambdasoup semver )
(libraries str core lwt ssl lwt_ssl lambdasoup semver cohttp cohttp-lwt cohttp-lwt-unix )
(preprocess ( pps lwt_ppx ppx_let )) ; From package.json preprocess field
)

14
package.json

@ -34,9 +34,13 @@ @@ -34,9 +34,13 @@
"str",
"core",
"lwt",
"lwt.unix",
"ssl",
"lwt_ssl",
"lambdasoup",
"semver"
"semver",
"cohttp",
"cohttp-lwt",
"cohttp-lwt-unix"
],
"name": "fnm.lib",
"namespace": "Fnm"
@ -51,7 +55,6 @@ @@ -51,7 +55,6 @@
"core",
"cmdliner",
"lwt",
"lwt.unix",
"lambdasoup",
"console.lib",
"pastel.lib",
@ -79,6 +82,11 @@ @@ -79,6 +82,11 @@
"@opam/lwt": "*",
"@opam/lwt_ppx": "*",
"@opam/ppx_let": "*",
"@opam/cohttp": "*",
"@opam/cohttp-lwt": "*",
"@opam/cohttp-lwt-unix": "*",
"@opam/ssl": "*",
"@opam/lwt_ssl": "*",
"@reason-native/console": "*",
"@reason-native/pastel": "~0.2.0",
"@reason-native/rely": "~1.2.0",

Loading…
Cancel
Save