![]() |
libwebsockets
Lightweight C library for HTML5 websockets
|
Modules | |
| Form Parsing | |
| HTML Chunked Substitution | |
| HTTP File transfer | |
| HTTP headers: create | |
| HTTP headers: read | |
| Urlencode and Urldecode | |
Data Structures | |
| struct | lws_process_html_args |
| struct | lws_tokens |
Functions | |
| LWS_VISIBLE LWS_EXTERN int | lws_return_http_status (struct lws *wsi, unsigned int code, const char *html_body) |
| LWS_VISIBLE LWS_EXTERN int LWS_WARN_UNUSED_RESULT | lws_http_redirect (struct lws *wsi, int code, const unsigned char *loc, int len, unsigned char **p, unsigned char *end) |
| LWS_VISIBLE LWS_EXTERN int LWS_WARN_UNUSED_RESULT | lws_http_transaction_completed (struct lws *wsi) |
Modules related to handling HTTP
| LWS_VISIBLE LWS_EXTERN int LWS_WARN_UNUSED_RESULT lws_http_redirect | ( | struct lws * | wsi, |
| int | code, | ||
| const unsigned char * | loc, | ||
| int | len, | ||
| unsigned char ** | p, | ||
| unsigned char * | end | ||
| ) |
#include <lib/libwebsockets.h>
lws_http_redirect() - write http redirect out on wsi
| wsi | websocket connection |
| code | HTTP response code (eg, 301) |
| loc | where to redirect to |
| len | length of loc |
| p | pointer current position in buffer (updated as we write) |
| end | pointer to end of buffer |
Returns amount written, or < 0 indicating fatal write failure.
| LWS_VISIBLE LWS_EXTERN int LWS_WARN_UNUSED_RESULT lws_http_transaction_completed | ( | struct lws * | wsi | ) |
#include <lib/libwebsockets.h>
lws_http_transaction_completed() - wait for new http transaction or close
| wsi | websocket connection Returns 1 if the HTTP connection must close now Returns 0 and resets connection to wait for new HTTP header / transaction if possible |
| LWS_VISIBLE LWS_EXTERN int lws_return_http_status | ( | struct lws * | wsi, |
| unsigned int | code, | ||
| const char * | html_body | ||
| ) |
#include <lib/libwebsockets.h>
lws_return_http_status() - Return simple http status
| wsi | Websocket instance (available from user callback) |
| code | Status index, eg, 404 |
| html_body | User-readable HTML description < 1KB, or NULL Helper to report HTTP errors back to the client cleanly and consistently |