Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Httpstatic method #2007

Merged
merged 10 commits into from
Dec 22, 2024
Merged

Httpstatic method #2007

merged 10 commits into from
Dec 22, 2024

Conversation

gdamore
Copy link
Contributor

@gdamore gdamore commented Dec 22, 2024

fixes #

Note that the above format should be used in your git commit comments.
You agree that by submitting a PR, you have read and agreed to our
contributing guidelines.

We limit HTTP method lengths to 32.. there are no currently defined
HTTP methods that need more than 19 bytes (including trailing zero.)

Generally most servers will not have vast numbers of handlers, so the
cost of allocating some storage up front to avoid the dynamic allocation
is worth while.
This saves yet another allocation.  It also no longer returns a value
making this a breaking change.
This also makes `nng_http_handler_set_host` never fail (API break).
Copy link

codecov bot commented Dec 22, 2024

Codecov Report

Attention: Patch coverage is 85.71429% with 9 lines in your changes missing coverage. Please review.

Project coverage is 82.07%. Comparing base (9ac2c5a) to head (a24b4f1).
Report is 12 commits behind head on main.

Files with missing lines Patch % Lines
src/supplemental/http/http_server.c 84.21% 6 Missing ⚠️
src/supplemental/http/http_public.c 57.14% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2007      +/-   ##
==========================================
+ Coverage   82.03%   82.07%   +0.04%     
==========================================
  Files          95       95              
  Lines       23948    23915      -33     
  Branches     3153     3140      -13     
==========================================
- Hits        19646    19629      -17     
+ Misses       4229     4210      -19     
- Partials       73       76       +3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

This is just the part of the tree that will be matched when looking
up a handler.  Requests may come in with very much longer URIs, and
be matched to the handler as a "subdirectory".

This approach makes it possible to avoid a dynamic allocation on the
handler, at the cost of pre-allocating 1KB with the handler object.

This size can be overridden using a NNG_HTTP_MAX_URI at compile time.
@gdamore gdamore merged commit a24b4f1 into main Dec 22, 2024
36 of 37 checks passed
@gdamore gdamore deleted the httpstatic-method branch December 22, 2024 22:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant