warmcat / libwebsockets

canonical libwebsockets.org networking library

Home Page:https://libwebsockets.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

custom headers for http 2

yakovale-flutterint opened this issue · comments

Hi
Does lws support reading of non-registered, custom user headers for h2 protocol?
api lws_hdr_custom_name_foreach / lws_hdr_custom_copy works only in http 1, for h2 they return nothing like headers are not there.

No... it only supports it for h1 (and then it was only done because I was paid to do it).

The general approach is to minimize parsing time and memory needed by throwing out non well-known headers.

If lws is missing parsing support for any well-known headers, I can add it. If they're nonstandard headers, it's also possible that you can add them to the parsing table by regenerating the parsing table.

Thanks for reply. Just curious - is it an http2 protocol limitation or for some reason you thought it is not necessary?
Modifying parsing table is a good trick, but as a server i might not know user's headers.

h1 custom headers work my making a linked-list using the header names and values from the ah buffer that brought them in. h2 headers are typically compressed, so there is no convenient place to store the literal string without extra memory.

lws works on very lightweight microcontrollers, including the h2, it is always looking to be modest about memory.

Patches welcome though!