Skip to content
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
4 changes: 4 additions & 0 deletions include/civetweb.h
Original file line number Diff line number Diff line change
Expand Up @@ -456,6 +456,10 @@ CIVETWEB_API int mg_modify_passwords_file(const char *passwords_file_name,
CIVETWEB_API const struct mg_request_info *
mg_get_request_info(const struct mg_connection *);

/* Return the local address (server side) of the socket for a connection */
CIVETWEB_API struct sockaddr *
mg_get_local_addr(struct mg_connection *);

/* Send data to the client.
Return:
0 when the connection has been closed
Expand Down
7 changes: 7 additions & 0 deletions src/civetweb.c
Original file line number Diff line number Diff line change
Expand Up @@ -1919,6 +1919,13 @@ mg_get_request_info(const struct mg_connection *conn)
}


struct sockaddr *
mg_get_local_addr(struct mg_connection *conn)
{
return &conn->client.lsa.sa;
}


/* Skip the characters until one of the delimiters characters found.
* 0-terminate resulting word. Skip the delimiter and following whitespaces.
* Advance pointer to buffer to the next word. Return found 0-terminated word.
Expand Down