Open eproxus opened 7 years ago
Thanks for the report. Do you notice this behaviour in develop
too? I'm not sure if they're different, but in general, the develop
branches of elli-lib repos have the most recent code. I'd gladly review a PR here or on elli-lib/elli if you have the time and interest.
Switching to the develop
branch on both this middleware and on Elli itself makes no difference, unfortunately 😟
Digging a bit deeper, it turns out that Elli sets the Content-Length header itself: https://github.com/elli-lib/elli/blob/develop/src/elli_http.erl#L187
So I guess the bug is that this middleware even deals with this stuff at all. Elli seems to read all info it needs from the file again, so doing it in this middleware seems redundant.
One idea: since this middleware has licensing issues (#9), perhaps a rewrite is in order? I could see if creating a new elli_static
from scratch would be a lot of work and if not, we could add it to the elli-lib
organisation?
:+1: to that. I'll set up a skeleton repo and add you. It'll mostly likely be tomorrow. If I forget, feel free to ping me.
I'd like to polish and incorporate elli_cache
in elli_static
as well.
@yurrriq Incorporating cache sounds good. So we should depend on that middleware as well? Because I can see that the elli_cache
middleware is useful on its own (if you talk to a database instead of files for example, or if you have large binaries in memory with known hashes).
I have a simple version of elli_static
working, but I'm debating the API at the moment. Not a big fan of the path
, prefix
and {regex, ...}
redundancy. I'm wondering if it can be solved in a simpler way (somewhat similar to how the Cowboy static file serving works)... once you have created the repo we could start the discussion there and I'll add some examples.
Right, the idea behind elli_cache
is to be generic.
I get double Content-Length headers when using the
master
branch. E.g.:Tracing shows this result:
If I debug using the
request_complete
event as follows:I get the following output:
Here I only see the headers set by
elli_fileserve
but somewhere aContent-Length: 0
header is added (and the response transformed to a 206 Partial Content as well.This is the configuration and supervisor:
Not sure if this is a bug in
elli_fileserve
or Elli itself.