[101] | 1 | /* Copyright Joyent, Inc. and other Node contributors. All rights reserved.
|
---|
| 2 | *
|
---|
| 3 | * Permission is hereby granted, free of charge, to any person obtaining a copy
|
---|
| 4 | * of this software and associated documentation files (the "Software"), to
|
---|
| 5 | * deal in the Software without restriction, including without limitation the
|
---|
| 6 | * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
---|
| 7 | * sell copies of the Software, and to permit persons to whom the Software is
|
---|
| 8 | * furnished to do so, subject to the following conditions:
|
---|
| 9 | *
|
---|
| 10 | * The above copyright notice and this permission notice shall be included in
|
---|
| 11 | * all copies or substantial portions of the Software.
|
---|
| 12 | *
|
---|
| 13 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
---|
| 14 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
---|
| 15 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
---|
| 16 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
---|
| 17 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
---|
| 18 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
---|
| 19 | * IN THE SOFTWARE.
|
---|
| 20 | */
|
---|
| 21 |
|
---|
| 22 | #ifndef __HTTP_PCB_H__
|
---|
| 23 | #define __HTTP_PCB_H__
|
---|
| 24 |
|
---|
[158] | 25 | #include "webserver/http_parser.h"
|
---|
[101] | 26 |
|
---|
| 27 | #define MAX_ELEMENT_SIZE 256
|
---|
| 28 |
|
---|
| 29 | struct message
|
---|
| 30 | {
|
---|
| 31 | enum http_method method;
|
---|
| 32 | unsigned short http_major;
|
---|
| 33 | unsigned short http_minor;
|
---|
| 34 | char request_url[MAX_ELEMENT_SIZE];
|
---|
| 35 | char response_status[64];
|
---|
| 36 | int num_headers;
|
---|
| 37 | char host[MAX_ELEMENT_SIZE];
|
---|
| 38 | char referer[MAX_ELEMENT_SIZE];
|
---|
| 39 | char upgrade[32];
|
---|
| 40 | char connection[32];
|
---|
| 41 | char sec_websocket_key[64];
|
---|
| 42 | char origin[MAX_ELEMENT_SIZE];
|
---|
| 43 | char sec_websocket_protocol[64];
|
---|
| 44 | char sec_websocket_version[4];
|
---|
| 45 | char response_key[86];
|
---|
| 46 | size_t body_size;
|
---|
| 47 | char body[MAX_ELEMENT_SIZE];
|
---|
| 48 | int should_keep_alive;
|
---|
| 49 | int headers_complete_cb_called;
|
---|
| 50 | int message_begin_cb_called;
|
---|
| 51 | int message_complete_cb_called;
|
---|
| 52 | int body_is_final;
|
---|
| 53 | };
|
---|
| 54 |
|
---|
| 55 | #ifndef _MSC_VER
|
---|
| 56 | size_t strnlen(const char *s, size_t maxlen);
|
---|
| 57 | #endif
|
---|
| 58 | size_t strlncat(char *dst, size_t len, const char *src, size_t n);
|
---|
| 59 | extern http_parser_settings websvr_settings;
|
---|
| 60 |
|
---|
| 61 | #endif /* __HTTP_PCB_H__ */
|
---|