aboutsummaryrefslogtreecommitdiffstats
path: root/src
AgeCommit message (Collapse)Author
9 daysUpdate to most recent WebTransport draftHEADmasterLoïc Hoguin
WEBTRANSPORT -> WT in most places. Only ENABLE_WEBTRANSPORT remains (since it is a draft-02 setting that was later removed) as well as internal functions and atoms about stream headers, for greater clarity.
14 daysInitial implementation of HTTP/3 WebTransportLoïc Hoguin
This adds support for WebTransport HTTP/3 settings, error codes, headers, stream types as well as capsules, with an initial implementation of the Capsule protocol.
2025-04-10Make Dialyzer happy againLoïc Hoguin
2025-04-10Add cow_http2_machine:terminate/1 for cleanupLoïc Hoguin
This allows cleaning up timers and avoids receiving stray timeout messages when reusing a process. This is otherwise optional since the termination of a process cleans up the timers.
2025-02-14Remove copyright years from all files except LICENSELoïc Hoguin
2025-02-11Improve cow_http2:settings/0 type and export itLoïc Hoguin
2025-02-11Add a function to check remote HTTP/2 setting MAX_CONCURRENT_STREAMSViktor Söderqvist
This is to be used primarily by a client before initiating a new stream so that it can respect the setting from the server.
2025-02-10Add cow_http_hd:allow/1Loïc Hoguin
2025-01-23Disable WS compression when only server sets client_max_window_bitsJose M Perez
When the client does not provide the "client_max_window_bits" option, the server must be able to handle a sliding window of up to 32,768 bytes. When the server has configured a lower limit than the default, and the client has not provided the parameter, compression must be disabled. Co-authored-by: Ignacio Martínez <[email protected]>
2025-01-22Use zlib:safeInflate and limits for Websocket decompressionLoïc Hoguin
The `max_inflate_size` value can be configured in the extensions map to set a limit to the size of the expanded data. This is done via the previously introduced cow_deflate:inflate/3 function.
2025-01-22Add cow_deflate:inflate/3Loïc Hoguin
This function can be used to safely inflate data up to a given limit. It has been extracted from the cowboy_decompress_h module.
2025-01-22Fix compression of zero-byte Websocket framesLoïc Hoguin
An empty deflate block must be inserted when zlib returns nothing.
2025-01-16Update mimetypesLoïc Hoguin
2025-01-14Fix OTP-27 Dialyzer warningsLoïc Hoguin
Disable improper lists warnings in cow_qs/cow_uri since we intentionally create them.
2025-01-13Avoid an extra multiplication before unmaskingLoïc Hoguin
This has no real impact on performance but simplies the code a little.
2025-01-07Optimise Websocket (un)maskingLoïc Hoguin
By (un)masking 16 bytes at a time when possible (instead of 4) we process frames roughly 10% faster for all frame types.
2025-01-06Optimise Websocket UTF-8 validationLoïc Hoguin
See comment within the commit for full details. This results in improved Cowboy performance decoding text messages of around 10 to 15% in all scenarios, except when the message is small and it contains mostly non-ASCII (due to the cost of trying ASCII first). This brings decoding of text frames closer to decoding of binary frames, with ASCII data taking approximately 1.1 times longer to decode, mixed data 1.25 times longer and mostly non-ASCII data 1.35 times longer to decode.
2025-01-06Add debug logging for receiving of HTTP/2 framesLoïc Hoguin
2024-07-04Optimise all cow_qs functionsLoïc Hoguin
See the previous commit [1] for details on the optimisations involved. The optimisation provides the same type of performance gains for encoding, decoding, building and parsing query strings. [1] cdaac4c907dbee90a91ad123b18dc6919a3835f6
2024-07-03Optimise cow_uri:urlencodeLoïc Hoguin
See the previous commit [1] for details on the optimisations involved. The optimisation provides the same type of performance gains for encoding and decoding. [1] cdaac4c907dbee90a91ad123b18dc6919a3835f6
2024-07-02Optimise cow_uri:urldecodeLoïc Hoguin
The recently added `json` module in OTP demonstrated new, better ways of optimising binary string manipulations. Some of which likely make better use of recent compiler or VM improvements. The main improvement is returning as fast as possible when there's nothing to decode: cow_uri:urldecode in 0.053833s cow_uri:urldecode in 0.005991s When there's a little to decode, the performance is nicely improved, although not as much: cow_uri:urldecode_hex in 0.061018s cow_uri:urldecode_hex in 0.040028s When the input if fully/mostly encoded JP text, the difference is remarkable: cow_uri:urldecode_jp_hex in 0.099333s cow_uri:urldecode_jp_hex in 0.039391s cow_uri:urldecode_jp_mixed_hex in 0.097653s cow_uri:urldecode_jp_mixed_hex in 0.046385s The worst case scenario unfortunately is slower than before, but nothing too bad. The worst case is when the input is a sequence of 3 encoded characters followed by 3 non-encoded characters: cow_uri:urldecode_worst_case_hex in 0.050017s cow_uri:urldecode_worst_case_hex in 0.061515s
2024-03-26Initial HTTP/3 and QPACK implementationqpackLoïc Hoguin
Cowlib now uses GitHub Actions for CI. As a result of this change, Cowlib is tested against OTP-24+. This commit adds initial implementations of cow_http3, cow_http3_machine and cow_qpack. Because QPACK is similar to HPACK, some encoding and decoding functions were moved to a common include file, particularly the huffman functions. The cow_http module now contains the types and functions common to all or most versions of HTTP. The types and functions specific to HTTP/1 were moved to the new cow_http1 module. Because HTTP/3 is similar to HTTP/2, part of the code processing headers is common and can be found in cow_http. Other functions common to both versions were moved out of cow_http2_machine. This commit updates comments indicating that the HTTP/2 PRIORITY mechanism will no longer be implemented.
2024-03-14Cowlib 2.13.02.13.0Loïc Hoguin
2024-03-14Add max_fragmented_header_block_size HTTP/2 optionLoïc Hoguin
2023-03-28Fix handling of bad length for RST_STREAM parsingLuis Gustavo Beligante
2023-02-28Fix compile error due to bad specLoïc Hoguin
OTP fixed a bug that leads to the bad spec no longer compiling. Fix is expected to land in OTP-26.0.
2023-01-16Cowlib 2.12.0Loïc Hoguin
2022-10-24Update SameSite cookie attribute to handle "Default"Loïc Hoguin
2022-09-12Remove the obsolete Version cookie attributeSebastian Strollo
2022-09-02Do additional cookie parsing checks based on RFC6265bisLoïc Hoguin
2022-03-22Implement RFC5861 (stale-* cache-control directives)Tangui Le Pense
Loïc: amended to add RFC5861 examples to the tests.
2022-03-22Update Basic auth parsing to RFC 7617Sebastian Strollo
In particular we now ignore unknown authentication parameters. Loïc: Small cleanup edits in amend.
2022-03-22Fix URI template reserved expansion of %-encodedLoïc Hoguin
2022-03-22Update structured headers implementation to RFC 8941Loïc Hoguin
I have in the process changed the output a little with regard to parameters. The dictionaries also build as a list of key-values now to keep ordering. This should be the definitive interface.
2020-11-27Handle last remote stream ID in cow_http2_machineViktor Söderqvist
New function set_last_streamid/1 sets the last accepted stream ID to the last known remote stream ID. Frames with a remote stream ID greater than this are thereafter discarded by frame/2, which returns {ok, Http2Machine} for such frames.
2020-11-12Fix set-cookie empty domain attribute parsingLoïc Hoguin
We must not remove all domain attributes when we find an empty domain attribute, we must only ignore this one particular cookie-av. (RFC6265bis 5.3.3)
2020-10-23Add cow_http2_machine:get_remote_settings/12.10.0Jonas Boberg
LH: I've updated the code to include enable_connect_protocol conditionally depending on the endpoint.
2020-10-20Document the same_site changesLoïc Hoguin
And explain that browsers may be more strict over TCP vs TLS.
2020-10-07Add a message_tag to timeout messages sent by cow_http2_machineLoïc Hoguin
They are currently optional to avoid doing a breaking change but should become mandatory (perhaps with a default value of undefined) in Cowlib 3.0.
2020-10-07Minor optimization in cow_hpack:update_table_size/2Viktor Söderqvist
Table only needs to be resized if the current size exceeds the new max size, regardless of current max size.
2020-10-07Make HPACK encode respect new configured max sizeViktor Söderqvist
Correction to cow_hpack:encode/2,3 according to RFC 7541, 4.3. Entry Eviction When Dynamic Table Size Changes. This change also corrects the handling of inserting entries larger than the max size, which shall result in an empty table, according to 4.4. in the same RFC. Fixes #101, #103.
2020-10-07Cookies: accept setting same_site to noneNiklas
Chromium and Firefox have both begun using "Lax" as the default for non-Secure cookies.
2020-03-30Add aliases for cookie parsing in cow_http_hdLoïc Hoguin
2020-03-30Fix some HPACK Huffman decoding failure casesLoïc Hoguin
When EOS is found within the string the decoding must fail. When the final padding is > 7 bit in length the decoding must fail as well.
2020-03-19Document the new cow_cookie functionsLoïc Hoguin
2020-03-11Add cow_cookie:cookie/1Loïc Hoguin
2020-03-06Add cow_cookie:parse_set_cookie/1Loïc Hoguin
Also do minor fixes to cow_cookie:parse_cookie/1. There is a potential incompatibility from these changes, because now a header "Cookie: foo" will be translated to a cookie with an empty name and value "foo", instead of cookie name "foo" and empty value. Also cookie names starting with $ are no longer ignored. These fixes are necessary for the cookies test suite from Web platform tests to work, and match the upcoming cookie RFC.
2020-02-27Clarify error when expecting a SETTINGS frame in HTTP/2 prefaceLoïc Hoguin
The error was appropriate for server mode, but not for client mode, because the server does not send the preface sequence.
2020-01-06Use a map for streams in cow_http2_machineLoïc Hoguin
2019-12-31Fix sending trailers when there are data frames in queueTony Han