Skip to content

Not easy to get the number of methods llhttp has #872

Description

@Dreamsorcerer

In aiohttp, we need to create an array of all the method names that llhttp supports for caching purposes.

The problem is that llhttp_method_name abort()s on an out-of-range id (api.c:222), our old code therefore just had a hardcoded constant set to 46 and iterated over them. But, this means when llhttp added the QUERY method, our code didn't pick it up.

Would it be reasonable to add something to llhttp to trivially get this information? Either allowing llhttp_method_name to return NULL rather than abort(), or adding a constant that tells us how many methods are available.

Without something like that, I've had to add this awkward thing to extract the names directly:
https://github.com/aio-libs/aiohttp/pull/13174/changes#diff-061b5abe803b659aa544700e4065e1fbff6e83112315e345ea2d2e31ad1d6ca7R106-R117

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions