swoole / library

📚 Swoole Library
https://wiki.swoole.com/#/library
Apache License 2.0
233 stars 59 forks source link

Handle cURL header names in case insensitive manner #76

Closed filakhtov closed 3 years ago

filakhtov commented 3 years ago

As per RFC 2616 Section 4.2 HTTP headers should be case-insensitive. Some of the internal functions, such as curl_setopt() modify headers using their canonical name, such as Content-Type, Cookie, Referer, etc. However, using a canonical name might not always work properly, if the client has set a header name in the lower case, such as content-type, referer or upper case CONTENT-TYPE, COOKIE or any other mixture of letter casing. In order to fix this problem a new mapping beetwen the lower case header name representation and the actual header name is introduced and is now used when performing any header manipulations.

Fixes swoole/swoole-src#3850

twose commented 3 years ago

Nice patch

filakhtov commented 3 years ago

Thanks guys! Very nice refactoring with hasHeader() also 👏 ! What do we need to get this into the release?