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

Http handler fini #2091

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 0 additions & 47 deletions docs/man/nng_http_handler_free.3http.adoc

This file was deleted.

157 changes: 86 additions & 71 deletions docs/ref/api/http.md

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions docs/ref/xref.md
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,11 @@
[`nng_http_read_all`]: /api/http.md#direct-read-and-write
[`nng_http_write`]: /api/http.md#direct-read-and-write
[`nng_http_write_all`]: /api/http.md#direct-read-and-write
[`nng_http_handler_alloc`]: /api/http.md#nng_http_handler_alloc
[`nng_http_handler_static`]: /api/http.md#nng_http_handler_static
[`nng_http_handler_redirect`]: /api/http.md#nng_http_handler_redirect
[`nng_http_handler_file`]: /api/http.md#nng_http_handler_file
[`nng_http_handler_directory`]: /api/http.md#nng_http_handler_directory

<!-- Macros -->

Expand Down
13 changes: 7 additions & 6 deletions include/nng/http.h
Original file line number Diff line number Diff line change
Expand Up @@ -242,20 +242,21 @@ NNG_DECL void nng_http_handler_free(nng_http_handler *);

// nng_http_handler_alloc_file creates a "file" based handler, that
// serves up static content from the given file path. The content-type
// supplied is determined from the file name using a simple built-in map.
NNG_DECL nng_err nng_http_handler_alloc_file(
nng_http_handler **, const char *, const char *);
// is taken from the 3rd argument, unless that is NULL, in which case
// it is determined from the file name using a simple built-in map.
NNG_DECL nng_err nng_http_handler_file(
nng_http_handler **, const char *, const char *, const char *);

// nng_http_handler_alloc_static creates a static-content handler.
// The last argument is the content-type, which may be NULL (in which case
// "application/octet-stream" is assumed.)
NNG_DECL nng_err nng_http_handler_alloc_static(
NNG_DECL nng_err nng_http_handler_static(
nng_http_handler **, const char *, const void *, size_t, const char *);

// nng_http_handler_alloc_redirect creates an HTTP redirect handler.
// The status is given, along with the new URL. If the status is 0,
// then 301 will be used instead.
NNG_DECL nng_err nng_http_handler_alloc_redirect(
NNG_DECL nng_err nng_http_handler_redirect(
nng_http_handler **, const char *, nng_http_status, const char *);

// nng_http_handler_alloc_file creates a "directory" based handler, that
Expand All @@ -264,7 +265,7 @@ NNG_DECL nng_err nng_http_handler_alloc_redirect(
// directory content, otherwise a suitable error page is returned (the server
// does not generate index pages automatically.) The content-type for
// files is determined from the file name using a simple built-in map.
NNG_DECL nng_err nng_http_handler_alloc_directory(
NNG_DECL nng_err nng_http_handler_directory(
nng_http_handler **, const char *, const char *);

// nng_http_handler_set_method sets the method that the handler will be
Expand Down
16 changes: 8 additions & 8 deletions src/supplemental/http/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,18 @@
option (NNG_ENABLE_HTTP "Enable HTTP API" ON)
if (NNG_ENABLE_HTTP)
set(NNG_SUPP_HTTP ON)
endif()
mark_as_advanced(NNG_ENABLE_HTTP)

nng_sources(http_public.c http_api.h)

nng_defines_if(NNG_SUPP_HTTP NNG_SUPP_HTTP)
nng_sources_if(NNG_SUPP_HTTP
nng_defines(NNG_SUPP_HTTP)
nng_sources(
http_api.h
http_client.c
http_chunk.c
http_conn.c
http_msg.c
http_public.c
http_schemes.c
http_server.c)
nng_test_if(NNG_SUPP_HTTP http_server_test)
nng_test(http_server_test)
else()
nng_sources(http_stubs.c)
endif()
mark_as_advanced(NNG_ENABLE_HTTP)
Loading
Loading