diff --git a/README.md b/README.md index d82dc289..94eac291 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ -# SimpleHTTPServer [![build status](https://travis-ci.org/c-cube/simplehttpserver.svg?branch=master)](https://travis-ci.org/c-cube/simplehttpserver) +# Tiny_httpd [![build status](https://travis-ci.org/c-cube/tiny_httpd.svg?branch=master)](https://travis-ci.org/c-cube/tiny_httpd) Minimal HTTP server using good old threads and `Scanf` for routing. @@ -9,7 +9,7 @@ The basic echo server from `src/examples/echo.ml`: ```ocaml -module S = SimpleHTTPServer +module S = Tiny_httpd let () = let server = S.create () in @@ -46,6 +46,21 @@ echo: ``` +## `http_of_dir` + +Similar to `python -m http.server`, a simple program `http_of_dir` is provided. +It serves files from the current directory. + +```sh +$ http_of_dir . -p 8080 & +$ curl -X GET http://localhost:8080 +... +some html +... + +``` + + ## Why? Why not? If you just want a super basic local server (perhaps for exposing @@ -54,7 +69,7 @@ dependencies or high scalability libraries. ## Documentation -See https://c-cube.github.io/simplehttpserver/ +See https://c-cube.github.io/tiny_httpd ## License diff --git a/src/SimpleHTTPServer.ml b/src/Tiny_httpd.ml similarity index 100% rename from src/SimpleHTTPServer.ml rename to src/Tiny_httpd.ml diff --git a/src/SimpleHTTPServer.mli b/src/Tiny_httpd.mli similarity index 100% rename from src/SimpleHTTPServer.mli rename to src/Tiny_httpd.mli diff --git a/src/bin/dune b/src/bin/dune index 2a501f90..bdd06eb7 100644 --- a/src/bin/dune +++ b/src/bin/dune @@ -3,4 +3,4 @@ (name http_of_dir) (public_name http_of_dir) (flags :standard -warn-error -3) - (libraries simplehttpserver str)) + (libraries tiny_httpd str)) diff --git a/src/bin/http_of_dir.ml b/src/bin/http_of_dir.ml index 9e2ec3c8..93350e87 100644 --- a/src/bin/http_of_dir.ml +++ b/src/bin/http_of_dir.ml @@ -1,5 +1,5 @@ -module S = SimpleHTTPServer +module S = Tiny_httpd module Pf = Printf let contains_dot_dot s = diff --git a/src/dune b/src/dune index a80dee9f..d332719a 100644 --- a/src/dune +++ b/src/dune @@ -1,6 +1,6 @@ (library - (name simplehttpserver) - (public_name simplehttpserver) + (name tiny_httpd) + (public_name tiny_httpd) (libraries threads) (wrapped false)) diff --git a/src/examples/dune b/src/examples/dune index bdcdcd7a..b7cfcbf7 100644 --- a/src/examples/dune +++ b/src/examples/dune @@ -1,4 +1,4 @@ (executables (names echo) - (libraries simplehttpserver)) + (libraries tiny_httpd)) diff --git a/src/examples/echo.ml b/src/examples/echo.ml index 447f8f11..19211073 100644 --- a/src/examples/echo.ml +++ b/src/examples/echo.ml @@ -1,5 +1,5 @@ -module S = SimpleHTTPServer +module S = Tiny_httpd let debug_ k = if None<>Sys.getenv_opt "HTTP_DBG" then ( diff --git a/simplehttpserver.opam b/tiny_httpd.opam similarity index 63% rename from simplehttpserver.opam rename to tiny_httpd.opam index 650c0538..f4115dfc 100644 --- a/simplehttpserver.opam +++ b/tiny_httpd.opam @@ -1,5 +1,4 @@ opam-version: "2.0" -name: "simplehttpserver" version: "0.1" authors: ["Simon Cruanes"] maintainer: "simon.cruanes.2007@m4x.org" @@ -17,7 +16,7 @@ depends: [ "odoc" {with-doc} ] tags: [ "http" "thread" "server" ] -homepage: "https://github.com/c-cube/simplehttpserver/" -doc: "https://c-cube.github.io/simplehttpserver/" -bug-reports: "https://github.com/c-cube/simplehttpserver/issues" -dev-repo: "git+https://github.com/c-cube/simplehttpserver.git" +homepage: "https://github.com/c-cube/tiny_httpd/" +doc: "https://c-cube.github.io/tiny_httpd/" +bug-reports: "https://github.com/c-cube/tiny_httpd/issues" +dev-repo: "git+https://github.com/c-cube/tiny_httpd.git"