I am using the HTTP:Daemon Module. Currently I am using the $c->get_request() without arguments to read full request when they arrive. Now I want to make sure to read a max of 10k, otherwise drop / ignore the request.

The most elaborated documentation I can find about this issue is:

-----------------------

$c->get_request([$headers_only])Read data from the client and turn it into an HTTP::Request object which is then returned. It returns undef if reading of the request fails. If it fails, then the HTTP::Daemon::ClientConn object ($c) should be discarded, and you should not call this method again. The $c->reason method might give you some information about why $c->get_request returned undef. The $c->get_request method supports HTTP/1.1 request content bodies, including chunked transfer encoding with footer and self delimiting multipart/* content types.>The $c->get_request method will normally not return until the whole request has been received from the client. This might not be what you want if the request is an upload of a multi-mega-byte file (and with chunked transfer encoding HTTP can even support infinite request messages - uploading live audio for instance). If you pass a TRUE value as the $headers_only argument, then $c->get_request will return immediately after parsing the request headers and you are responsible for reading the rest of the request content. If you are going to call $c->get_request again on the same connection you better read the correct number of bytes.

$c->read_buffer([$new_value])Bytes read by $c->get_request, but not used are placed in the read buffer. The next time $c->get_request is called it will consume the bytes in this buffer before reading more data from the network connection itself. The read buffer is invalid after $c->get_request has returned an undefined value. If you handle the reading of the request content yourself you need to empty this buffer before you read more and you need to place unconsumed bytes here. You also need this buffer if you implement services like 101 Switching Protocols. This method always return the old buffer content and can optionally replace the buffer content if you pass it an argument

---------------------------------

They write "If you are going to call $c->get_request again on the same connection you better read the correct number of bytes" How do I do this? How do I make sure how many bytes are actually read?