mirror of
https://github.com/lammertb/libhttp.git
synced 2025-12-22 04:02:04 +03:00
Add a function to access the user data in cases the context is known but not the connection
This commit is contained in:
@@ -251,6 +251,10 @@ CIVETWEB_API const char *mg_get_option(const struct mg_context *ctx, const char
|
|||||||
CIVETWEB_API struct mg_context *mg_get_context(struct mg_connection *conn);
|
CIVETWEB_API struct mg_context *mg_get_context(struct mg_connection *conn);
|
||||||
|
|
||||||
|
|
||||||
|
/* Get user data passed to mg_start from context. */
|
||||||
|
CIVETWEB_API void *mg_get_user_data(struct mg_context *ctx);
|
||||||
|
|
||||||
|
|
||||||
#if defined(MG_LEGACY_INTERFACE)
|
#if defined(MG_LEGACY_INTERFACE)
|
||||||
/* Return array of strings that represent valid configuration options.
|
/* Return array of strings that represent valid configuration options.
|
||||||
For each option, option name and default value is returned, i.e. the
|
For each option, option name and default value is returned, i.e. the
|
||||||
|
|||||||
@@ -1065,6 +1065,11 @@ struct mg_context *mg_get_context(struct mg_connection * conn)
|
|||||||
return (conn == NULL) ? (struct mg_context *)NULL : &(conn->ctx);
|
return (conn == NULL) ? (struct mg_context *)NULL : &(conn->ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void *mg_get_user_data(struct mg_context *ctx)
|
||||||
|
{
|
||||||
|
return (ctx == NULL) ? NULL : ctx->user_data;
|
||||||
|
}
|
||||||
|
|
||||||
size_t mg_get_ports(const struct mg_context *ctx, size_t size, int* ports, int* ssl)
|
size_t mg_get_ports(const struct mg_context *ctx, size_t size, int* ports, int* ssl)
|
||||||
{
|
{
|
||||||
size_t i;
|
size_t i;
|
||||||
|
|||||||
Reference in New Issue
Block a user