Skip to content

Commit 9a576c5

Browse files
committed
http/h1_connection: Add :setmaxline helper
1 parent 00ede89 commit 9a576c5

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

doc/modules/http.h1_connection.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,14 @@ See [`connection:get_next_incoming_stream(timeout)`](#connection:get_next_incomi
8888
See [`connection:onidle(new_handler)`](#connection:onidle)
8989

9090

91+
### `h1_connection:setmaxline(read_length)` <!-- --> {#http.h1_connection:setmaxline}
92+
93+
Sets the maximum read buffer size (in bytes) to `read_length`. i.e. sets the maximum length lines (such as headers).
94+
95+
The default comes from the underlying socket, which gets the (changable) cqueues default at time of construction.
96+
The default cqueues default is 4096 bytes.
97+
98+
9199
### `h1_connection:clearerr(...)` <!-- --> {#http.h1_connection:clearerr}
92100

93101
Clears errors to allow for further read or write operations on the connection. Returns the error number of existing errors. This function is used to recover from known errors.

http/h1_connection.lua

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,14 @@ local function new_connection(socket, conn_type, version)
5656
return self
5757
end
5858

59+
function connection_methods:setmaxline(read_length)
60+
if self.socket == nil then
61+
return nil
62+
end
63+
self.socket:setmaxline(read_length)
64+
return true
65+
end
66+
5967
function connection_methods:clearerr(...)
6068
if self.socket == nil then
6169
return nil

0 commit comments

Comments
 (0)