4 #include <sys/socket.h>
5 #include <netinet/in.h>
9 #include "web_buffer.h"
11 #ifndef NETDATA_WEB_CLIENT_H
12 #define NETDATA_WEB_CLIENT_H 1
14 #define WEB_CLIENT_MODE_NORMAL 0
15 #define WEB_CLIENT_MODE_FILECOPY 1
18 #define ZLIB_CHUNK 16384
19 #define MAX_HTTP_HEADER_SIZE 16384
22 unsigned long long id;
24 char client_ip[NI_MAXHOST+1];
25 char client_port[NI_MAXSERV+1];
27 char last_url[URL_MAX+1];
29 struct timeval tv_in, tv_ready;
34 struct sockaddr_storage clientaddr;
36 pthread_t thread; // the thread servicing this client
37 int obsolete; // if set to 1, the listener will remove this client
42 struct web_buffer *data;
44 int zoutput; // if set to 1, web_client_send() will send compressed data
45 z_stream zstream; // zlib stream for sending compressed output to client
46 Bytef zbuffer[ZLIB_CHUNK]; // temporary buffer for storing compressed output
47 long zsent; // the compressed bytes we have sent to the client
48 long zhave; // the compressed bytes that we have to send
54 char response_header[MAX_HTTP_HEADER_SIZE+1];
56 struct web_client *prev;
57 struct web_client *next;
60 extern struct web_client *web_clients;
62 extern struct web_client *web_client_create(int listener);
63 extern struct web_client *web_client_free(struct web_client *w);