4 #include <sys/socket.h>
5 #include <netinet/in.h>
8 #include "web_buffer.h"
10 #ifndef NETDATA_WEB_CLIENT_H
11 #define NETDATA_WEB_CLIENT_H 1
13 #define WEB_CLIENT_MODE_NORMAL 0
14 #define WEB_CLIENT_MODE_FILECOPY 1
17 #define ZLIB_CHUNK 16384
18 #define MAX_HTTP_HEADER_SIZE 16384
21 unsigned long long id;
23 char last_url[URL_MAX+1];
25 struct timeval tv_in, tv_ready;
30 struct sockaddr_in clientaddr;
32 pthread_t thread; // the thread servicing this client
33 int obsolete; // if set to 1, the listener will remove this client
38 struct web_buffer *data;
40 int zoutput; // if set to 1, web_client_send() will send compressed data
41 z_stream zstream; // zlib stream for sending compressed output to client
42 Bytef zbuffer[ZLIB_CHUNK]; // temporary buffer for storing compressed output
43 long zsent; // the compressed bytes we have sent to the client
44 long zhave; // the compressed bytes that we have to send
50 char response_header[MAX_HTTP_HEADER_SIZE+1];
52 struct web_client *prev;
53 struct web_client *next;
56 extern struct web_client *web_clients;
58 extern struct web_client *web_client_create(int listener);
59 extern struct web_client *web_client_free(struct web_client *w);