-
Notifications
You must be signed in to change notification settings - Fork 67
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Middleware.static: etag_of_fname should return Lwt.t ?! #265
Comments
Hi @pkel!
Sure, that makes sense, I'd be happy to merge such a PR
Could you clarify what you have in mind? I'm not sure what the spec has to say about it, but I've only seen Etag generated from content hashes. |
I'd go for "a hash of the last modification timestamp" mentioned here: I think this should be enough for static files served from a UNIX file system. |
We could provide this as an option, something like |
What about keeping the optional |
This commit changes the static middlewares' ETag argument from `?etag_of_fname:(string -> string option)` to `?etag_of_fname:(string -> string option Lwt.t)`. This change was proposed in rgrinberg#265.
* Get ETag as LWT promise This commit changes the static middlewares' ETag argument from `?etag_of_fname:(string -> string option)` to `?etag_of_fname:(string -> string option Lwt.t)`. This change was proposed in #265. * Generate ETag from UNIX file system * Update CHANGES.md * ocamlformat my changes
* Get ETag as LWT promise This commit changes the static middlewares' ETag argument from `?etag_of_fname:(string -> string option)` to `?etag_of_fname:(string -> string option Lwt.t)`. This change was proposed in #265. * Generate ETag from UNIX file system * Update CHANGES.md * ocamlformat my changes
Hi and thanks for your efforts on this project. Opium is really useful to get a web app running quickly.
I tried to enable caching for static files served with the
static
andstatic_unix
middlewares. I have two use cases:static
: check last modification of file in Irmin/Git store, use commit hash as etag.static_unix
: derive etag fromLwt_unix.stat st_mtime
or similar.Unfortunately, the
etag_of_fname
argument is of typestring -> string option
. I'd preferstring -> string option Lwt.t
. Are you interested in a PR changing the type? I could also extend thestatic_unix
middleware such that it defaults to mtime-based etags.The text was updated successfully, but these errors were encountered: