Skip to content

Commit 407a932

Browse files
committed
http: remove unused nng_http_handler_get_data
The data is now passed directly to the handler function.
1 parent 31b5bb1 commit 407a932

File tree

7 files changed

+1
-101
lines changed

7 files changed

+1
-101
lines changed

docs/man/libnng.3.adoc

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -93,32 +93,6 @@ be the case if WebSocket support is configured as well.
9393
In this case, it is possible to access functionality to support the creation of
9494
HTTP (and HTTP/S if TLS support is present) servers and clients.
9595

96-
==== Common HTTP Functions
97-
98-
The following functions are used to work with HTTP requests, responses,
99-
and connections.
100-
101-
|===
102-
|xref:nng_http_conn_read_req.3http.adoc[nng_http_conn_read_req()]|read HTTP request
103-
|xref:nng_http_conn_read_res.3http.adoc[nng_http_conn_read_res()]|read HTTP response
104-
|xref:nng_http_conn_write_req.3http.adoc[nng_http_conn_write_req()]|write HTTP request
105-
|xref:nng_http_conn_write_res.3http.adoc[nng_http_conn_write_res()]|write HTTP response
106-
|xref:nng_http_req_get_data.3http.adoc[nng_http_req_get_data()]|get HTTP request body
107-
|xref:nng_http_req_set_data.3http.adoc[nng_http_req_set_data()]|set HTTP request body
108-
|xref:nng_http_res_copy_data.3http.adoc[nng_http_res_copy_data()]|copy HTTP response body
109-
|xref:nng_http_res_get_data.3http.adoc[nng_http_res_get_data()]|get HTTP response body
110-
|xref:nng_http_res_get_header.3http.adoc[nng_http_res_get_header()]|return HTTP response header
111-
|xref:nng_http_res_set_data.3http.adoc[nng_http_res_set_data()]|set HTTP response body
112-
|===
113-
114-
==== HTTP Client Functions
115-
116-
These functions are intended for use with HTTP client applications.
117-
118-
|===
119-
|xref:nng_http_conn_transact.3http.adoc[nng_http_conn_transact()]|perform one HTTP transaction on connection
120-
|===
121-
12296
==== HTTP Server Functions
12397

12498
These functions are intended for use with HTTP server applications.
@@ -127,7 +101,6 @@ These functions are intended for use with HTTP server applications.
127101
|xref:nng_http_handler_alloc.3http.adoc[nng_http_handler_alloc()]|allocate HTTP server handler
128102
|xref:nng_http_handler_collect_body.3http.adoc[nng_http_handler_collect_body()]|set HTTP handler to collect request body
129103
|xref:nng_http_handler_free.3http.adoc[nng_http_handler_free()]|free HTTP server handler
130-
|xref:nng_http_handler_get_data.3http.adoc[nng_http_handler_get_data()]|return extra data for HTTP handler
131104
|xref:nng_http_handler_set_data.3http.adoc[nng_http_handler_set_data()]|set extra data for HTTP handler
132105
|xref:nng_http_handler_set_host.3http.adoc[nng_http_handler_set_host()]|set host for HTTP handler
133106
|xref:nng_http_handler_set_method.3http.adoc[nng_http_handler_set_method()]|set HTTP handler method

docs/man/nng_http_handler_get_data.3http.adoc

Lines changed: 0 additions & 46 deletions
This file was deleted.

docs/man/nng_http_handler_set_data.3http.adoc

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,6 @@ void nng_http_handler_set_data(nng_http_handler *handler, void *data,
2828

2929
The `nng_http_handler_set_data()` function is used to set an additional
3030
_data_ for the _handler_.
31-
The stored _data_ can be retrieved later in the handler function using
32-
xref:nng_http_handler_get_data.3http.adoc[`nng_http_handler_get_data()`].
3331

3432
Additionally, when the handler is deallocated, if _dtor_ is not `NULL`,
3533
then it will be called with _data_ as its argument.
@@ -40,6 +38,5 @@ this function is deallocate any resources associated with _data_.
4038

4139
[.text-left]
4240
xref:nng_http_handler_alloc.3http.adoc[nng_http_handler_alloc(3http)],
43-
xref:nng_http_handler_get_data.3http.adoc[nng_http_server_get_data(3http)],
4441
xref:nng_http_server_add_handler.3http.adoc[nng_http_server_add_handler(3http)],
4542
xref:nng.7.adoc[nng(7)]

include/nng/http.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -301,9 +301,6 @@ NNG_DECL void nng_http_handler_set_tree(nng_http_handler *);
301301
NNG_DECL void nng_http_handler_set_data(
302302
nng_http_handler *, void *, void (*)(void *));
303303

304-
// nng_http_handler_get_data returns the data that was previously stored.
305-
NNG_DECL void *nng_http_handler_get_data(nng_http_handler *);
306-
307304
// nng_http_server is a handle to an HTTP server instance. Servers
308305
// only serve a single port / address at this time.
309306

src/supplemental/http/http_api.h

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -294,15 +294,11 @@ extern void nni_http_handler_set_host(nni_http_handler *, const char *);
294294
extern void nni_http_handler_set_method(nni_http_handler *, const char *);
295295

296296
// nni_http_handler_set_data sets an opaque data element on the handler,
297-
// which will be available to the callback via nni_http_handler_get_data.
297+
// which will be available to the handler function as argument.
298298
// The callback is an optional destructor, and will be called with the
299299
// data as its argument, when the handler is being destroyed.
300300
extern void nni_http_handler_set_data(nni_http_handler *, void *, nni_cb);
301301

302-
// nni_http_handler_get_data returns the data that was previously stored
303-
// by nni_http_handler_set_data.
304-
extern void *nni_http_handler_get_data(nni_http_handler *);
305-
306302
// nni_http_handler_get_uri returns the URI set on the handler.
307303
extern const char *nni_http_handler_get_uri(nni_http_handler *);
308304

src/supplemental/http/http_public.c

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -434,17 +434,6 @@ nng_http_handler_set_data(nng_http_handler *h, void *dat, void (*dtor)(void *))
434434
#endif
435435
}
436436

437-
void *
438-
nng_http_handler_get_data(nng_http_handler *h)
439-
{
440-
#ifdef NNG_SUPP_HTTP
441-
return (nni_http_handler_get_data(h));
442-
#else
443-
NNI_ARG_UNUSED(h);
444-
return (NULL);
445-
#endif
446-
}
447-
448437
int
449438
nng_http_server_hold(nng_http_server **srvp, const nng_url *url)
450439
{

src/supplemental/http/http_server.c

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -163,12 +163,6 @@ nni_http_handler_set_data(nni_http_handler *h, void *data, nni_cb dtor)
163163
h->dtor = dtor;
164164
}
165165

166-
void *
167-
nni_http_handler_get_data(nni_http_handler *h)
168-
{
169-
return (h->data);
170-
}
171-
172166
const char *
173167
nni_http_handler_get_uri(nni_http_handler *h)
174168
{

0 commit comments

Comments
 (0)