I have completed a series of updates to the http parser/generator library Luncheon but before I request the changes get pulled into the lua_libs
I want to get a little more confidence in the changes. In order to do this I am asking anyone in the driver developer community to try patching this library in their drivers to see if these changes cause any issues. Directions for how to include these changes in a driver are below.
First clone the luncheon repository and checkout the misc-fixes
branch and then copy the luncheon sub-directory into the driver’s src
directory
git clone https://github.com/cosock/luncheon
cd ./luncheon
git checkout misc-fixes
cp ./luncheon /path/to/driver/src
As an example here is how I’ve done this in my http_button driver.
If you are using Luncheon in any of your drivers I would really appreciate some extra runtime on these changes. If you do end up trying to test this please reply here with either a success or failure.
The changes include the following
- Chunk encoding parsing on requests and responses with a
source
when theTransfer-Encoding
header is set tochunked
-
iter
andserialize
now work for both builders and source based requests and responses -
send
will callself.sock.send
with up to 1024 bytes instead of just the next line -
Headers
now has an explicitappend
andreplace
method for controlling duplicate headers- Previously multiple calls to
append
would only select the last entry when serializing, now all entries will be serialized - Request/Response helpers
set_content_length
andset_content_type
will now use thereplace
method to avoid duplicate entries for these values. - Request/Response types now have a
replace_header
method for accessing this w/o callingget_headers
directly.
- Previously multiple calls to
-
Request:content_length
has been marked as deprecated in favor ofRequest:get_content_length
which better matches theResponse
method. -
Request.new
no longer sets thecontent-length
header to0
on construction - A large amount of the parse/generate logic has been centralized to be shared across both the
Request
andResponse
types.
Some of the key things I am looking to get a handle on are
- Are any of the changes made non-backwards compatible?
- Missing methods or fields (anything prefixed with a
_
according to convention is not considered public)
- Missing methods or fields (anything prefixed with a
- Does the new chunk encoding parse incoming requests/responses correctly?
- Does the changes to the
Headers
type negatively impact existing uses?
Please reach out here if you have any questions and/or feedback. Thank you in advance!