mirror of
https://github.com/eclipse-mosquitto/mosquitto.git
synced 2026-05-21 12:24:29 +02:00
Skeleton callback_http() function.
This commit is contained in:
parent
f500ff78b8
commit
b84ca80052
|
|
@ -321,7 +321,53 @@ static int callback_http(struct libwebsocket_context *context,
|
|||
void *in,
|
||||
size_t len)
|
||||
{
|
||||
struct libws_mqtt_hack *hack;
|
||||
char *http_dir;
|
||||
|
||||
/* FIXME - ssl cert verification is done here. */
|
||||
|
||||
switch (reason) {
|
||||
case LWS_CALLBACK_HTTP:
|
||||
hack = (struct libws_mqtt_hack *)libwebsocket_context_user(context);
|
||||
if(!hack){
|
||||
return -1;
|
||||
}
|
||||
http_dir = hack->http_dir;
|
||||
|
||||
if(!http_dir){
|
||||
/* http disabled */
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Forbid POST */
|
||||
if(lws_hdr_total_length(wsi, WSI_TOKEN_POST_URI)){
|
||||
libwebsockets_return_http_status(context, wsi, HTTP_STATUS_FORBIDDEN, NULL);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* FIXME - do transfer */
|
||||
break;
|
||||
|
||||
case LWS_CALLBACK_HTTP_BODY:
|
||||
/* For extra POST data? */
|
||||
return -1;
|
||||
|
||||
case LWS_CALLBACK_HTTP_BODY_COMPLETION:
|
||||
/* For end of extra POST data? */
|
||||
return -1;
|
||||
|
||||
case LWS_CALLBACK_FILTER_HTTP_CONNECTION:
|
||||
/* Access control here */
|
||||
return 0;
|
||||
|
||||
case LWS_CALLBACK_HTTP_WRITEABLE:
|
||||
/* Send our data here */
|
||||
return -1;
|
||||
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue