xref: /unit/src/nxt_h1proto.h (revision 1505:d18f2b38596b)
1 
2 /*
3  * Copyright (C) NGINX, Inc.
4  */
5 
6 #ifndef _NXT_H1PROTO_H_INCLUDED_
7 #define _NXT_H1PROTO_H_INCLUDED_
8 
9 
10 #include <nxt_main.h>
11 #include <nxt_http_parse.h>
12 #include <nxt_http.h>
13 #include <nxt_router.h>
14 
15 
16 typedef struct nxt_h1p_websocket_timer_s nxt_h1p_websocket_timer_t;
17 
18 
19 struct nxt_h1proto_s {
20     nxt_http_request_parse_t  parser;
21     nxt_http_chunk_parse_t    chunked_parse;
22     nxt_off_t                 remainder;
23 
24     uint8_t                   nbuffers;
25     uint8_t                   header_buffer_slot;
26     uint8_t                   large_buffer_slot;
27     uint8_t                   keepalive;            /* 1 bit  */
28     uint8_t                   chunked;              /* 1 bit  */
29     uint8_t                   websocket;            /* 1 bit  */
30     uint8_t                   connection_upgrade;   /* 1 bit  */
31     uint8_t                   upgrade_websocket;    /* 1 bit  */
32     uint8_t                   websocket_version_ok; /* 1 bit  */
33     nxt_http_te_t             transfer_encoding:8;  /* 2 bits */
34 
35     uint8_t                   websocket_cont_expected;  /* 1 bit */
36     uint8_t                   websocket_closed;         /* 1 bit */
37 
38     uint32_t                  header_size;
39 
40     nxt_http_field_t          *websocket_key;
41     nxt_h1p_websocket_timer_t *websocket_timer;
42 
43     nxt_http_request_t        *request;
44     nxt_buf_t                 *buffers;
45 
46     nxt_buf_t                 **conn_write_tail;
47     /*
48      * All fields before the conn field will
49      * be zeroed in a keep-alive connection.
50      */
51     nxt_conn_t                *conn;
52 };
53 
54 #endif  /* _NXT_H1PROTO_H_INCLUDED_ */
55