Comments (8)
And this should be optional ?
from tiny_httpd.
This should definitely be outside of tiny-httpd, I think it just has to provide some core primitives (like number of active connections), and maybe some instrumentation.
if we get an optional wrap_query
parameter (maybe a begin_query: ip -> port -> 'a
and end_query: 'a -> unit
pair), then you can instrument however you want: prometheus, tracy, hand rolled sqlite-based analytics, etc. Mechanism, not policy
from tiny_httpd.
Of course a very basic statistics module can be provided alongside Tiny_httpd_utils
, like Tiny_httpd_stats
with exactly that kind of pair to pass to Tiny_httpd.create
.
from tiny_httpd.
I like the idea of a wrapper for connection, the wrapper could have access to both the request and the response though ?
For the default stats, I think something usefull ought to write in a Db from which it is easy to compute average and so on... And therefore hard to provide a default. Except if you have something specific in mind ?
from tiny_httpd.
from tiny_httpd.
We already have an internal handler type, which could probably be compatible with a middleware type handler -> handler
:
(* a request handler. handles a single request. *)
type cb_path_handler =
out_channel ->
byte_stream Request.t ->
resp:(Response.t -> unit) ->
unit
from tiny_httpd.
The middleware patch + example of stat in echo.ml solves this issue ?
from tiny_httpd.
yeah it's easy to done oneself. done.
from tiny_httpd.
Related Issues (20)
- allow user to setup info/debug/trace logs HOT 1
- basic "static file server" middleware HOT 1
- Problem with mime type of css and js files HOT 4
- Function `percent_decode` should not convert the `+` symbol HOT 2
- session and handling of body in post method HOT 7
- Unix.accept raising exception, not caught HOT 3
- test server sent events
- more serious testing HOT 4
- Better data structure for headers HOT 4
- Middleware and accept overlap a bit ? Need more freedom for composition ? HOT 2
- Stream do not close the file descriptor HOT 6
- Should use magic-mime (or mrmime) HOT 2
- Small file should not be chunked HOT 5
- missing code for trailer in chunked message HOT 3
- Accept-encoding and chunked response HOT 2
- handling of route HOT 11
- Firefox hang on 301 redirect with no body HOT 2
- examine problem with dune2
- allow path handlers to directly take a `byte_stream Request.t`
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tiny_httpd.