xref: /unit/src/nxt_h1proto.h (revision 1270:9efa309be18b)
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 
22     uint8_t                   nbuffers;
23     uint8_t                   header_buffer_slot;
24     uint8_t                   large_buffer_slot;
25     uint8_t                   keepalive;            /* 1 bit  */
26     uint8_t                   chunked;              /* 1 bit  */
27     uint8_t                   websocket;            /* 1 bit  */
28     uint8_t                   connection_upgrade;   /* 1 bit  */
29     uint8_t                   upgrade_websocket;    /* 1 bit  */
30     uint8_t                   websocket_version_ok; /* 1 bit  */
31     nxt_http_te_t             transfer_encoding:8;  /* 2 bits */
32 
33     uint8_t                   websocket_cont_expected;  /* 1 bit */
34     uint8_t                   websocket_closed;         /* 1 bit */
35 
36     uint32_t                  header_size;
37 
38     nxt_http_field_t          *websocket_key;
39     nxt_h1p_websocket_timer_t *websocket_timer;
40 
41     nxt_http_request_t        *request;
42     nxt_buf_t                 *buffers;
43     /*
44      * All fields before the conn field will
45      * be zeroed in a keep-alive connection.
46      */
47     nxt_conn_t                *conn;
48 };
49 
50 #endif  /* _NXT_H1PROTO_H_INCLUDED_ */
51