Kim Alvefur
2acba62388
net.http.server: Set request.ip so mod_http doesn't have to
...
Because it already sets request.secure, which depends on the connection,
just like the IP, so it makes sense to do both in the same place.
Dealing with proxies can be left to mod_http for now, but maybe it could
move into some util some day?
5 years ago
Kim Alvefur
f0ac919609
net.http.server: Don't pause early streaming uploads
...
Fixes that otherwise it would wait for the request to be done after
receiving the head of the request, when it's meant to select a target
for where to store the data, instead of waiting after receiving the
request for when the request has been handled.
5 years ago
Kim Alvefur
3c96f613c0
net.http.server: Allow storing more than the parser in the session
...
Storing the async thread on the connection was weird.
5 years ago
Kim Alvefur
f0202d38c2
net.http.server: Enable async during HTTP request handling ( fixes #1487 )
6 years ago
Matthew Wild
518904b66c
net.http.server: Don't send Content-Length on 1xx/204 responses, per RFC ( fixes #1596 )
5 years ago
Matthew Wild
9229c7a571
net.http.server: Default to HTTP result code 500 when promise is rejected
5 years ago
Kim Alvefur
540be50a3c
net.http.server: Fix reporting of missing Host header
...
The "Missing or invalid 'Host' header" case was dead code previously
because `host` was always at least an empty string.
6 years ago
Kim Alvefur
48c9a60d19
net.http.server: Strip port from Host header in IPv6 friendly way ( fix #1302 )
...
E.g. given `[::1]:5280` it would previously result in only `[` instead
of the correct `[::1]`
6 years ago
Kim Alvefur
4f2548e8ef
net.http.server: Use error code from util.error ( fixes #1502 )
...
Oversight in 955e54e451dc when this was added.
6 years ago
Kim Alvefur
87d0125802
util.error: Move default for numeric error code to net.http.server
...
Stanza errors can also have numbers but these are a legacy thing and
rarely used, except in MUC. HTTP errors on the other hand always have a
number.
6 years ago
Kim Alvefur
58990598f2
net.http.server: Treat promise rejection without value as a HTTP 500 error
6 years ago
Kim Alvefur
5cac177270
net.http.server: Handle promises from http handlers
6 years ago
Kim Alvefur
fdfe1e0b2b
net.http.server: Handle util.error objects from http handlers
6 years ago
Kim Alvefur
fbab8ed06a
net.http.server: Tail call because tail call!
6 years ago
Kim Alvefur
6a73014b9a
net.http.server: Factor out handling of event response for easier reuse
6 years ago
Kim Alvefur
30a72c72a3
net.http.server: Explicitly convert number to string, avoiding implicit coercion
6 years ago
Kim Alvefur
8e485ec320
net.http.server: Re-fire unhandled HEAD requsts as GET events ( fixes #1447 )
...
BC: This overloads the GET event.
Previous commit ensures HEAD requests are sent without a body.
6 years ago
Kim Alvefur
89a6f8d8c1
net.http.server: Ensure HEAD requests are sent with empty body
6 years ago
Matthew Wild
8ebaee9c3d
net.http.server: Move event formation to avoid traceback on missing Host header
7 years ago
Matthew Wild
f5f6460b2e
Many things: switch from hacky multi-arg xpcall implementations to a standard util.xpcall
7 years ago
Kim Alvefur
95eac7d4c6
net.http.server: Delay host checks until after host-less event
...
This allows handling events without any hosts enabled.
7 years ago
Kim Alvefur
91c5bd7853
net.http.server: Fire an event without host
7 years ago
Kim Alvefur
a31b6728d4
Revert 2dc7490899ae::5d6b252bc36f: Unfinished and broken
7 years ago
Kim Alvefur
83cd0e7ba7
net.http.server: Fix default host logic
...
This was used to construct the event name previously
7 years ago
Kim Alvefur
c6540b14f9
net.http.server: Move handling of hosts to mod_http
...
Now an event like `GET /path` is fired at first, and mod\_http
dispatches the old `GET host/path` events.
7 years ago
Kim Alvefur
843edf3cb1
net.http.server: Include response object in most http-error events
8 years ago
Kim Alvefur
f30f5f6218
net.http.server: Add luacheck annotations
10 years ago
Kim Alvefur
47fe58f5ca
net.http.server: Expose way to set http server options
10 years ago
Kim Alvefur
3506b08847
net.http.server: Set blocksize for serving data from FDs to 64k (sweet spot of efficiency according to a recent study)
10 years ago
Kim Alvefur
99ba4462fc
net.http.server: Add response method for reading response body from a file handle
10 years ago
Kim Alvefur
83e7c91e01
net.http.server: Return from listen_on() whatever net.server.addserver() returns
10 years ago
Matthew Wild
6d8484bb7b
net.http.server: Import util.cache
10 years ago
Matthew Wild
12f9aac248
net.http.server: Use new util.cache to remember wildcard event handlers
10 years ago
Matthew Wild
5c1d94de1b
net.http.server: Log event name when firing a request event
11 years ago
Kim Alvefur
4781a82cd8
net.http.server: Log names of the events fired
11 years ago
Matthew Wild
899b6d53ae
net.http, net.http.server, mod_c2s, mod_s2s, mod_component, mod_admin_telnet, mod_net_multiplex: Add ondetach to release connection from 'sessions' table (or equivalent)
12 years ago
Kim Alvefur
13844f7635
net.http.server: Comment out a log message
12 years ago
Daurnimator
0f866905fd
net.http.server: Fix some typos introduced in 420c0d3b8583.
12 years ago
Daurnimator
75c7b9704a
net.http.server: Add prepare_header() and finish_response() to allow sending chunked responses via the API
12 years ago
Florian Zeitz
1d833bb807
Remove all trailing whitespace
13 years ago
Kim Alvefur
74b83382ab
net.http.server: Fix Keep-Alive requests with HTTP 1.0
13 years ago
Matthew Wild
c178786878
mod_c2s, mod_s2s, net.http, net.http.server: Improve tracebacks (omit traceback function), to make it clearer where an error occured
13 years ago
Matthew Wild
4602591c38
mod_c2s, mod_s2s, net.http, net.http.server: Improve tracebacks (omit traceback function), to make it clearer where an error occured
13 years ago
Matthew Wild
842b340ebe
net.server.http: Add a comment
13 years ago
Matthew Wild
c981dcb50d
net.server.http: Add a comment
13 years ago
Matthew Wild
61f88df542
net.server.http: Ensure that event map cannot grow forever (limit to 10K wildcard-only entries)
13 years ago
Matthew Wild
a2fd9431f4
net.server.http: Ensure that event map cannot grow forever (limit to 10K wildcard-only entries)
13 years ago
Waqas Hussain
76d4f07d2b
net.http.server: The correct Connection header value to look for is Keep-Alive, not keep-alive.
13 years ago
Marco Cirillo
d6c4bffd9b
net.http.server: add API to allow firing events directly on the server.
13 years ago
Matthew Wild
3c45ca81a2
net.http.server: Don't overwrite existing response.headers when returning a response object from a HTTP handler (waqas says it's wrong)
13 years ago