package cohttp

  1. Overview
  2. Docs
An OCaml library for HTTP clients and servers

Install

dune-project
 Dependency

Authors

Maintainers

Sources

cohttp-6.3.0.tbz
sha256=31130f68a9f0a5cd8d71b55f042456e6d35bf8b7ab6a71ab6d7bd7dbdb607b24
sha512=1b14571b8aef12ae51f94eb7e94a8fc6e26b64dffedd86f8f9c237479b980395a2424ca7a9ce3dc285608bce770170688e86b4ba6da82370ca5fe7a9649cd19f

doc/cohttp/Cohttp/Path/index.html

Module Cohttp.PathSource

Sourceval resolve_local_file : docroot:string -> uri:Uri.t -> string

Resolve the given URI to a local file in the given docroot.

This is Filename.concat docroot (normalise uri). It decodes percent-encoding once and removes .. segments so that the request cannot escape the docroot. The returned filepath is fully qualified iff the given docroot is fully qualified.

Sourceval normalise : Uri.t -> string

normalise uri returns the path of uri with percent-encoding decoded exactly once and ./.. segments resolved, as a relative path that can never ascend above its root.

Use this to derive a lookup key from a request URI, for example a filesystem path or a key-value store key.