Matthew Wild
b50d4b2ef0
net.http: Add support for streaming chunked/large responses
5 years ago
Matthew Wild
bc402b6409
net.http.parser: Expose 'partial', 'chunked' and 'body_length' on packets
5 years ago
Kim Alvefur
00bad1a9fe
net.websocket.frames: Use C string XOR implementation
5 years ago
Matthew Wild
518904b66c
net.http.server: Don't send Content-Length on 1xx/204 responses, per RFC ( fixes #1596 )
5 years ago
Kim Alvefur
fb63187afc
net.websocket.frames: Read buffer length correctly in Lua 5.1 ( fix #1598 )
...
COMPAT: The __len metamethod does not work with tables in Lua 5.1.
Both strings and util.dbuffer now expose their length as a :len()
method.
5 years ago
Matthew Wild
a0fb8d876f
net.websocket.frames: Additionally return partial frame if there is one
5 years ago
Matthew Wild
9229c7a571
net.http.server: Default to HTTP result code 500 when promise is rejected
5 years ago
Matthew Wild
5a1c206ece
mod_websocket: Switch partial frame buffering to util.dbuffer
...
This improves performance and enforces stanza size limits earlier
in the pipeline.
5 years ago
Matthew Wild
3989ff2ddc
net.websocket.frames: Allow all methods to work on non-string objects
...
Instead of using the string library, use methods from the passed object,
which are assumed to be equivalent.
This provides compatibility with objects from util.ringbuffer and
util.dbuffer, for example.
5 years ago
Matthew Wild
047f03ec09
net.http: Add feature discovery (currently just contains SNI)
5 years ago
Kim Alvefur
93d0d13fbb
net.server: Backport client parts of SNI support from trunk ( #409 )
...
Partial backports of the following commits from trunk:
6c804b6b2ca2 net.http: Pass server name along for SNI (fixes #1408 )
75d2874502c3 net.server_select: SNI support (#409 )
9a905888b96c net.server_event: Add SNI support (#409 )
adc0672b700e net.server_epoll: Add support for SNI (#409 )
d4390c427a66 net.server: Handle server name (SNI) as extra argument
5 years ago
Matthew Wild
dc206f0ff4
net.http: Add request:cancel() method
...
This is a new API that should be used in preference to http.destroy_request()
when possible, as it ensures the callback is always called (with an error of
course).
APIs that have edge-cases where they don't call callbacks have, from experience,
shown to be difficult to work with and often lead to unintentional leaks when
the callback was expected to free up certain resources.
5 years ago
Matthew Wild
11e49af5e8
net.http: Re-expose destroy_request() function
...
This was accidentally turned private in 647adfd8f738 as part of refactoring
for Lua 5.2+.
5 years ago
Matthew Wild
a80cdecc46
net.resolvers.basic: Default conn_type to 'tcp' consistently if unspecified (thanks marc0s)
...
Fixes a traceback when passed an IP address with no conn_type.
6 years ago
Matthew Wild
bfd9789cb1
net.http: Fix traceback on invalid URL passed to request()
6 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
Matthew Wild
c340e3ab37
net.http: http.request() promise now resolves with response (breaking change)
...
Promise mode is not (widely?) used, changing this now while we can, as it
improves usability of the API.
The request is now available as response.request, if needed.
5 years ago
Matthew Wild
209660f212
net.http: use new net.http.errors lib for creating error object
5 years ago
Kim Alvefur
33d00845e7
net.server_select: Fix traceback (thanks eta)
...
The `socket` here is unreferenced on disconnect. Calling :resume_writes
after that causes an error when `addsocket()` tries to use it as a table
index.
5 years ago
Kim Alvefur
031a8d8e64
net.http.parser: Fix indentation
...
Probably due to a rebase/merge with a merge tool that ignores
whitespace. Happens all the time to me :(
5 years ago
Matthew Wild
9287d929c2
net.http.errors: Add new module for converting net.http errors to util.error objects
5 years ago
Kim Alvefur
91d2ab9108
net.http.parser: Allow specifying sink for large request bodies
...
This enables uses such as saving uploaded files directly to a file on
disk or streaming parsing of payloads.
See #726
5 years ago
Kim Alvefur
64aa6a2a0e
net.http.parser: Switch to util.dbuffer for buffering incoming data
...
This is primarily a step towards saving uploads directly to files, tho
this should hopefully be more efficient than collapsing the entire
buffer to a single string every now and then.
5 years ago
Kim Alvefur
7c00bae93a
net.server_epoll: Log debug message when a connection errors on read
...
It's confusingly quiet otherwise, even with maximum verboseness.
Thanks perflyst
6 years ago
Kim Alvefur
f2ae89296c
net.cqueues: Fix resuming after timeouts
...
net.cqueues previously relied on timers instead of fd events sometimes.
Under net.server_select, it would have called cq:loop() on every
iteration of the main loop, which was probably not optimal.
6 years ago
Kim Alvefur
26f741b19b
net.cqueues: Switch to server.watchfd for main loop integration
...
Why? Just look at all that code deleted!
watchfd is the prefered way to poll things that expose FDs for this
purpose, altho it was added after net.cqueues.
6 years ago
Kim Alvefur
8b9da40260
net.server_epoll: Add setting for turning off callback protections
...
Might improve (CPU) performance at the risk of triggering top level
errors.
6 years ago
Kim Alvefur
7acd39cdbe
net.server_epoll: Allow setting a custom error handler for listener
...
This lets plugins handle errors in some custom way, should they wish to.
6 years ago
Kim Alvefur
0a071df2d4
net.server_epoll: ... and include a traceback
6 years ago
Kim Alvefur
6baa04b056
net.server_epoll: Report errors in timers
6 years ago
Kim Alvefur
8ac1c4193c
net.server_epoll: Expose way to turn monotonic time into wall clock time
6 years ago
Kim Alvefur
a1ae266ff7
net.server_epoll: Optimize away table allocation for timer objects
6 years ago
Kim Alvefur
2b81c3b50f
net.server_epoll: Remove unused time field from timer objects
...
Unused since the move to util.indexedbheap in c8c3f2eba898
6 years ago
Kim Alvefur
ee10afcfab
net.server_epoll: Signal API-compatibilty with util.timer
...
Reduces the overhead of having both util.timer and the timer handling
here, since they are very similar and now API-compatible.
6 years ago
Kim Alvefur
927ef9f2f2
net.server_epoll: Make API-compatible with util.timer
6 years ago
Matthew Wild
fb5059547f
net.dns: Disable jitter for default resolver (used by blocking dns.lookup() calls)
...
This fixes 'prosodyctl check dns' being slow.
6 years ago
Kim Alvefur
8c73ea0b22
util.dependencies: Tone down lua-unbound dependency for now
...
At least until packages are available
Wording from MattJ
6 years ago
Kim Alvefur
300a9a56c5
net.resolvers: Remove FIXMEs obsoleted by switch to libunbound
6 years ago
Kim Alvefur
02c3cc978d
net.unbound: Remove compat for missing promises (pre-0.11)
...
Code existed in a separate project before merged into Prosody, so
util.promise was not always around.
6 years ago
Kim Alvefur
9be5cb3fbd
net.unbound: Strip support for legacy net.server APIs
...
These are not needed since the watchfd API is provided by all net.server
backends.
6 years ago
Kim Alvefur
bde46d79cd
net.adns: Log a warning if loaded (because net.unbound wasn't)
6 years ago
Kim Alvefur
e59b70638c
net.server_epoll: Fix indentation
...
Some lines seem to have gotten the wrong indentation, possibly caused by
Meld which often ignores lines with only whitespace changes and leaves
their previous indentation.
6 years ago
Kim Alvefur
b96535b6ae
net.unbound: Async DNS resolver library based on libunbound via luaunbound
7 years ago
Matthew Wild
6daae1f629
net.dns: Reduce default timeout to 5s
...
Most healthy queries will return well within this time, and the
new retry logic should help spread the cost of additional retries.
6 years ago
Matthew Wild
5e744740f3
net.dns: Increase backoff delays
...
Not entirely happy with the overall logic here.
6 years ago
Matthew Wild
d080fee323
net.dns: Add jitter to spread queries and reduce failures due to congestion
6 years ago
Matthew Wild
3ff48b8386
net.dns: Fix timeout retry logic
...
On timeout the query would be resent twice - once within
servfail(), and again inside the timeout callback.
This commit moves all retry logic to servfail().
6 years ago
Matthew Wild
5f4fcad112
net.dns: Add some debug logging
6 years ago
Kim Alvefur
7b89ab9b86
net.connect: Remove TODO about use_ipv4/6 done in 3bfb20be844c
6 years ago