httpserv_type Struct Reference

Used for information about current connection. More...

#include <httplib.h>

Data Fields

SOCKET * control
 
char * control_buffer
 
int32_t len
 
int32_t user_state
 
int32_t header_end
 
int32_t uri
 
char * uri_buffer
 
int32_t method
 
int32_t content_length
 
char * content_buffer
 
char * argv [HTTP_MAX_ARG]
 
int32_t argc
 
char * authorization
 
char * websocketkey
 
direntry_typefinfo
 
int32_t remaining
 
int32_t send
 
uint32_t upgrade
 

Detailed Description

Each HTTP request is parsed by the http_server(). All necessary information about the current request are stored in a structure of type httpserv_type and passed to user callback function http_interpreter(). The requested URI index is stored in member uri, the requested uri string is stored in uri_buffer. All parameters are accessible through argv and argc.

Examples:
HTTPdynamic.c, HTTPjava.c, and HTTPsimple.c.

Field Documentation

SOCKET* control

Connected socket

char* control_buffer

Buffer for incoming data

int32_t len

Received length

int32_t user_state

User defined state machine

int32_t header_end

End of header

int32_t uri

Requested uri index

char* uri_buffer

Requested uri string

int32_t method

Requested method

See also
_HTTP_GET, _HTTP_HEAD, _HTTP_POST
int32_t content_length

Content_length of last request

char* content_buffer

Content buffer of last request

argv

Form result parameter list

Parameter list that was passed in address line starting with requested page. E.g. the GET request

  >192.168.168.200/index.htm?Led1=1&Led2=1&Led3=1&Led4=1

entered in your web-browser will be parsed and stored in argc/argv and passed as argument to user defined callback function http_interpreter() for further processing:

http_server-> argv[0] = "index.htm";
http_server-> argv[1] = "Led1";
http_server-> argv[2] = "1";
http_server-> argv[3] = "Led2";
http_server-> argv[4] = "1";
.
.
.
See also
HTTPdynamic.c
argc

Argument count

See also
HTTPdynamic.c
char* authorization

authorization key

char* websocketkey

websocket key

direntry_type* finfo

File information

int32_t remaining

Remaining bytes

int32_t send

send process in progress

uint32_t upgrade

websocket upgrade