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
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
Matthew Wild
ce129b96c7
net.server_select: Pass conn/handler to readbuffer/sendbuffer
...
The internal implementations don't use it, but this causes onreadable
and onwritable of watchfd to receive the conn as they do in other
backends.
6 years ago
Matthew Wild
30d3969c22
net.server_select: Ensure onconnect is always called before onincoming
...
This changes the code to call onconnect when the first data is sucessfully
read or written, instead of simply when the socket first becomes writable.
A writable socket can mean a connection error, and if the client already
sent some data it may get passed to onincoming before processing writable
sockets. This fixes the issue.
6 years ago
Kim Alvefur
be74ecddca
net.server_select: Remove prefix added to TLS handshaker errors
...
For consistency. None of the other implementations do this.
6 years ago
Kim Alvefur
fb692a2ced
net.server: Handle server name (SNI) as extra argument
...
Code added in 75d2874502c3, 9a905888b96c and adc0672b700e uses this field.
See #409 and #1408
6 years ago
Kim Alvefur
9afa1ac496
net.server: Accept and save an 'extra' field for client connections
...
This lets code attach some extra data to be attached to client
connections.
6 years ago
Kim Alvefur
f65c017ee1
Fix various spelling mistakes [codespell]
7 years ago
Kim Alvefur
589010b407
net.server_select: Fix IP validation to use correct variable (thanks quest)
...
Copy-paste mistake most likely. Not caught because server_select is ignored by luacheck.
7 years ago
Kim Alvefur
0ac9ea3a74
net.server: Swich method for connecting sockets with remotes
...
LuaSocket TCP sockets have have both :connect and :setpeername, which
are the exact same function, however UDP sockets only have :setpeername.
Switching to :setpeername allows most of this code to be generic wrt
TCP/UDP.
7 years ago
Kim Alvefur
2104ac9fb0
net.server: Remove socket constructor fallback
...
Should no longer be needed
7 years ago
Kim Alvefur
8a62a14e5d
net.server: Require IP address as argument to addclient (no DNS names)
...
The net.connect API should be used to resolve DNS names first
7 years ago
Kim Alvefur
7a86af343f
net.connect: Fix passing request table to new listener
...
This could be a return value from ondetach
7 years ago
Kim Alvefur
437fd63c6f
net.server: Call a 'onattach' callback when replacing listeners
7 years ago
Kim Alvefur
24ff76428f
net.server: Set default read timeout to 14 minutes ( fixes #971 )
8 years ago
Kim Alvefur
7fa2aa0007
net.server: Add watchfd, a simple API for watching file descriptors
8 years ago
Matthew Wild
4c4988ab3e
net.server_select: Allow setquitting("once") to allow resuming the loop later
8 years ago
Kim Alvefur
3ec060fc0c
Fix spelling throughout the codebase [codespell]
8 years ago
Matthew Wild
a4aeb103dd
net.server_select: Better detection of errors for outgoing connections
...
On connection failure, a socket is marked readable and writable. So
to detect initial connection failures (connection refused, etc.) we
now watch for sockets becoming readable during initial connection,
and also read from readable sockets before writing to writable
sockets.
This should fix 'onconnect' being called for outgoing connections
that actually failed.
8 years ago
Kim Alvefur
28ac8f6150
net.server_select: Prevent writes after a handler is closed ( fixes #783 I hope)
9 years ago
Anton Shestakov
6aadf43375
net.server_select: remove unused import [luacheck]
10 years ago
Anton Shestakov
8028f46d24
net.server_select: remove unused one-letter loop variable [luacheck]
10 years ago
Anton Shestakov
7a87176df8
net.server_select: remove unused one-letter loop variables [luacheck]
10 years ago
Kim Alvefur
2ed7876bea
server_select: Add logging of when servers are paused and resumed
10 years ago
Kim Alvefur
c46a125d73
server_select: Pause and mark server as full if accepting a client fails ( fixes #597 )
10 years ago
Kim Alvefur
c2f7450809
server_select: Retry accepting clients from full servers after 10s (matches libevent behaviour)
10 years ago
Kim Alvefur
a1560114d0
server_select: Keep track of which server listeners are full
10 years ago
Kim Alvefur
de6d620539
net.server_select: Add 'server' method to client connections (present in server_event)
10 years ago
Kim Alvefur
6a9bce5dae
server_select: Forward the actual TLS handshake error message
10 years ago
Matthew Wild
e5691fed79
net.server_select: Close all connections when quitting (and not just stepping), matches server_event
10 years ago
Kim Alvefur
7105732151
net.server_{select,event}: Don't rely on LuaSocket and LuaSec being present in the globals table
11 years ago
daurnimator
6d2aec4a34
net.server_select: Remove unused code
11 years ago
daurnimator
9ee1db0a57
net.server_select: Remove socket.sleep call from main loop
...
It's been there since the start; but should really not be required.
People can remember an issue with FreeBSD that this solved, but this was a hack solution anyway.
If that issue rears it's head again, we will solve it properly.
11 years ago
daurnimator
411cd234e3
net.server_select: Remove do-nothing os_difftime calls [backported from trunk]
11 years ago
daurnimator
7b2112c523
net.server_select: Remove do-nothing os_difftime calls
11 years ago
daurnimator
2a10013752
net.server_select: In add_task timer callback, use passed in time rather than re-fetching
11 years ago
daurnimator
037dd40bb4
net.server_select: Fix timers not being fired until another timer fixes (or 1 second passes)
11 years ago
daurnimator
e51cc17dcb
Move timer code out of util.timer and into relevant net.server backends
11 years ago
Kim Alvefur
edc34e6635
net.server_select: Reset read timeout timer if the event is handled
11 years ago
Matthew Wild
f8776db280
net.server_select: When an SSL handshake is connected, if there is pending data to be written to the socket, mark the socket as waiting to send (thanks daurnimator)
11 years ago
Matthew Wild
69d97b4f7e
net.server_select: 'listener'->'listeners' (fixes undefined global access)
11 years ago
Matthew Wild
257d0f104b
net.server_{select,event}: Add 'ondetach' callback for listener objects, to notify them when another listener is being assigned to a connection
11 years ago
Matthew Wild
57a4449fce
net.server_select/event: Switch sender mode to *a when reading, to make sure we get all available data
12 years ago
daurnimator
b124e4e226
net/server_*: Fix addclient: LuaSocket 3.0-rc1 sometimes returns EALREADY instead of EINPROGRESS when the dns lookup has multiple results
12 years ago
Kim Alvefur
cf7efc33b2
net.server_{select,event}: Add compat code for supporting the same client port API on connections
12 years ago
Kim Alvefur
195743afe0
net.server_{select,event}: addclient: Handle missing getaddrinfo
12 years ago
Kim Alvefur
24056ae3ad
net.server_{select,event}: addclient: Use getaddrinfo to detect IP address type if no socket type argument given. (Argument must be given for non-TCP)
12 years ago
Kim Alvefur
cf48e76e78
net.server_{select,event}: addclient: Use getaddrinfo to detect IP address type if no socket type argument given. (Argument must be given for non-TCP)
12 years ago
Kim Alvefur
ae81ea6eda
net.server_{select,event}: addclient: Add argument for overriding socket type
12 years ago
Kim Alvefur
3e156487cf
net.server_{select,event}: addclient: Add argument for overriding socket type
12 years ago