aboutsummaryrefslogtreecommitdiffstats
path: root/net/http/server.lua
Commit message (Collapse)AuthorAgeFilesLines
* net.http.server: Add new API to get HTTP request from a connectionMatthew Wild2023-02-161-0/+4
| | | | | | | | | | | This information is sometimes necessary in the context where we have a connection that we know (or believe to be) associated with an incoming HTTP request. For example, it can be used to retrieve the IP address of a request (which may differ from the IP address of the connection, due to X-Forwarded-For and co). Thanks to the Jitsi team for highlighting this gap in the API.
* net.http.server: Fix #1789Kim Alvefur2023-01-081-1/+1
| | | | | | | | | Unregistering the response before sending the trailer of the chunked transfer encoding prevents opportunistic writes from being invoked and running this code again when, which may cause an error when closing the file handle a second time. Normally the file size is known, so no chuck headers are sent.
* net.http.server: Split out method for sending only the headerKim Alvefur2021-04-241-2/+7
| | | | | Makes it easier to reuse, e.g. for SSE or websockets or other custom responses.
* net.http.server: Set request.ip so mod_http doesn't have toKim Alvefur2021-02-271-0/+2
| | | | | | | | 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?
* net.http.server: Don't pause early streaming uploadsKim Alvefur2021-02-131-1/+10
| | | | | | | 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.
* net.http.server: Allow storing more than the parser in the sessionKim Alvefur2021-02-121-10/+11
| | | | Storing the async thread on the connection was weird.
* net.http.server: Enable async during HTTP request handling (fixes #1487)Kim Alvefur2020-07-121-28/+23
|
* Merge 0.11->trunkMatthew Wild2020-10-131-1/+4
|\
| * net.http.server: Don't send Content-Length on 1xx/204 responses, per RFC ↵Matthew Wild2020-10-131-1/+4
| | | | | | | | (fixes #1596)
* | net.http.server: Default to HTTP result code 500 when promise is rejectedMatthew Wild2020-09-281-0/+1
| |
* | Merge 0.11->trunkKim Alvefur2020-06-231-1/+2
|\|
| * net.http.server: Fix reporting of missing Host headerKim Alvefur2020-06-231-1/+2
| | | | | | | | | | The "Missing or invalid 'Host' header" case was dead code previously because `host` was always at least an empty string.
| * net.http.server: Strip port from Host header in IPv6 friendly way (fix #1302)Kim Alvefur2020-06-231-1/+1
| | | | | | | | | | E.g. given `[::1]:5280` it would previously result in only `[` instead of the correct `[::1]`
* | net.http.server: Use error code from util.error (fixes #1502)Kim Alvefur2020-04-121-0/+1
| | | | | | | | Oversight in 955e54e451dc when this was added.
* | util.error: Move default for numeric error code to net.http.serverKim Alvefur2019-12-141-1/+1
| | | | | | | | | | | | 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.
* | net.http.server: Treat promise rejection without value as a HTTP 500 errorKim Alvefur2019-11-051-1/+1
| |
* | net.http.server: Handle promises from http handlersKim Alvefur2019-11-011-0/+8
| |
* | net.http.server: Handle util.error objects from http handlersKim Alvefur2019-11-011-0/+3
| |
* | net.http.server: Tail call because tail call!Kim Alvefur2019-11-011-1/+1
| |
* | net.http.server: Factor out handling of event response for easier reuseKim Alvefur2019-11-011-31/+34
| |
* | net.http.server: Explicitly convert number to string, avoiding implicit coercionKim Alvefur2019-10-121-1/+1
| |
* | net.http.server: Re-fire unhandled HEAD requsts as GET events (fixes #1447)Kim Alvefur2019-10-121-0/+11
| | | | | | | | | | | | BC: This overloads the GET event. Previous commit ensures HEAD requests are sent without a body.
* | net.http.server: Ensure HEAD requests are sent with empty bodyKim Alvefur2019-10-121-0/+16
|/
* net.http.server: Move event formation to avoid traceback on missing Host headerMatthew Wild2018-11-131-1/+1
|
* Many things: switch from hacky multi-arg xpcall implementations to a ↵Matthew Wild2018-10-261-6/+2
| | | | standard util.xpcall
* net.http.server: Delay host checks until after host-less eventKim Alvefur2018-09-231-9/+18
| | | | This allows handling events without any hosts enabled.
* net.http.server: Fire an event without hostKim Alvefur2018-09-211-3/+8
|
* Revert 2dc7490899ae::5d6b252bc36f: Unfinished and brokenKim Alvefur2018-09-211-2/+2
|
* net.http.server: Fix default host logicKim Alvefur2018-09-211-1/+1
| | | | This was used to construct the event name previously
* net.http.server: Move handling of hosts to mod_httpKim Alvefur2018-09-211-1/+1
| | | | | Now an event like `GET /path` is fired at first, and mod\_http dispatches the old `GET host/path` events.
* net.http.server: Include response object in most http-error eventsKim Alvefur2017-10-271-3/+5
|
* net.http.server: Add luacheck annotationsKim Alvefur2016-08-181-2/+2
|
* Merge 0.9->0.10Kim Alvefur2016-08-181-1/+8
|\
| * net.http.server: Expose way to set http server optionsKim Alvefur2016-08-181-1/+8
| |
* | net.http.server: Set blocksize for serving data from FDs to 64k (sweet spot ↵Kim Alvefur2016-08-081-1/+1
| | | | | | | | of efficiency according to a recent study)
* | net.http.server: Add response method for reading response body from a file ↵Kim Alvefur2016-07-111-0/+42
| | | | | | | | handle
* | net.http.server: Return from listen_on() whatever net.server.addserver() returnsKim Alvefur2016-01-161-1/+1
| |
* | net.http.server: Import util.cacheMatthew Wild2015-12-031-0/+1
| |
* | net.http.server: Use new util.cache to remember wildcard event handlersMatthew Wild2015-12-031-5/+5
| |
* | Merge 0.9->0.10 (third time lucky)Matthew Wild2015-03-271-1/+1
|\|
| * net.http.server: Log event name when firing a request eventMatthew Wild2015-03-141-1/+1
| |
* | net.http.server: Log names of the events firedKim Alvefur2014-12-081-1/+1
| |
* | Merge 0.9->0.10Kim Alvefur2014-09-021-0/+4
|\|
| * net.http, net.http.server, mod_c2s, mod_s2s, mod_component, ↵Matthew Wild2014-08-291-0/+4
| | | | | | | | mod_admin_telnet, mod_net_multiplex: Add ondetach to release connection from 'sessions' table (or equivalent)
* | Merge 0.9->0.10Matthew Wild2014-08-281-1/+1
|\|
| * net.http.server: Comment out a log messageKim Alvefur2014-08-271-1/+1
| |
* | net.http.server: Fix some typos introduced in 420c0d3b8583.Daurnimator2014-04-151-4/+3
| |
* | net.http.server: Add prepare_header() and finish_response() to allow sending ↵Daurnimator2014-04-151-9/+17
| | | | | | | | chunked responses via the API
* | Remove all trailing whitespaceFlorian Zeitz2013-08-091-2/+2
|/
* net.http.server: Fix Keep-Alive requests with HTTP 1.0Kim Alvefur2013-07-221-1/+1
|