aboutsummaryrefslogtreecommitdiff
path: root/src/supplemental/http
Commit message (Collapse)AuthorAge
* http: The big HTTP API refactoring of January 2025.v2.0.0-alpha.3http-client-transGarrett D'Amore2025-01-09
| | | | | | | | | | | | | | | | | | | | | | This represents a major change in the HTTP code base, consisting of a complete revamp of the HTTP API. The changes here are too numerous to mention, but the end result should be a vastly simpler API for both server and client applications. Many needless allocations were removed by providing fixed buffers for various parameters and headers when possible. A few bugs were fixed. Most especially we have fixed some bugs around very large URIs and headers, and we have also addressed conformance bugs to more closely conform to RFCs 9110 and 9112. As part of this work, the APIs for WebSockets changed slightly as well. In particular the properties available for accessing headers have changed. There is still documentation conversion work to do, and additional functionality (such as proper support for chunked transfers), but this is a big step in the right direction.
* http: server callback API simplifiedGarrett D'Amore2025-01-06
| | | | | | | | | | This simplified API lets callbacks obtain the response from the connection objection directly, and does not require the aio to carry it as a parameter. Further, the request and response are both stored inline in the connection, reducing allocations. This is at present only for the server; the client will get a similar set of changes.
* http: changing transaction API to inline req and res structuresGarrett D'Amore2025-01-05
| | | | | This is a step towards simplifying this API and ultimately simplifying the HTTP callback API used for the server side.
* api: fold TLS supplemental headers into nng.hGarrett D'Amore2025-01-04
|
* http: fix zero status code by defaultGarrett D'Amore2025-01-01
| | | | | This is a recent regression that affects any server that does not explicitly set an HTTP status code.
* http: inline aiosGarrett D'Amore2024-12-26
|
* http: more nni_aio_start changesGarrett D'Amore2024-12-26
|
* http: No need to do nni_aio_begin for callbacksGarrett D'Amore2024-12-26
|
* http: use nni_aio_startGarrett D'Amore2024-12-26
|
* aio: introduce nni_aio_deferGarrett D'Amore2024-12-22
| | | | | | | | This will replace nni_aio_schedule, and it includes finishing the task if needed. It does so without dropping the lock and so is more efficient and race free. This includes some conversion of some subsystems to it.
* http: limit handler uri to 1KGarrett D'Amore2024-12-22
| | | | | | | | | | | 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.
* http server test: fix leak in testGarrett D'Amore2024-12-22
|
* http: nng_http_handler_set_data is now void return (API break)Garrett D'Amore2024-12-22
|
* nng_http_server_collect_body now void return (API break)Garrett D'Amore2024-12-22
|
* http: handler set tree no longer returns a value (API break)Garrett D'Amore2024-12-22
|
* HTTP: nng_http_handler_set_method no longer failsGarrett D'Amore2024-12-22
|
* HTTP handler: limit host names to 256 bytes (RFC 1035 specifies 253.)Garrett D'Amore2024-12-22
| | | | This also makes `nng_http_handler_set_host` never fail (API break).
* http: setting response status never fails (breaking API change)Garrett D'Amore2024-12-22
|
* http: method on request structure is now staticGarrett D'Amore2024-12-22
| | | | | This saves yet another allocation. It also no longer returns a value making this a breaking change.
* http handler: avoid method allocationGarrett D'Amore2024-12-22
| | | | | | | | | 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.
* HTTP: intern the version and avoid allocationv2.0.0-alpha.1Garrett D'Amore2024-12-22
| | | | | | There are only a few possible reasonable values, and we can intern them to avoid any allocations for it. (We will probably do the same for the HTTP method shortly as well.)
* http: don't assume 200 status unless we actually exchange dataGarrett D'Amore2024-12-19
| | | | This should simplify debugging in some circumstances.
* http server: inline connection aio objectsGarrett D'Amore2024-12-15
| | | | Fewer failure paths, fewer allocations.
* http server: inline the accept aioGarrett D'Amore2024-12-15
| | | | Also properly stop it when doing http_server_stop.
* streams: add explicit stop functionsGarrett D'Amore2024-12-12
| | | | | | | | | | | | This allows us to explicitly stop streams, dialers, and listeners, before we start tearing down things. This hopefully will be useful in resolving use-after-free bugs in http, tls, and websockets. The new functions are not yet documented, but they are nng_stream_stop, nng_stream_dialer_stop, and nng_stream_listener_stop. They should be called after close, and before free. The close functions now close without blocking, but the stop function is allowed to block.
* performance: reference counters can use relaxed order when incrementingGarrett D'Amore2024-12-07
|
* tests: convert http server test to NUTSGarrett D'Amore2024-12-06
|
* http server: sprintf is considered deprecatedGarrett D'Amore2024-12-01
| | | | | | | | | | Because it is typically associated with insecure code, use of sprintf is discouraged. Note that our usage was actually quite careful and not insecure, but its mere presence raises concern especially by parties who are unwilling or unable to assess the actual code for correctness. A better choice here would be strlcat, but strlcat is not universally available.
* http server: fix race condition for server->closedGarrett D'Amore2024-12-01
|
* http: constify some functionsGarrett D'Amore2024-11-24
|
* Use 32-bit port numbers.Garrett D'Amore2024-11-21
| | | | | While TCP and UDP port numbers are 16-bits, ZT uses a larger (24-bit) port number.
* Merge internal and external URL APIs. No need forGarrett D'Amore2024-11-18
| | | | the separation of nni_url and nng_url.
* URL refactor part 1.Garrett D'Amore2024-11-18
| | | | | | | This eliminates most (but not all) of the dynamic allocations associated with URL objects. A number of convenience fields on the URL are removed, but we are able to use common buffer for most of the details.
* URL u_port should be a number not a string.Garrett D'Amore2024-11-17
| | | | | | | | | | | The idea here is to reduce the dynamic allocations used for URLs, and also the back and forth with parsing begin strings and port numbers. We always resolve to a port number, and this is easier for everyone. The real goal in the long term is to eliminate dynamic allocation of the URL fields altogether, but that requires a little more work. This is a step in the right direction.
* refactor initialization/finalizationGarrett D'Amore2024-11-11
| | | | | | | | | Applications must now call nng_init(), but they can supply a set of parameters optionally. The code is now safe for multiple libraries to do this concurrently, meaning nng_fini no longer can race against another instance starting up. The nni_init checks on all public APIs are removed now.
* TLS configuration changed to use discret _set_tls and _get_tls functions.Garrett D'Amore2024-11-09
| | | | This is simpler, and more reliable than using socket options.
* Remove nng_stream_set function family.Garrett D'Amore2024-10-28
| | | | This was not really used or useful.
* fixes #1735 websocket should send, and wait for, WS_CLOSE frames on shutdownGarrett D'Amore2023-12-17
| | | | fixes #1733 deadlock in websocket listener close
* Skip URI parameters when serving a directory (http_server)Robert Bielik2023-08-23
|
* fixes#1611 http_sconn_error() in http_server.c; use after freeGarrett D'Amore2023-04-19
|
* Fixes for some security complaints.Garrett D'Amore2022-12-31
| | | | | | | None of these changes are actual security bugs, but GitHub's scanner reports false positives at Critical severity for them. (There are a number of complaints from that scanner, many of which we do not necessarily agree with.)
* Fix out-of-bounds error in http_uri_canonify(). (#1595)Manuel Saraiva2022-05-31
|
* Replace nni_aio_prov_set_extra with nni_aio_prov_set_data.Garrett D'Amore2021-12-31
| | | | | | This takes one less parameter, and is simpler. It will let us reclaim the aio_prov_extra data space as well, so that we can use it for other purposes.
* Use static initialization for lists and mutexes.Garrett D'Amore2021-12-05
| | | | | | This eliminates some run-time initialization, moving it to compile time. Additional follow up work will expand on this to simplify initialization and reduce the need for certain locks.
* fixes #1393 Use after free in http (#1395)Evgeny Ermakov2021-01-03
|
* Fix compilation warnings (#1397)Evgeny Ermakov2021-01-02
|
* fixes #1372 nni_reap could be smallerGarrett D'Amore2020-12-19
|
* fixes #1313 support deferred nng_aio destructionGarrett D'Amore2020-12-12
|
* fixes #1358 nni_strtou64 and nni_strtox64 could be replaced with strtoullGarrett D'Amore2020-11-23
|
* Centralize the scheme handling for HTTP schemes.Garrett D'Amore2020-11-17
|