2 * libwebsockets - small server side websockets and web server implementation
4 * Copyright (C) 2010 - 2018 Andy Green <andy@warmcat.com>
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation:
9 * version 2.1 of the License.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
21 * This is included from core/private.h if LWS_ROLE_WS
24 #if defined(LWS_WITH_ZLIB)
25 #if defined(LWS_WITH_MINIZ)
32 extern struct lws_role_ops role_ops_cgi;
34 #define lwsi_role_cgi(wsi) (wsi->role_ops == &role_ops_cgi)
36 #define LWS_HTTP_CHUNK_HDR_SIZE 16
39 SIGNIFICANT_HDR_CONTENT_LENGTH, /* numeric */
40 SIGNIFICANT_HDR_LOCATION,
41 SIGNIFICANT_HDR_STATUS, /* numeric */
42 SIGNIFICANT_HDR_TRANSFER_ENCODING,
43 SIGNIFICANT_HDR_CONTENT_ENCODING_GZIP,
50 /* wsi who is master of the cgi points to an lws_cgi */
53 struct lws_cgi *cgi_list;
54 struct lws *stdwsi[3]; /* points to the associated stdin/out/err wsis */
55 struct lws *wsi; /* owner */
56 unsigned char *headers_buf;
57 unsigned char *headers_start;
58 unsigned char *headers_pos;
59 unsigned char *headers_dumped;
60 unsigned char *headers_end;
63 #if defined(LWS_WITH_ZLIB)
65 uint8_t inflate_buf[1024];
68 lws_filepos_t post_in_expected;
69 lws_filepos_t content_length;
70 lws_filepos_t content_length_seen;
73 int match[SIGNIFICANT_HDR_COUNT];
79 unsigned char being_closed:1;
80 unsigned char explicitly_chunked:1;
81 unsigned char cgi_transaction_over:1;
82 unsigned char implied_chunked:1;
83 unsigned char gzip_inflate:1;
84 unsigned char gzip_init:1;
86 unsigned char chunked_grace;