cpp-httplib icon indicating copy to clipboard operation
cpp-httplib copied to clipboard

Configurable URL decoding of HTTP headers

Open artpaul opened this issue 1 year ago • 1 comments

Hi @yhirose

While parsing HTTP headers the library unconditionally applies an url decoding to all headers except for the Location header. https://github.com/yhirose/cpp-httplib/blob/master/httplib.h#L3809

In my specific use case there is a custom header that contains url-like data (server side). The decoding makes hardly possible the further processing of the data.

What do you thing about adding some flexibility to the function? Suggestions:

  • global or server-level option to disable the url decoding;
  • configurable set of headers that can be excluded from decoding.

artpaul avatar Mar 04 '24 13:03 artpaul

@artpaul thank you for the report. This decoding was introduced at the following issue and commit.

https://github.com/yhirose/cpp-httplib/issues/576 https://github.com/yhirose/cpp-httplib/blame/852a37474892996c2a6968380f07eb0fe200f9fa/httplib.h

I am ok with "global or server-level option to disable the url decoding". If we take this option, are there any possible side effects that you can think of? Thanks!

yhirose avatar Mar 05 '24 13:03 yhirose

I'll close it for now, since no response for a while.

yhirose avatar Aug 30 '24 02:08 yhirose