Mercurial > hg > nginx-quic
annotate src/http/ngx_http_spdy.c @ 5915:ac3f78219f85
Moved the code for coalescing file buffers to a separate function.
author | Valentin Bartenev <vbart@nginx.com> |
---|---|
date | Wed, 13 Aug 2014 15:11:45 +0400 |
parents | abb466a57a22 |
children | 2c10db908b8c |
rev | line source |
---|---|
5121
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2 /* |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3 * Copyright (C) Nginx, Inc. |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
4 * Copyright (C) Valentin V. Bartenev |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
5 */ |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
6 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
7 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
8 #include <ngx_config.h> |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
9 #include <ngx_core.h> |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
10 #include <ngx_http.h> |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
11 #include <ngx_http_spdy_module.h> |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
12 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
13 #include <zlib.h> |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
14 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
15 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
16 #if (NGX_HAVE_LITTLE_ENDIAN && NGX_HAVE_NONALIGNED) |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
17 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
18 #define ngx_str5cmp(m, c0, c1, c2, c3, c4) \ |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
19 *(uint32_t *) m == (c3 << 24 | c2 << 16 | c1 << 8 | c0) \ |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
20 && m[4] == c4 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
21 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
22 #else |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
23 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
24 #define ngx_str5cmp(m, c0, c1, c2, c3, c4) \ |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
25 m[0] == c0 && m[1] == c1 && m[2] == c2 && m[3] == c3 && m[4] == c4 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
26 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
27 #endif |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
28 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
29 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
30 #if (NGX_HAVE_NONALIGNED) |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
31 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
32 #define ngx_spdy_frame_parse_uint16(p) ntohs(*(uint16_t *) (p)) |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
33 #define ngx_spdy_frame_parse_uint32(p) ntohl(*(uint32_t *) (p)) |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
34 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
35 #else |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
36 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
37 #define ngx_spdy_frame_parse_uint16(p) ((p)[0] << 8 | (p)[1]) |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
38 #define ngx_spdy_frame_parse_uint32(p) \ |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
39 ((p)[0] << 24 | (p)[1] << 16 | (p)[2] << 8 | (p)[3]) |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
40 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
41 #endif |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
42 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
43 #define ngx_spdy_frame_parse_sid(p) \ |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
44 (ngx_spdy_frame_parse_uint32(p) & 0x7fffffff) |
5549
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
45 #define ngx_spdy_frame_parse_delta(p) \ |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
46 (ngx_spdy_frame_parse_uint32(p) & 0x7fffffff) |
5121
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
47 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
48 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
49 #define ngx_spdy_ctl_frame_check(h) \ |
5643
436f3605195a
SPDY: consistently handle control frames with unknown type.
Valentin Bartenev <vbart@nginx.com>
parents:
5642
diff
changeset
|
50 (((h) & 0xffff0000) == ngx_spdy_ctl_frame_head(0)) |
5121
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
51 #define ngx_spdy_data_frame_check(h) \ |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
52 (!((h) & (uint32_t) NGX_SPDY_CTL_BIT << 31)) |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
53 |
5643
436f3605195a
SPDY: consistently handle control frames with unknown type.
Valentin Bartenev <vbart@nginx.com>
parents:
5642
diff
changeset
|
54 #define ngx_spdy_ctl_frame_type(h) ((h) & 0x0000ffff) |
5121
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
55 #define ngx_spdy_frame_flags(p) ((p) >> 24) |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
56 #define ngx_spdy_frame_length(p) ((p) & 0x00ffffff) |
5549
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
57 #define ngx_spdy_frame_id(p) ((p) & 0x00ffffff) |
5121
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
58 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
59 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
60 #define NGX_SPDY_SKIP_HEADERS_BUFFER_SIZE 4096 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
61 #define NGX_SPDY_CTL_FRAME_BUFFER_SIZE 16 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
62 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
63 #define NGX_SPDY_PROTOCOL_ERROR 1 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
64 #define NGX_SPDY_INVALID_STREAM 2 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
65 #define NGX_SPDY_REFUSED_STREAM 3 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
66 #define NGX_SPDY_UNSUPPORTED_VERSION 4 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
67 #define NGX_SPDY_CANCEL 5 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
68 #define NGX_SPDY_INTERNAL_ERROR 6 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
69 #define NGX_SPDY_FLOW_CONTROL_ERROR 7 |
5549
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
70 #define NGX_SPDY_STREAM_IN_USE 8 |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
71 #define NGX_SPDY_STREAM_ALREADY_CLOSED 9 |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
72 /* deprecated 10 */ |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
73 #define NGX_SPDY_FRAME_TOO_LARGE 11 |
5121
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
74 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
75 #define NGX_SPDY_SETTINGS_MAX_STREAMS 4 |
5549
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
76 #define NGX_SPDY_SETTINGS_INIT_WINDOW 7 |
5121
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
77 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
78 #define NGX_SPDY_SETTINGS_FLAG_PERSIST 0x01 |
5549
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
79 #define NGX_SPDY_SETTINGS_FLAG_PERSISTED 0x02 |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
80 |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
81 #define NGX_SPDY_MAX_WINDOW NGX_MAX_INT32_VALUE |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
82 #define NGX_SPDY_CONNECTION_WINDOW 65536 |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
83 #define NGX_SPDY_INIT_STREAM_WINDOW 65536 |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
84 #define NGX_SPDY_STREAM_WINDOW NGX_SPDY_MAX_WINDOW |
5121
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
85 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
86 typedef struct { |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
87 ngx_uint_t hash; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
88 u_char len; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
89 u_char header[7]; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
90 ngx_int_t (*handler)(ngx_http_request_t *r); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
91 } ngx_http_spdy_request_header_t; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
92 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
93 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
94 static void ngx_http_spdy_read_handler(ngx_event_t *rev); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
95 static void ngx_http_spdy_write_handler(ngx_event_t *wev); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
96 static void ngx_http_spdy_handle_connection(ngx_http_spdy_connection_t *sc); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
97 |
5605
3a72b1805c52
Added server-side support for PROXY protocol v1 (ticket #355).
Roman Arutyunyan <arut@nginx.com>
parents:
5590
diff
changeset
|
98 static u_char *ngx_http_spdy_proxy_protocol(ngx_http_spdy_connection_t *sc, |
3a72b1805c52
Added server-side support for PROXY protocol v1 (ticket #355).
Roman Arutyunyan <arut@nginx.com>
parents:
5590
diff
changeset
|
99 u_char *pos, u_char *end); |
5121
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
100 static u_char *ngx_http_spdy_state_head(ngx_http_spdy_connection_t *sc, |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
101 u_char *pos, u_char *end); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
102 static u_char *ngx_http_spdy_state_syn_stream(ngx_http_spdy_connection_t *sc, |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
103 u_char *pos, u_char *end); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
104 static u_char *ngx_http_spdy_state_headers(ngx_http_spdy_connection_t *sc, |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
105 u_char *pos, u_char *end); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
106 static u_char *ngx_http_spdy_state_headers_skip(ngx_http_spdy_connection_t *sc, |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
107 u_char *pos, u_char *end); |
5691
31349361558e
SPDY: ngx_http_spdy_state_headers() error handling cleanup.
Valentin Bartenev <vbart@nginx.com>
parents:
5690
diff
changeset
|
108 static u_char *ngx_http_spdy_state_headers_error(ngx_http_spdy_connection_t *sc, |
31349361558e
SPDY: ngx_http_spdy_state_headers() error handling cleanup.
Valentin Bartenev <vbart@nginx.com>
parents:
5690
diff
changeset
|
109 u_char *pos, u_char *end); |
5549
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
110 static u_char *ngx_http_spdy_state_window_update(ngx_http_spdy_connection_t *sc, |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
111 u_char *pos, u_char *end); |
5121
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
112 static u_char *ngx_http_spdy_state_data(ngx_http_spdy_connection_t *sc, |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
113 u_char *pos, u_char *end); |
5549
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
114 static u_char *ngx_http_spdy_state_read_data(ngx_http_spdy_connection_t *sc, |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
115 u_char *pos, u_char *end); |
5121
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
116 static u_char *ngx_http_spdy_state_rst_stream(ngx_http_spdy_connection_t *sc, |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
117 u_char *pos, u_char *end); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
118 static u_char *ngx_http_spdy_state_ping(ngx_http_spdy_connection_t *sc, |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
119 u_char *pos, u_char *end); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
120 static u_char *ngx_http_spdy_state_skip(ngx_http_spdy_connection_t *sc, |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
121 u_char *pos, u_char *end); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
122 static u_char *ngx_http_spdy_state_settings(ngx_http_spdy_connection_t *sc, |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
123 u_char *pos, u_char *end); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
124 static u_char *ngx_http_spdy_state_complete(ngx_http_spdy_connection_t *sc, |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
125 u_char *pos, u_char *end); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
126 static u_char *ngx_http_spdy_state_save(ngx_http_spdy_connection_t *sc, |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
127 u_char *pos, u_char *end, ngx_http_spdy_handler_pt handler); |
5690
fb56f5d612a0
SPDY: improved error handling of header block decompression.
Valentin Bartenev <vbart@nginx.com>
parents:
5689
diff
changeset
|
128 |
fb56f5d612a0
SPDY: improved error handling of header block decompression.
Valentin Bartenev <vbart@nginx.com>
parents:
5689
diff
changeset
|
129 static u_char *ngx_http_spdy_state_inflate_error( |
fb56f5d612a0
SPDY: improved error handling of header block decompression.
Valentin Bartenev <vbart@nginx.com>
parents:
5689
diff
changeset
|
130 ngx_http_spdy_connection_t *sc, int rc); |
5121
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
131 static u_char *ngx_http_spdy_state_protocol_error( |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
132 ngx_http_spdy_connection_t *sc); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
133 static u_char *ngx_http_spdy_state_internal_error( |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
134 ngx_http_spdy_connection_t *sc); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
135 |
5549
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
136 static ngx_int_t ngx_http_spdy_send_window_update( |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
137 ngx_http_spdy_connection_t *sc, ngx_uint_t sid, ngx_uint_t delta); |
5121
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
138 static ngx_int_t ngx_http_spdy_send_rst_stream(ngx_http_spdy_connection_t *sc, |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
139 ngx_uint_t sid, ngx_uint_t status, ngx_uint_t priority); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
140 static ngx_int_t ngx_http_spdy_send_settings(ngx_http_spdy_connection_t *sc); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
141 static ngx_int_t ngx_http_spdy_settings_frame_handler( |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
142 ngx_http_spdy_connection_t *sc, ngx_http_spdy_out_frame_t *frame); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
143 static ngx_http_spdy_out_frame_t *ngx_http_spdy_get_ctl_frame( |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
144 ngx_http_spdy_connection_t *sc, size_t size, ngx_uint_t priority); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
145 static ngx_int_t ngx_http_spdy_ctl_frame_handler( |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
146 ngx_http_spdy_connection_t *sc, ngx_http_spdy_out_frame_t *frame); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
147 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
148 static ngx_http_spdy_stream_t *ngx_http_spdy_create_stream( |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
149 ngx_http_spdy_connection_t *sc, ngx_uint_t id, ngx_uint_t priority); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
150 static ngx_http_spdy_stream_t *ngx_http_spdy_get_stream_by_id( |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
151 ngx_http_spdy_connection_t *sc, ngx_uint_t sid); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
152 #define ngx_http_spdy_streams_index_size(sscf) (sscf->streams_index_mask + 1) |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
153 #define ngx_http_spdy_stream_index(sscf, sid) \ |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
154 ((sid >> 1) & sscf->streams_index_mask) |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
155 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
156 static ngx_int_t ngx_http_spdy_parse_header(ngx_http_request_t *r); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
157 static ngx_int_t ngx_http_spdy_alloc_large_header_buffer(ngx_http_request_t *r); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
158 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
159 static ngx_int_t ngx_http_spdy_handle_request_header(ngx_http_request_t *r); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
160 static ngx_int_t ngx_http_spdy_parse_method(ngx_http_request_t *r); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
161 static ngx_int_t ngx_http_spdy_parse_scheme(ngx_http_request_t *r); |
5549
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
162 static ngx_int_t ngx_http_spdy_parse_host(ngx_http_request_t *r); |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
163 static ngx_int_t ngx_http_spdy_parse_path(ngx_http_request_t *r); |
5121
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
164 static ngx_int_t ngx_http_spdy_parse_version(ngx_http_request_t *r); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
165 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
166 static ngx_int_t ngx_http_spdy_construct_request_line(ngx_http_request_t *r); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
167 static void ngx_http_spdy_run_request(ngx_http_request_t *r); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
168 static ngx_int_t ngx_http_spdy_init_request_body(ngx_http_request_t *r); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
169 |
5549
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
170 static ngx_int_t ngx_http_spdy_terminate_stream(ngx_http_spdy_connection_t *sc, |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
171 ngx_http_spdy_stream_t *stream, ngx_uint_t status); |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
172 |
5403
7e062646da6f
SPDY: fixed connection leak while waiting for request headers.
Valentin Bartenev <vbart@nginx.com>
parents:
5402
diff
changeset
|
173 static void ngx_http_spdy_close_stream_handler(ngx_event_t *ev); |
7e062646da6f
SPDY: fixed connection leak while waiting for request headers.
Valentin Bartenev <vbart@nginx.com>
parents:
5402
diff
changeset
|
174 |
5121
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
175 static void ngx_http_spdy_handle_connection_handler(ngx_event_t *rev); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
176 static void ngx_http_spdy_keepalive_handler(ngx_event_t *rev); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
177 static void ngx_http_spdy_finalize_connection(ngx_http_spdy_connection_t *sc, |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
178 ngx_int_t rc); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
179 |
5549
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
180 static ngx_int_t ngx_http_spdy_adjust_windows(ngx_http_spdy_connection_t *sc, |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
181 ssize_t delta); |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
182 |
5121
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
183 static void ngx_http_spdy_pool_cleanup(void *data); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
184 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
185 static void *ngx_http_spdy_zalloc(void *opaque, u_int items, u_int size); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
186 static void ngx_http_spdy_zfree(void *opaque, void *address); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
187 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
188 |
5549
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
189 static const u_char ngx_http_spdy_dict[] = { |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
190 0x00, 0x00, 0x00, 0x07, 0x6f, 0x70, 0x74, 0x69, /* - - - - o p t i */ |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
191 0x6f, 0x6e, 0x73, 0x00, 0x00, 0x00, 0x04, 0x68, /* o n s - - - - h */ |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
192 0x65, 0x61, 0x64, 0x00, 0x00, 0x00, 0x04, 0x70, /* e a d - - - - p */ |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
193 0x6f, 0x73, 0x74, 0x00, 0x00, 0x00, 0x03, 0x70, /* o s t - - - - p */ |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
194 0x75, 0x74, 0x00, 0x00, 0x00, 0x06, 0x64, 0x65, /* u t - - - - d e */ |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
195 0x6c, 0x65, 0x74, 0x65, 0x00, 0x00, 0x00, 0x05, /* l e t e - - - - */ |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
196 0x74, 0x72, 0x61, 0x63, 0x65, 0x00, 0x00, 0x00, /* t r a c e - - - */ |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
197 0x06, 0x61, 0x63, 0x63, 0x65, 0x70, 0x74, 0x00, /* - a c c e p t - */ |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
198 0x00, 0x00, 0x0e, 0x61, 0x63, 0x63, 0x65, 0x70, /* - - - a c c e p */ |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
199 0x74, 0x2d, 0x63, 0x68, 0x61, 0x72, 0x73, 0x65, /* t - c h a r s e */ |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
200 0x74, 0x00, 0x00, 0x00, 0x0f, 0x61, 0x63, 0x63, /* t - - - - a c c */ |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
201 0x65, 0x70, 0x74, 0x2d, 0x65, 0x6e, 0x63, 0x6f, /* e p t - e n c o */ |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
202 0x64, 0x69, 0x6e, 0x67, 0x00, 0x00, 0x00, 0x0f, /* d i n g - - - - */ |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
203 0x61, 0x63, 0x63, 0x65, 0x70, 0x74, 0x2d, 0x6c, /* a c c e p t - l */ |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
204 0x61, 0x6e, 0x67, 0x75, 0x61, 0x67, 0x65, 0x00, /* a n g u a g e - */ |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
205 0x00, 0x00, 0x0d, 0x61, 0x63, 0x63, 0x65, 0x70, /* - - - a c c e p */ |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
206 0x74, 0x2d, 0x72, 0x61, 0x6e, 0x67, 0x65, 0x73, /* t - r a n g e s */ |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
207 0x00, 0x00, 0x00, 0x03, 0x61, 0x67, 0x65, 0x00, /* - - - - a g e - */ |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
208 0x00, 0x00, 0x05, 0x61, 0x6c, 0x6c, 0x6f, 0x77, /* - - - a l l o w */ |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
209 0x00, 0x00, 0x00, 0x0d, 0x61, 0x75, 0x74, 0x68, /* - - - - a u t h */ |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
210 0x6f, 0x72, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, /* o r i z a t i o */ |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
211 0x6e, 0x00, 0x00, 0x00, 0x0d, 0x63, 0x61, 0x63, /* n - - - - c a c */ |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
212 0x68, 0x65, 0x2d, 0x63, 0x6f, 0x6e, 0x74, 0x72, /* h e - c o n t r */ |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
213 0x6f, 0x6c, 0x00, 0x00, 0x00, 0x0a, 0x63, 0x6f, /* o l - - - - c o */ |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
214 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, /* n n e c t i o n */ |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
215 0x00, 0x00, 0x00, 0x0c, 0x63, 0x6f, 0x6e, 0x74, /* - - - - c o n t */ |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
216 0x65, 0x6e, 0x74, 0x2d, 0x62, 0x61, 0x73, 0x65, /* e n t - b a s e */ |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
217 0x00, 0x00, 0x00, 0x10, 0x63, 0x6f, 0x6e, 0x74, /* - - - - c o n t */ |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
218 0x65, 0x6e, 0x74, 0x2d, 0x65, 0x6e, 0x63, 0x6f, /* e n t - e n c o */ |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
219 0x64, 0x69, 0x6e, 0x67, 0x00, 0x00, 0x00, 0x10, /* d i n g - - - - */ |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
220 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x2d, /* c o n t e n t - */ |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
221 0x6c, 0x61, 0x6e, 0x67, 0x75, 0x61, 0x67, 0x65, /* l a n g u a g e */ |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
222 0x00, 0x00, 0x00, 0x0e, 0x63, 0x6f, 0x6e, 0x74, /* - - - - c o n t */ |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
223 0x65, 0x6e, 0x74, 0x2d, 0x6c, 0x65, 0x6e, 0x67, /* e n t - l e n g */ |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
224 0x74, 0x68, 0x00, 0x00, 0x00, 0x10, 0x63, 0x6f, /* t h - - - - c o */ |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
225 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x2d, 0x6c, 0x6f, /* n t e n t - l o */ |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
226 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x00, 0x00, /* c a t i o n - - */ |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
227 0x00, 0x0b, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, /* - - c o n t e n */ |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
228 0x74, 0x2d, 0x6d, 0x64, 0x35, 0x00, 0x00, 0x00, /* t - m d 5 - - - */ |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
229 0x0d, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, /* - c o n t e n t */ |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
230 0x2d, 0x72, 0x61, 0x6e, 0x67, 0x65, 0x00, 0x00, /* - r a n g e - - */ |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
231 0x00, 0x0c, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, /* - - c o n t e n */ |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
232 0x74, 0x2d, 0x74, 0x79, 0x70, 0x65, 0x00, 0x00, /* t - t y p e - - */ |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
233 0x00, 0x04, 0x64, 0x61, 0x74, 0x65, 0x00, 0x00, /* - - d a t e - - */ |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
234 0x00, 0x04, 0x65, 0x74, 0x61, 0x67, 0x00, 0x00, /* - - e t a g - - */ |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
235 0x00, 0x06, 0x65, 0x78, 0x70, 0x65, 0x63, 0x74, /* - - e x p e c t */ |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
236 0x00, 0x00, 0x00, 0x07, 0x65, 0x78, 0x70, 0x69, /* - - - - e x p i */ |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
237 0x72, 0x65, 0x73, 0x00, 0x00, 0x00, 0x04, 0x66, /* r e s - - - - f */ |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
238 0x72, 0x6f, 0x6d, 0x00, 0x00, 0x00, 0x04, 0x68, /* r o m - - - - h */ |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
239 0x6f, 0x73, 0x74, 0x00, 0x00, 0x00, 0x08, 0x69, /* o s t - - - - i */ |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
240 0x66, 0x2d, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x00, /* f - m a t c h - */ |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
241 0x00, 0x00, 0x11, 0x69, 0x66, 0x2d, 0x6d, 0x6f, /* - - - i f - m o */ |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
242 0x64, 0x69, 0x66, 0x69, 0x65, 0x64, 0x2d, 0x73, /* d i f i e d - s */ |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
243 0x69, 0x6e, 0x63, 0x65, 0x00, 0x00, 0x00, 0x0d, /* i n c e - - - - */ |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
244 0x69, 0x66, 0x2d, 0x6e, 0x6f, 0x6e, 0x65, 0x2d, /* i f - n o n e - */ |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
245 0x6d, 0x61, 0x74, 0x63, 0x68, 0x00, 0x00, 0x00, /* m a t c h - - - */ |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
246 0x08, 0x69, 0x66, 0x2d, 0x72, 0x61, 0x6e, 0x67, /* - i f - r a n g */ |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
247 0x65, 0x00, 0x00, 0x00, 0x13, 0x69, 0x66, 0x2d, /* e - - - - i f - */ |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
248 0x75, 0x6e, 0x6d, 0x6f, 0x64, 0x69, 0x66, 0x69, /* u n m o d i f i */ |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
249 0x65, 0x64, 0x2d, 0x73, 0x69, 0x6e, 0x63, 0x65, /* e d - s i n c e */ |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
250 0x00, 0x00, 0x00, 0x0d, 0x6c, 0x61, 0x73, 0x74, /* - - - - l a s t */ |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
251 0x2d, 0x6d, 0x6f, 0x64, 0x69, 0x66, 0x69, 0x65, /* - m o d i f i e */ |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
252 0x64, 0x00, 0x00, 0x00, 0x08, 0x6c, 0x6f, 0x63, /* d - - - - l o c */ |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
253 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x00, 0x00, 0x00, /* a t i o n - - - */ |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
254 0x0c, 0x6d, 0x61, 0x78, 0x2d, 0x66, 0x6f, 0x72, /* - m a x - f o r */ |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
255 0x77, 0x61, 0x72, 0x64, 0x73, 0x00, 0x00, 0x00, /* w a r d s - - - */ |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
256 0x06, 0x70, 0x72, 0x61, 0x67, 0x6d, 0x61, 0x00, /* - p r a g m a - */ |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
257 0x00, 0x00, 0x12, 0x70, 0x72, 0x6f, 0x78, 0x79, /* - - - p r o x y */ |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
258 0x2d, 0x61, 0x75, 0x74, 0x68, 0x65, 0x6e, 0x74, /* - a u t h e n t */ |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
259 0x69, 0x63, 0x61, 0x74, 0x65, 0x00, 0x00, 0x00, /* i c a t e - - - */ |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
260 0x13, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2d, 0x61, /* - p r o x y - a */ |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
261 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x61, /* u t h o r i z a */ |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
262 0x74, 0x69, 0x6f, 0x6e, 0x00, 0x00, 0x00, 0x05, /* t i o n - - - - */ |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
263 0x72, 0x61, 0x6e, 0x67, 0x65, 0x00, 0x00, 0x00, /* r a n g e - - - */ |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
264 0x07, 0x72, 0x65, 0x66, 0x65, 0x72, 0x65, 0x72, /* - r e f e r e r */ |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
265 0x00, 0x00, 0x00, 0x0b, 0x72, 0x65, 0x74, 0x72, /* - - - - r e t r */ |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
266 0x79, 0x2d, 0x61, 0x66, 0x74, 0x65, 0x72, 0x00, /* y - a f t e r - */ |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
267 0x00, 0x00, 0x06, 0x73, 0x65, 0x72, 0x76, 0x65, /* - - - s e r v e */ |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
268 0x72, 0x00, 0x00, 0x00, 0x02, 0x74, 0x65, 0x00, /* r - - - - t e - */ |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
269 0x00, 0x00, 0x07, 0x74, 0x72, 0x61, 0x69, 0x6c, /* - - - t r a i l */ |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
270 0x65, 0x72, 0x00, 0x00, 0x00, 0x11, 0x74, 0x72, /* e r - - - - t r */ |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
271 0x61, 0x6e, 0x73, 0x66, 0x65, 0x72, 0x2d, 0x65, /* a n s f e r - e */ |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
272 0x6e, 0x63, 0x6f, 0x64, 0x69, 0x6e, 0x67, 0x00, /* n c o d i n g - */ |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
273 0x00, 0x00, 0x07, 0x75, 0x70, 0x67, 0x72, 0x61, /* - - - u p g r a */ |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
274 0x64, 0x65, 0x00, 0x00, 0x00, 0x0a, 0x75, 0x73, /* d e - - - - u s */ |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
275 0x65, 0x72, 0x2d, 0x61, 0x67, 0x65, 0x6e, 0x74, /* e r - a g e n t */ |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
276 0x00, 0x00, 0x00, 0x04, 0x76, 0x61, 0x72, 0x79, /* - - - - v a r y */ |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
277 0x00, 0x00, 0x00, 0x03, 0x76, 0x69, 0x61, 0x00, /* - - - - v i a - */ |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
278 0x00, 0x00, 0x07, 0x77, 0x61, 0x72, 0x6e, 0x69, /* - - - w a r n i */ |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
279 0x6e, 0x67, 0x00, 0x00, 0x00, 0x10, 0x77, 0x77, /* n g - - - - w w */ |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
280 0x77, 0x2d, 0x61, 0x75, 0x74, 0x68, 0x65, 0x6e, /* w - a u t h e n */ |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
281 0x74, 0x69, 0x63, 0x61, 0x74, 0x65, 0x00, 0x00, /* t i c a t e - - */ |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
282 0x00, 0x06, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, /* - - m e t h o d */ |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
283 0x00, 0x00, 0x00, 0x03, 0x67, 0x65, 0x74, 0x00, /* - - - - g e t - */ |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
284 0x00, 0x00, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, /* - - - s t a t u */ |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
285 0x73, 0x00, 0x00, 0x00, 0x06, 0x32, 0x30, 0x30, /* s - - - - 2 0 0 */ |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
286 0x20, 0x4f, 0x4b, 0x00, 0x00, 0x00, 0x07, 0x76, /* - O K - - - - v */ |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
287 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x00, 0x00, /* e r s i o n - - */ |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
288 0x00, 0x08, 0x48, 0x54, 0x54, 0x50, 0x2f, 0x31, /* - - H T T P - 1 */ |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
289 0x2e, 0x31, 0x00, 0x00, 0x00, 0x03, 0x75, 0x72, /* - 1 - - - - u r */ |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
290 0x6c, 0x00, 0x00, 0x00, 0x06, 0x70, 0x75, 0x62, /* l - - - - p u b */ |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
291 0x6c, 0x69, 0x63, 0x00, 0x00, 0x00, 0x0a, 0x73, /* l i c - - - - s */ |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
292 0x65, 0x74, 0x2d, 0x63, 0x6f, 0x6f, 0x6b, 0x69, /* e t - c o o k i */ |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
293 0x65, 0x00, 0x00, 0x00, 0x0a, 0x6b, 0x65, 0x65, /* e - - - - k e e */ |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
294 0x70, 0x2d, 0x61, 0x6c, 0x69, 0x76, 0x65, 0x00, /* p - a l i v e - */ |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
295 0x00, 0x00, 0x06, 0x6f, 0x72, 0x69, 0x67, 0x69, /* - - - o r i g i */ |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
296 0x6e, 0x31, 0x30, 0x30, 0x31, 0x30, 0x31, 0x32, /* n 1 0 0 1 0 1 2 */ |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
297 0x30, 0x31, 0x32, 0x30, 0x32, 0x32, 0x30, 0x35, /* 0 1 2 0 2 2 0 5 */ |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
298 0x32, 0x30, 0x36, 0x33, 0x30, 0x30, 0x33, 0x30, /* 2 0 6 3 0 0 3 0 */ |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
299 0x32, 0x33, 0x30, 0x33, 0x33, 0x30, 0x34, 0x33, /* 2 3 0 3 3 0 4 3 */ |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
300 0x30, 0x35, 0x33, 0x30, 0x36, 0x33, 0x30, 0x37, /* 0 5 3 0 6 3 0 7 */ |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
301 0x34, 0x30, 0x32, 0x34, 0x30, 0x35, 0x34, 0x30, /* 4 0 2 4 0 5 4 0 */ |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
302 0x36, 0x34, 0x30, 0x37, 0x34, 0x30, 0x38, 0x34, /* 6 4 0 7 4 0 8 4 */ |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
303 0x30, 0x39, 0x34, 0x31, 0x30, 0x34, 0x31, 0x31, /* 0 9 4 1 0 4 1 1 */ |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
304 0x34, 0x31, 0x32, 0x34, 0x31, 0x33, 0x34, 0x31, /* 4 1 2 4 1 3 4 1 */ |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
305 0x34, 0x34, 0x31, 0x35, 0x34, 0x31, 0x36, 0x34, /* 4 4 1 5 4 1 6 4 */ |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
306 0x31, 0x37, 0x35, 0x30, 0x32, 0x35, 0x30, 0x34, /* 1 7 5 0 2 5 0 4 */ |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
307 0x35, 0x30, 0x35, 0x32, 0x30, 0x33, 0x20, 0x4e, /* 5 0 5 2 0 3 - N */ |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
308 0x6f, 0x6e, 0x2d, 0x41, 0x75, 0x74, 0x68, 0x6f, /* o n - A u t h o */ |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
309 0x72, 0x69, 0x74, 0x61, 0x74, 0x69, 0x76, 0x65, /* r i t a t i v e */ |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
310 0x20, 0x49, 0x6e, 0x66, 0x6f, 0x72, 0x6d, 0x61, /* - I n f o r m a */ |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
311 0x74, 0x69, 0x6f, 0x6e, 0x32, 0x30, 0x34, 0x20, /* t i o n 2 0 4 - */ |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
312 0x4e, 0x6f, 0x20, 0x43, 0x6f, 0x6e, 0x74, 0x65, /* N o - C o n t e */ |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
313 0x6e, 0x74, 0x33, 0x30, 0x31, 0x20, 0x4d, 0x6f, /* n t 3 0 1 - M o */ |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
314 0x76, 0x65, 0x64, 0x20, 0x50, 0x65, 0x72, 0x6d, /* v e d - P e r m */ |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
315 0x61, 0x6e, 0x65, 0x6e, 0x74, 0x6c, 0x79, 0x34, /* a n e n t l y 4 */ |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
316 0x30, 0x30, 0x20, 0x42, 0x61, 0x64, 0x20, 0x52, /* 0 0 - B a d - R */ |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
317 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x34, 0x30, /* e q u e s t 4 0 */ |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
318 0x31, 0x20, 0x55, 0x6e, 0x61, 0x75, 0x74, 0x68, /* 1 - U n a u t h */ |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
319 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x64, 0x34, 0x30, /* o r i z e d 4 0 */ |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
320 0x33, 0x20, 0x46, 0x6f, 0x72, 0x62, 0x69, 0x64, /* 3 - F o r b i d */ |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
321 0x64, 0x65, 0x6e, 0x34, 0x30, 0x34, 0x20, 0x4e, /* d e n 4 0 4 - N */ |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
322 0x6f, 0x74, 0x20, 0x46, 0x6f, 0x75, 0x6e, 0x64, /* o t - F o u n d */ |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
323 0x35, 0x30, 0x30, 0x20, 0x49, 0x6e, 0x74, 0x65, /* 5 0 0 - I n t e */ |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
324 0x72, 0x6e, 0x61, 0x6c, 0x20, 0x53, 0x65, 0x72, /* r n a l - S e r */ |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
325 0x76, 0x65, 0x72, 0x20, 0x45, 0x72, 0x72, 0x6f, /* v e r - E r r o */ |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
326 0x72, 0x35, 0x30, 0x31, 0x20, 0x4e, 0x6f, 0x74, /* r 5 0 1 - N o t */ |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
327 0x20, 0x49, 0x6d, 0x70, 0x6c, 0x65, 0x6d, 0x65, /* - I m p l e m e */ |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
328 0x6e, 0x74, 0x65, 0x64, 0x35, 0x30, 0x33, 0x20, /* n t e d 5 0 3 - */ |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
329 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x20, /* S e r v i c e - */ |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
330 0x55, 0x6e, 0x61, 0x76, 0x61, 0x69, 0x6c, 0x61, /* U n a v a i l a */ |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
331 0x62, 0x6c, 0x65, 0x4a, 0x61, 0x6e, 0x20, 0x46, /* b l e J a n - F */ |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
332 0x65, 0x62, 0x20, 0x4d, 0x61, 0x72, 0x20, 0x41, /* e b - M a r - A */ |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
333 0x70, 0x72, 0x20, 0x4d, 0x61, 0x79, 0x20, 0x4a, /* p r - M a y - J */ |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
334 0x75, 0x6e, 0x20, 0x4a, 0x75, 0x6c, 0x20, 0x41, /* u n - J u l - A */ |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
335 0x75, 0x67, 0x20, 0x53, 0x65, 0x70, 0x74, 0x20, /* u g - S e p t - */ |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
336 0x4f, 0x63, 0x74, 0x20, 0x4e, 0x6f, 0x76, 0x20, /* O c t - N o v - */ |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
337 0x44, 0x65, 0x63, 0x20, 0x30, 0x30, 0x3a, 0x30, /* D e c - 0 0 - 0 */ |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
338 0x30, 0x3a, 0x30, 0x30, 0x20, 0x4d, 0x6f, 0x6e, /* 0 - 0 0 - M o n */ |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
339 0x2c, 0x20, 0x54, 0x75, 0x65, 0x2c, 0x20, 0x57, /* - - T u e - - W */ |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
340 0x65, 0x64, 0x2c, 0x20, 0x54, 0x68, 0x75, 0x2c, /* e d - - T h u - */ |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
341 0x20, 0x46, 0x72, 0x69, 0x2c, 0x20, 0x53, 0x61, /* - F r i - - S a */ |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
342 0x74, 0x2c, 0x20, 0x53, 0x75, 0x6e, 0x2c, 0x20, /* t - - S u n - - */ |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
343 0x47, 0x4d, 0x54, 0x63, 0x68, 0x75, 0x6e, 0x6b, /* G M T c h u n k */ |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
344 0x65, 0x64, 0x2c, 0x74, 0x65, 0x78, 0x74, 0x2f, /* e d - t e x t - */ |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
345 0x68, 0x74, 0x6d, 0x6c, 0x2c, 0x69, 0x6d, 0x61, /* h t m l - i m a */ |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
346 0x67, 0x65, 0x2f, 0x70, 0x6e, 0x67, 0x2c, 0x69, /* g e - p n g - i */ |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
347 0x6d, 0x61, 0x67, 0x65, 0x2f, 0x6a, 0x70, 0x67, /* m a g e - j p g */ |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
348 0x2c, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x2f, 0x67, /* - i m a g e - g */ |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
349 0x69, 0x66, 0x2c, 0x61, 0x70, 0x70, 0x6c, 0x69, /* i f - a p p l i */ |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
350 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x78, /* c a t i o n - x */ |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
351 0x6d, 0x6c, 0x2c, 0x61, 0x70, 0x70, 0x6c, 0x69, /* m l - a p p l i */ |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
352 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x78, /* c a t i o n - x */ |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
353 0x68, 0x74, 0x6d, 0x6c, 0x2b, 0x78, 0x6d, 0x6c, /* h t m l - x m l */ |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
354 0x2c, 0x74, 0x65, 0x78, 0x74, 0x2f, 0x70, 0x6c, /* - t e x t - p l */ |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
355 0x61, 0x69, 0x6e, 0x2c, 0x74, 0x65, 0x78, 0x74, /* a i n - t e x t */ |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
356 0x2f, 0x6a, 0x61, 0x76, 0x61, 0x73, 0x63, 0x72, /* - j a v a s c r */ |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
357 0x69, 0x70, 0x74, 0x2c, 0x70, 0x75, 0x62, 0x6c, /* i p t - p u b l */ |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
358 0x69, 0x63, 0x70, 0x72, 0x69, 0x76, 0x61, 0x74, /* i c p r i v a t */ |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
359 0x65, 0x6d, 0x61, 0x78, 0x2d, 0x61, 0x67, 0x65, /* e m a x - a g e */ |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
360 0x3d, 0x67, 0x7a, 0x69, 0x70, 0x2c, 0x64, 0x65, /* - g z i p - d e */ |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
361 0x66, 0x6c, 0x61, 0x74, 0x65, 0x2c, 0x73, 0x64, /* f l a t e - s d */ |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
362 0x63, 0x68, 0x63, 0x68, 0x61, 0x72, 0x73, 0x65, /* c h c h a r s e */ |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
363 0x74, 0x3d, 0x75, 0x74, 0x66, 0x2d, 0x38, 0x63, /* t - u t f - 8 c */ |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
364 0x68, 0x61, 0x72, 0x73, 0x65, 0x74, 0x3d, 0x69, /* h a r s e t - i */ |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
365 0x73, 0x6f, 0x2d, 0x38, 0x38, 0x35, 0x39, 0x2d, /* s o - 8 8 5 9 - */ |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
366 0x31, 0x2c, 0x75, 0x74, 0x66, 0x2d, 0x2c, 0x2a, /* 1 - u t f - - - */ |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
367 0x2c, 0x65, 0x6e, 0x71, 0x3d, 0x30, 0x2e /* - e n q - 0 - */ |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
368 }; |
5121
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
369 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
370 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
371 static ngx_http_spdy_request_header_t ngx_http_spdy_request_headers[] = { |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
372 { 0, 6, "method", ngx_http_spdy_parse_method }, |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
373 { 0, 6, "scheme", ngx_http_spdy_parse_scheme }, |
5549
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
374 { 0, 4, "host", ngx_http_spdy_parse_host }, |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
375 { 0, 4, "path", ngx_http_spdy_parse_path }, |
5121
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
376 { 0, 7, "version", ngx_http_spdy_parse_version }, |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
377 }; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
378 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
379 #define NGX_SPDY_REQUEST_HEADERS \ |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
380 (sizeof(ngx_http_spdy_request_headers) \ |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
381 / sizeof(ngx_http_spdy_request_header_t)) |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
382 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
383 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
384 void |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
385 ngx_http_spdy_init(ngx_event_t *rev) |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
386 { |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
387 int rc; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
388 ngx_connection_t *c; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
389 ngx_pool_cleanup_t *cln; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
390 ngx_http_connection_t *hc; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
391 ngx_http_spdy_srv_conf_t *sscf; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
392 ngx_http_spdy_main_conf_t *smcf; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
393 ngx_http_spdy_connection_t *sc; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
394 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
395 c = rev->data; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
396 hc = c->data; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
397 |
5693
701d6e17e42c
SPDY: improved logging.
Valentin Bartenev <vbart@nginx.com>
parents:
5692
diff
changeset
|
398 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, c->log, 0, "init spdy request"); |
5121
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
399 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
400 c->log->action = "processing SPDY"; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
401 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
402 smcf = ngx_http_get_module_main_conf(hc->conf_ctx, ngx_http_spdy_module); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
403 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
404 if (smcf->recv_buffer == NULL) { |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
405 smcf->recv_buffer = ngx_palloc(ngx_cycle->pool, smcf->recv_buffer_size); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
406 if (smcf->recv_buffer == NULL) { |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
407 ngx_http_close_connection(c); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
408 return; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
409 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
410 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
411 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
412 sc = ngx_pcalloc(c->pool, sizeof(ngx_http_spdy_connection_t)); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
413 if (sc == NULL) { |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
414 ngx_http_close_connection(c); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
415 return; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
416 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
417 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
418 sc->connection = c; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
419 sc->http_connection = hc; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
420 |
5549
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
421 sc->send_window = NGX_SPDY_CONNECTION_WINDOW; |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
422 sc->recv_window = NGX_SPDY_CONNECTION_WINDOW; |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
423 |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
424 sc->init_window = NGX_SPDY_INIT_STREAM_WINDOW; |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
425 |
5692
ed5fb7d22d46
SPDY: set log action for PROXY protocol only while parsing it.
Valentin Bartenev <vbart@nginx.com>
parents:
5691
diff
changeset
|
426 sc->handler = hc->proxy_protocol ? ngx_http_spdy_proxy_protocol |
ed5fb7d22d46
SPDY: set log action for PROXY protocol only while parsing it.
Valentin Bartenev <vbart@nginx.com>
parents:
5691
diff
changeset
|
427 : ngx_http_spdy_state_head; |
5605
3a72b1805c52
Added server-side support for PROXY protocol v1 (ticket #355).
Roman Arutyunyan <arut@nginx.com>
parents:
5590
diff
changeset
|
428 |
5121
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
429 sc->zstream_in.zalloc = ngx_http_spdy_zalloc; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
430 sc->zstream_in.zfree = ngx_http_spdy_zfree; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
431 sc->zstream_in.opaque = sc; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
432 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
433 rc = inflateInit(&sc->zstream_in); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
434 if (rc != Z_OK) { |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
435 ngx_log_error(NGX_LOG_ALERT, c->log, 0, |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
436 "inflateInit() failed: %d", rc); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
437 ngx_http_close_connection(c); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
438 return; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
439 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
440 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
441 sc->zstream_out.zalloc = ngx_http_spdy_zalloc; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
442 sc->zstream_out.zfree = ngx_http_spdy_zfree; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
443 sc->zstream_out.opaque = sc; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
444 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
445 sscf = ngx_http_get_module_srv_conf(hc->conf_ctx, ngx_http_spdy_module); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
446 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
447 rc = deflateInit2(&sc->zstream_out, (int) sscf->headers_comp, |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
448 Z_DEFLATED, 11, 4, Z_DEFAULT_STRATEGY); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
449 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
450 if (rc != Z_OK) { |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
451 ngx_log_error(NGX_LOG_ALERT, c->log, 0, |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
452 "deflateInit2() failed: %d", rc); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
453 ngx_http_close_connection(c); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
454 return; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
455 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
456 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
457 rc = deflateSetDictionary(&sc->zstream_out, ngx_http_spdy_dict, |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
458 sizeof(ngx_http_spdy_dict)); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
459 if (rc != Z_OK) { |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
460 ngx_log_error(NGX_LOG_ALERT, c->log, 0, |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
461 "deflateSetDictionary() failed: %d", rc); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
462 ngx_http_close_connection(c); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
463 return; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
464 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
465 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
466 sc->pool = ngx_create_pool(sscf->pool_size, sc->connection->log); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
467 if (sc->pool == NULL) { |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
468 ngx_http_close_connection(c); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
469 return; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
470 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
471 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
472 cln = ngx_pool_cleanup_add(c->pool, sizeof(ngx_pool_cleanup_file_t)); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
473 if (cln == NULL) { |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
474 ngx_http_close_connection(c); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
475 return; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
476 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
477 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
478 cln->handler = ngx_http_spdy_pool_cleanup; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
479 cln->data = sc; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
480 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
481 sc->streams_index = ngx_pcalloc(sc->pool, |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
482 ngx_http_spdy_streams_index_size(sscf) |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
483 * sizeof(ngx_http_spdy_stream_t *)); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
484 if (sc->streams_index == NULL) { |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
485 ngx_http_close_connection(c); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
486 return; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
487 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
488 |
5526
2c6f82c0cec2
SPDY: removed state to check first SETTINGS frame.
Valentin Bartenev <vbart@nginx.com>
parents:
5525
diff
changeset
|
489 if (ngx_http_spdy_send_settings(sc) == NGX_ERROR) { |
2c6f82c0cec2
SPDY: removed state to check first SETTINGS frame.
Valentin Bartenev <vbart@nginx.com>
parents:
5525
diff
changeset
|
490 ngx_http_close_connection(c); |
2c6f82c0cec2
SPDY: removed state to check first SETTINGS frame.
Valentin Bartenev <vbart@nginx.com>
parents:
5525
diff
changeset
|
491 return; |
2c6f82c0cec2
SPDY: removed state to check first SETTINGS frame.
Valentin Bartenev <vbart@nginx.com>
parents:
5525
diff
changeset
|
492 } |
2c6f82c0cec2
SPDY: removed state to check first SETTINGS frame.
Valentin Bartenev <vbart@nginx.com>
parents:
5525
diff
changeset
|
493 |
5549
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
494 if (ngx_http_spdy_send_window_update(sc, 0, NGX_SPDY_MAX_WINDOW |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
495 - sc->recv_window) |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
496 == NGX_ERROR) |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
497 { |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
498 ngx_http_close_connection(c); |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
499 return; |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
500 } |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
501 |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
502 sc->recv_window = NGX_SPDY_MAX_WINDOW; |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
503 |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
504 ngx_queue_init(&sc->waiting); |
5530
827e53c136b0
SPDY: use ngx_queue_t to queue streams for post processing.
Valentin Bartenev <vbart@nginx.com>
parents:
5529
diff
changeset
|
505 ngx_queue_init(&sc->posted); |
827e53c136b0
SPDY: use ngx_queue_t to queue streams for post processing.
Valentin Bartenev <vbart@nginx.com>
parents:
5529
diff
changeset
|
506 |
5121
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
507 c->data = sc; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
508 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
509 rev->handler = ngx_http_spdy_read_handler; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
510 c->write->handler = ngx_http_spdy_write_handler; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
511 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
512 ngx_http_spdy_read_handler(rev); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
513 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
514 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
515 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
516 static void |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
517 ngx_http_spdy_read_handler(ngx_event_t *rev) |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
518 { |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
519 u_char *p, *end; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
520 size_t available; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
521 ssize_t n; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
522 ngx_connection_t *c; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
523 ngx_http_spdy_main_conf_t *smcf; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
524 ngx_http_spdy_connection_t *sc; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
525 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
526 c = rev->data; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
527 sc = c->data; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
528 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
529 if (rev->timedout) { |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
530 ngx_log_error(NGX_LOG_INFO, c->log, NGX_ETIMEDOUT, "client timed out"); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
531 ngx_http_spdy_finalize_connection(sc, NGX_HTTP_REQUEST_TIME_OUT); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
532 return; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
533 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
534 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
535 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, c->log, 0, "spdy read handler"); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
536 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
537 sc->blocked = 1; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
538 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
539 smcf = ngx_http_get_module_main_conf(sc->http_connection->conf_ctx, |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
540 ngx_http_spdy_module); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
541 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
542 available = smcf->recv_buffer_size - 2 * NGX_SPDY_STATE_BUFFER_SIZE; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
543 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
544 do { |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
545 p = smcf->recv_buffer; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
546 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
547 ngx_memcpy(p, sc->buffer, NGX_SPDY_STATE_BUFFER_SIZE); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
548 end = p + sc->buffer_used; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
549 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
550 n = c->recv(c, end, available); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
551 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
552 if (n == NGX_AGAIN) { |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
553 break; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
554 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
555 |
5509
877a7bd72070
SPDY: better name for flag that indicates incomplete frame state.
Valentin Bartenev <vbart@nginx.com>
parents:
5508
diff
changeset
|
556 if (n == 0 && (sc->incomplete || sc->processing)) { |
5121
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
557 ngx_log_error(NGX_LOG_INFO, c->log, 0, |
5693
701d6e17e42c
SPDY: improved logging.
Valentin Bartenev <vbart@nginx.com>
parents:
5692
diff
changeset
|
558 "client prematurely closed connection"); |
5121
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
559 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
560 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
561 if (n == 0 || n == NGX_ERROR) { |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
562 ngx_http_spdy_finalize_connection(sc, |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
563 NGX_HTTP_CLIENT_CLOSED_REQUEST); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
564 return; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
565 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
566 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
567 end += n; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
568 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
569 sc->buffer_used = 0; |
5509
877a7bd72070
SPDY: better name for flag that indicates incomplete frame state.
Valentin Bartenev <vbart@nginx.com>
parents:
5508
diff
changeset
|
570 sc->incomplete = 0; |
5121
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
571 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
572 do { |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
573 p = sc->handler(sc, p, end); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
574 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
575 if (p == NULL) { |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
576 return; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
577 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
578 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
579 } while (p != end); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
580 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
581 } while (rev->ready); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
582 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
583 if (ngx_handle_read_event(rev, 0) != NGX_OK) { |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
584 ngx_http_spdy_finalize_connection(sc, NGX_HTTP_INTERNAL_SERVER_ERROR); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
585 return; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
586 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
587 |
5520
a336cbc3dd44
SPDY: send output queue after processing of read event.
Valentin Bartenev <vbart@nginx.com>
parents:
5519
diff
changeset
|
588 if (sc->last_out && ngx_http_spdy_send_output_queue(sc) == NGX_ERROR) { |
a336cbc3dd44
SPDY: send output queue after processing of read event.
Valentin Bartenev <vbart@nginx.com>
parents:
5519
diff
changeset
|
589 ngx_http_spdy_finalize_connection(sc, NGX_HTTP_CLIENT_CLOSED_REQUEST); |
a336cbc3dd44
SPDY: send output queue after processing of read event.
Valentin Bartenev <vbart@nginx.com>
parents:
5519
diff
changeset
|
590 return; |
a336cbc3dd44
SPDY: send output queue after processing of read event.
Valentin Bartenev <vbart@nginx.com>
parents:
5519
diff
changeset
|
591 } |
a336cbc3dd44
SPDY: send output queue after processing of read event.
Valentin Bartenev <vbart@nginx.com>
parents:
5519
diff
changeset
|
592 |
5121
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
593 sc->blocked = 0; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
594 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
595 if (sc->processing) { |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
596 if (rev->timer_set) { |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
597 ngx_del_timer(rev); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
598 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
599 return; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
600 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
601 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
602 ngx_http_spdy_handle_connection(sc); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
603 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
604 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
605 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
606 static void |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
607 ngx_http_spdy_write_handler(ngx_event_t *wev) |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
608 { |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
609 ngx_int_t rc; |
5530
827e53c136b0
SPDY: use ngx_queue_t to queue streams for post processing.
Valentin Bartenev <vbart@nginx.com>
parents:
5529
diff
changeset
|
610 ngx_queue_t *q; |
5121
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
611 ngx_connection_t *c; |
5530
827e53c136b0
SPDY: use ngx_queue_t to queue streams for post processing.
Valentin Bartenev <vbart@nginx.com>
parents:
5529
diff
changeset
|
612 ngx_http_spdy_stream_t *stream; |
5121
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
613 ngx_http_spdy_connection_t *sc; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
614 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
615 c = wev->data; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
616 sc = c->data; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
617 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
618 if (wev->timedout) { |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
619 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, c->log, 0, |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
620 "spdy write event timed out"); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
621 ngx_http_spdy_finalize_connection(sc, NGX_HTTP_CLIENT_CLOSED_REQUEST); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
622 return; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
623 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
624 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
625 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, c->log, 0, "spdy write handler"); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
626 |
5493
916cb6d28f6a
SPDY: fixed possible request hang.
Valentin Bartenev <vbart@nginx.com>
parents:
5465
diff
changeset
|
627 sc->blocked = 1; |
5121
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
628 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
629 rc = ngx_http_spdy_send_output_queue(sc); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
630 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
631 if (rc == NGX_ERROR) { |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
632 ngx_http_spdy_finalize_connection(sc, NGX_HTTP_CLIENT_CLOSED_REQUEST); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
633 return; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
634 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
635 |
5530
827e53c136b0
SPDY: use ngx_queue_t to queue streams for post processing.
Valentin Bartenev <vbart@nginx.com>
parents:
5529
diff
changeset
|
636 while (!ngx_queue_empty(&sc->posted)) { |
827e53c136b0
SPDY: use ngx_queue_t to queue streams for post processing.
Valentin Bartenev <vbart@nginx.com>
parents:
5529
diff
changeset
|
637 q = ngx_queue_head(&sc->posted); |
827e53c136b0
SPDY: use ngx_queue_t to queue streams for post processing.
Valentin Bartenev <vbart@nginx.com>
parents:
5529
diff
changeset
|
638 |
827e53c136b0
SPDY: use ngx_queue_t to queue streams for post processing.
Valentin Bartenev <vbart@nginx.com>
parents:
5529
diff
changeset
|
639 ngx_queue_remove(q); |
827e53c136b0
SPDY: use ngx_queue_t to queue streams for post processing.
Valentin Bartenev <vbart@nginx.com>
parents:
5529
diff
changeset
|
640 |
827e53c136b0
SPDY: use ngx_queue_t to queue streams for post processing.
Valentin Bartenev <vbart@nginx.com>
parents:
5529
diff
changeset
|
641 stream = ngx_queue_data(q, ngx_http_spdy_stream_t, queue); |
827e53c136b0
SPDY: use ngx_queue_t to queue streams for post processing.
Valentin Bartenev <vbart@nginx.com>
parents:
5529
diff
changeset
|
642 |
5121
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
643 stream->handled = 0; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
644 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
645 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, c->log, 0, |
5693
701d6e17e42c
SPDY: improved logging.
Valentin Bartenev <vbart@nginx.com>
parents:
5692
diff
changeset
|
646 "run spdy stream %ui", stream->id); |
5121
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
647 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
648 wev = stream->request->connection->write; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
649 wev->handler(wev); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
650 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
651 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
652 sc->blocked = 0; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
653 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
654 if (rc == NGX_AGAIN) { |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
655 return; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
656 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
657 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
658 ngx_http_spdy_handle_connection(sc); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
659 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
660 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
661 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
662 ngx_int_t |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
663 ngx_http_spdy_send_output_queue(ngx_http_spdy_connection_t *sc) |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
664 { |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
665 ngx_chain_t *cl; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
666 ngx_event_t *wev; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
667 ngx_connection_t *c; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
668 ngx_http_core_loc_conf_t *clcf; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
669 ngx_http_spdy_out_frame_t *out, *frame, *fn; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
670 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
671 c = sc->connection; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
672 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
673 if (c->error) { |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
674 return NGX_ERROR; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
675 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
676 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
677 wev = c->write; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
678 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
679 if (!wev->ready) { |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
680 return NGX_OK; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
681 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
682 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
683 cl = NULL; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
684 out = NULL; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
685 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
686 for (frame = sc->last_out; frame; frame = fn) { |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
687 frame->last->next = cl; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
688 cl = frame->first; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
689 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
690 fn = frame->next; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
691 frame->next = out; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
692 out = frame; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
693 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
694 ngx_log_debug5(NGX_LOG_DEBUG_HTTP, c->log, 0, |
5529
e4adaa47af65
SPDY: store the length of frame instead of its whole size.
Valentin Bartenev <vbart@nginx.com>
parents:
5528
diff
changeset
|
695 "spdy frame out: %p sid:%ui prio:%ui bl:%d len:%uz", |
5121
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
696 out, out->stream ? out->stream->id : 0, out->priority, |
5529
e4adaa47af65
SPDY: store the length of frame instead of its whole size.
Valentin Bartenev <vbart@nginx.com>
parents:
5528
diff
changeset
|
697 out->blocked, out->length); |
5121
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
698 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
699 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
700 cl = c->send_chain(c, cl, 0); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
701 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
702 if (cl == NGX_CHAIN_ERROR) { |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
703 c->error = 1; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
704 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
705 if (!sc->blocked) { |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
706 ngx_post_event(wev, &ngx_posted_events); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
707 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
708 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
709 return NGX_ERROR; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
710 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
711 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
712 clcf = ngx_http_get_module_loc_conf(sc->http_connection->conf_ctx, |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
713 ngx_http_core_module); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
714 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
715 if (ngx_handle_write_event(wev, clcf->send_lowat) != NGX_OK) { |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
716 return NGX_ERROR; /* FIXME */ |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
717 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
718 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
719 if (cl) { |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
720 ngx_add_timer(wev, clcf->send_timeout); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
721 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
722 } else { |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
723 if (wev->timer_set) { |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
724 ngx_del_timer(wev); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
725 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
726 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
727 |
5528
d5de6c25b759
SPDY: use frame->next pointer to chain free frames.
Valentin Bartenev <vbart@nginx.com>
parents:
5527
diff
changeset
|
728 for ( /* void */ ; out; out = fn) { |
d5de6c25b759
SPDY: use frame->next pointer to chain free frames.
Valentin Bartenev <vbart@nginx.com>
parents:
5527
diff
changeset
|
729 fn = out->next; |
d5de6c25b759
SPDY: use frame->next pointer to chain free frames.
Valentin Bartenev <vbart@nginx.com>
parents:
5527
diff
changeset
|
730 |
5121
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
731 if (out->handler(sc, out) != NGX_OK) { |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
732 out->blocked = 1; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
733 out->priority = NGX_SPDY_HIGHEST_PRIORITY; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
734 break; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
735 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
736 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
737 ngx_log_debug4(NGX_LOG_DEBUG_HTTP, c->log, 0, |
5529
e4adaa47af65
SPDY: store the length of frame instead of its whole size.
Valentin Bartenev <vbart@nginx.com>
parents:
5528
diff
changeset
|
738 "spdy frame sent: %p sid:%ui bl:%d len:%uz", |
5121
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
739 out, out->stream ? out->stream->id : 0, |
5529
e4adaa47af65
SPDY: store the length of frame instead of its whole size.
Valentin Bartenev <vbart@nginx.com>
parents:
5528
diff
changeset
|
740 out->blocked, out->length); |
5121
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
741 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
742 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
743 frame = NULL; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
744 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
745 for ( /* void */ ; out; out = fn) { |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
746 fn = out->next; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
747 out->next = frame; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
748 frame = out; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
749 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
750 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
751 sc->last_out = frame; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
752 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
753 return NGX_OK; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
754 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
755 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
756 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
757 static void |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
758 ngx_http_spdy_handle_connection(ngx_http_spdy_connection_t *sc) |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
759 { |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
760 ngx_connection_t *c; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
761 ngx_http_spdy_srv_conf_t *sscf; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
762 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
763 if (sc->last_out || sc->processing) { |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
764 return; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
765 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
766 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
767 c = sc->connection; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
768 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
769 if (c->error) { |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
770 ngx_http_close_connection(c); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
771 return; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
772 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
773 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
774 if (c->buffered) { |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
775 return; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
776 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
777 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
778 sscf = ngx_http_get_module_srv_conf(sc->http_connection->conf_ctx, |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
779 ngx_http_spdy_module); |
5509
877a7bd72070
SPDY: better name for flag that indicates incomplete frame state.
Valentin Bartenev <vbart@nginx.com>
parents:
5508
diff
changeset
|
780 if (sc->incomplete) { |
5121
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
781 ngx_add_timer(c->read, sscf->recv_timeout); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
782 return; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
783 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
784 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
785 if (ngx_terminate || ngx_exiting) { |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
786 ngx_http_close_connection(c); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
787 return; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
788 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
789 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
790 ngx_destroy_pool(sc->pool); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
791 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
792 sc->pool = NULL; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
793 sc->free_ctl_frames = NULL; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
794 sc->free_fake_connections = NULL; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
795 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
796 #if (NGX_HTTP_SSL) |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
797 if (c->ssl) { |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
798 ngx_ssl_free_buffer(c); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
799 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
800 #endif |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
801 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
802 c->destroyed = 1; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
803 c->idle = 1; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
804 ngx_reusable_connection(c, 1); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
805 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
806 c->write->handler = ngx_http_empty_handler; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
807 c->read->handler = ngx_http_spdy_keepalive_handler; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
808 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
809 if (c->write->timer_set) { |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
810 ngx_del_timer(c->write); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
811 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
812 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
813 ngx_add_timer(c->read, sscf->keepalive_timeout); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
814 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
815 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
816 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
817 static u_char * |
5605
3a72b1805c52
Added server-side support for PROXY protocol v1 (ticket #355).
Roman Arutyunyan <arut@nginx.com>
parents:
5590
diff
changeset
|
818 ngx_http_spdy_proxy_protocol(ngx_http_spdy_connection_t *sc, u_char *pos, |
3a72b1805c52
Added server-side support for PROXY protocol v1 (ticket #355).
Roman Arutyunyan <arut@nginx.com>
parents:
5590
diff
changeset
|
819 u_char *end) |
3a72b1805c52
Added server-side support for PROXY protocol v1 (ticket #355).
Roman Arutyunyan <arut@nginx.com>
parents:
5590
diff
changeset
|
820 { |
5692
ed5fb7d22d46
SPDY: set log action for PROXY protocol only while parsing it.
Valentin Bartenev <vbart@nginx.com>
parents:
5691
diff
changeset
|
821 ngx_log_t *log; |
ed5fb7d22d46
SPDY: set log action for PROXY protocol only while parsing it.
Valentin Bartenev <vbart@nginx.com>
parents:
5691
diff
changeset
|
822 |
ed5fb7d22d46
SPDY: set log action for PROXY protocol only while parsing it.
Valentin Bartenev <vbart@nginx.com>
parents:
5691
diff
changeset
|
823 log = sc->connection->log; |
ed5fb7d22d46
SPDY: set log action for PROXY protocol only while parsing it.
Valentin Bartenev <vbart@nginx.com>
parents:
5691
diff
changeset
|
824 log->action = "reading PROXY protocol"; |
ed5fb7d22d46
SPDY: set log action for PROXY protocol only while parsing it.
Valentin Bartenev <vbart@nginx.com>
parents:
5691
diff
changeset
|
825 |
5605
3a72b1805c52
Added server-side support for PROXY protocol v1 (ticket #355).
Roman Arutyunyan <arut@nginx.com>
parents:
5590
diff
changeset
|
826 pos = ngx_proxy_protocol_parse(sc->connection, pos, end); |
3a72b1805c52
Added server-side support for PROXY protocol v1 (ticket #355).
Roman Arutyunyan <arut@nginx.com>
parents:
5590
diff
changeset
|
827 |
5692
ed5fb7d22d46
SPDY: set log action for PROXY protocol only while parsing it.
Valentin Bartenev <vbart@nginx.com>
parents:
5691
diff
changeset
|
828 log->action = "processing SPDY"; |
ed5fb7d22d46
SPDY: set log action for PROXY protocol only while parsing it.
Valentin Bartenev <vbart@nginx.com>
parents:
5691
diff
changeset
|
829 |
5605
3a72b1805c52
Added server-side support for PROXY protocol v1 (ticket #355).
Roman Arutyunyan <arut@nginx.com>
parents:
5590
diff
changeset
|
830 if (pos == NULL) { |
3a72b1805c52
Added server-side support for PROXY protocol v1 (ticket #355).
Roman Arutyunyan <arut@nginx.com>
parents:
5590
diff
changeset
|
831 return ngx_http_spdy_state_protocol_error(sc); |
3a72b1805c52
Added server-side support for PROXY protocol v1 (ticket #355).
Roman Arutyunyan <arut@nginx.com>
parents:
5590
diff
changeset
|
832 } |
3a72b1805c52
Added server-side support for PROXY protocol v1 (ticket #355).
Roman Arutyunyan <arut@nginx.com>
parents:
5590
diff
changeset
|
833 |
3a72b1805c52
Added server-side support for PROXY protocol v1 (ticket #355).
Roman Arutyunyan <arut@nginx.com>
parents:
5590
diff
changeset
|
834 return ngx_http_spdy_state_complete(sc, pos, end); |
3a72b1805c52
Added server-side support for PROXY protocol v1 (ticket #355).
Roman Arutyunyan <arut@nginx.com>
parents:
5590
diff
changeset
|
835 } |
3a72b1805c52
Added server-side support for PROXY protocol v1 (ticket #355).
Roman Arutyunyan <arut@nginx.com>
parents:
5590
diff
changeset
|
836 |
3a72b1805c52
Added server-side support for PROXY protocol v1 (ticket #355).
Roman Arutyunyan <arut@nginx.com>
parents:
5590
diff
changeset
|
837 |
3a72b1805c52
Added server-side support for PROXY protocol v1 (ticket #355).
Roman Arutyunyan <arut@nginx.com>
parents:
5590
diff
changeset
|
838 static u_char * |
5121
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
839 ngx_http_spdy_state_head(ngx_http_spdy_connection_t *sc, u_char *pos, |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
840 u_char *end) |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
841 { |
5643
436f3605195a
SPDY: consistently handle control frames with unknown type.
Valentin Bartenev <vbart@nginx.com>
parents:
5642
diff
changeset
|
842 uint32_t head, flen; |
436f3605195a
SPDY: consistently handle control frames with unknown type.
Valentin Bartenev <vbart@nginx.com>
parents:
5642
diff
changeset
|
843 ngx_uint_t type; |
5121
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
844 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
845 if (end - pos < NGX_SPDY_FRAME_HEADER_SIZE) { |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
846 return ngx_http_spdy_state_save(sc, pos, end, |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
847 ngx_http_spdy_state_head); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
848 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
849 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
850 head = ngx_spdy_frame_parse_uint32(pos); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
851 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
852 pos += sizeof(uint32_t); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
853 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
854 flen = ngx_spdy_frame_parse_uint32(pos); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
855 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
856 sc->flags = ngx_spdy_frame_flags(flen); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
857 sc->length = ngx_spdy_frame_length(flen); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
858 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
859 pos += sizeof(uint32_t); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
860 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
861 ngx_log_debug3(NGX_LOG_DEBUG_HTTP, sc->connection->log, 0, |
5693
701d6e17e42c
SPDY: improved logging.
Valentin Bartenev <vbart@nginx.com>
parents:
5692
diff
changeset
|
862 "process spdy frame head:%08XD f:%Xd l:%uz", |
5121
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
863 head, sc->flags, sc->length); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
864 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
865 if (ngx_spdy_ctl_frame_check(head)) { |
5643
436f3605195a
SPDY: consistently handle control frames with unknown type.
Valentin Bartenev <vbart@nginx.com>
parents:
5642
diff
changeset
|
866 type = ngx_spdy_ctl_frame_type(head); |
436f3605195a
SPDY: consistently handle control frames with unknown type.
Valentin Bartenev <vbart@nginx.com>
parents:
5642
diff
changeset
|
867 |
436f3605195a
SPDY: consistently handle control frames with unknown type.
Valentin Bartenev <vbart@nginx.com>
parents:
5642
diff
changeset
|
868 switch (type) { |
5121
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
869 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
870 case NGX_SPDY_SYN_STREAM: |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
871 return ngx_http_spdy_state_syn_stream(sc, pos, end); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
872 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
873 case NGX_SPDY_SYN_REPLY: |
5693
701d6e17e42c
SPDY: improved logging.
Valentin Bartenev <vbart@nginx.com>
parents:
5692
diff
changeset
|
874 ngx_log_error(NGX_LOG_INFO, sc->connection->log, 0, |
701d6e17e42c
SPDY: improved logging.
Valentin Bartenev <vbart@nginx.com>
parents:
5692
diff
changeset
|
875 "client sent unexpected SYN_REPLY frame"); |
5121
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
876 return ngx_http_spdy_state_protocol_error(sc); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
877 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
878 case NGX_SPDY_RST_STREAM: |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
879 return ngx_http_spdy_state_rst_stream(sc, pos, end); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
880 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
881 case NGX_SPDY_SETTINGS: |
5549
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
882 return ngx_http_spdy_state_settings(sc, pos, end); |
5121
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
883 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
884 case NGX_SPDY_PING: |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
885 return ngx_http_spdy_state_ping(sc, pos, end); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
886 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
887 case NGX_SPDY_GOAWAY: |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
888 return ngx_http_spdy_state_skip(sc, pos, end); /* TODO */ |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
889 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
890 case NGX_SPDY_HEADERS: |
5693
701d6e17e42c
SPDY: improved logging.
Valentin Bartenev <vbart@nginx.com>
parents:
5692
diff
changeset
|
891 ngx_log_error(NGX_LOG_INFO, sc->connection->log, 0, |
701d6e17e42c
SPDY: improved logging.
Valentin Bartenev <vbart@nginx.com>
parents:
5692
diff
changeset
|
892 "client sent unexpected HEADERS frame"); |
5121
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
893 return ngx_http_spdy_state_protocol_error(sc); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
894 |
5549
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
895 case NGX_SPDY_WINDOW_UPDATE: |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
896 return ngx_http_spdy_state_window_update(sc, pos, end); |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
897 |
5643
436f3605195a
SPDY: consistently handle control frames with unknown type.
Valentin Bartenev <vbart@nginx.com>
parents:
5642
diff
changeset
|
898 default: |
436f3605195a
SPDY: consistently handle control frames with unknown type.
Valentin Bartenev <vbart@nginx.com>
parents:
5642
diff
changeset
|
899 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, sc->connection->log, 0, |
436f3605195a
SPDY: consistently handle control frames with unknown type.
Valentin Bartenev <vbart@nginx.com>
parents:
5642
diff
changeset
|
900 "spdy control frame with unknown type %ui", type); |
5121
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
901 return ngx_http_spdy_state_skip(sc, pos, end); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
902 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
903 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
904 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
905 if (ngx_spdy_data_frame_check(head)) { |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
906 sc->stream = ngx_http_spdy_get_stream_by_id(sc, head); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
907 return ngx_http_spdy_state_data(sc, pos, end); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
908 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
909 |
5693
701d6e17e42c
SPDY: improved logging.
Valentin Bartenev <vbart@nginx.com>
parents:
5692
diff
changeset
|
910 ngx_log_error(NGX_LOG_INFO, sc->connection->log, 0, |
701d6e17e42c
SPDY: improved logging.
Valentin Bartenev <vbart@nginx.com>
parents:
5692
diff
changeset
|
911 "client sent invalid frame"); |
5121
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
912 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
913 return ngx_http_spdy_state_protocol_error(sc); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
914 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
915 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
916 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
917 static u_char * |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
918 ngx_http_spdy_state_syn_stream(ngx_http_spdy_connection_t *sc, u_char *pos, |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
919 u_char *end) |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
920 { |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
921 ngx_uint_t sid, prio; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
922 ngx_http_spdy_stream_t *stream; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
923 ngx_http_spdy_srv_conf_t *sscf; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
924 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
925 if (end - pos < NGX_SPDY_SYN_STREAM_SIZE) { |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
926 return ngx_http_spdy_state_save(sc, pos, end, |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
927 ngx_http_spdy_state_syn_stream); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
928 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
929 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
930 if (sc->length <= NGX_SPDY_SYN_STREAM_SIZE) { |
5693
701d6e17e42c
SPDY: improved logging.
Valentin Bartenev <vbart@nginx.com>
parents:
5692
diff
changeset
|
931 ngx_log_error(NGX_LOG_INFO, sc->connection->log, 0, |
701d6e17e42c
SPDY: improved logging.
Valentin Bartenev <vbart@nginx.com>
parents:
5692
diff
changeset
|
932 "client sent SYN_STREAM frame with incorrect length %uz", |
701d6e17e42c
SPDY: improved logging.
Valentin Bartenev <vbart@nginx.com>
parents:
5692
diff
changeset
|
933 sc->length); |
701d6e17e42c
SPDY: improved logging.
Valentin Bartenev <vbart@nginx.com>
parents:
5692
diff
changeset
|
934 |
5121
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
935 return ngx_http_spdy_state_protocol_error(sc); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
936 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
937 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
938 sc->length -= NGX_SPDY_SYN_STREAM_SIZE; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
939 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
940 sid = ngx_spdy_frame_parse_sid(pos); |
5553
60c4179f76ad
SPDY: fixed parsing of the priority field.
Shigeki Ohtsu <ohtsu@iij.ad.jp>
parents:
5549
diff
changeset
|
941 prio = pos[8] >> 5; |
5121
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
942 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
943 pos += NGX_SPDY_SYN_STREAM_SIZE; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
944 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
945 ngx_log_debug2(NGX_LOG_DEBUG_HTTP, sc->connection->log, 0, |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
946 "spdy SYN_STREAM frame sid:%ui prio:%ui", sid, prio); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
947 |
5664
de93bbe2d8cd
SPDY: Stream-ID restrictions according to specification.
Valentin Bartenev <vbart@nginx.com>
parents:
5652
diff
changeset
|
948 if (sid % 2 == 0 || sid <= sc->last_sid) { |
de93bbe2d8cd
SPDY: Stream-ID restrictions according to specification.
Valentin Bartenev <vbart@nginx.com>
parents:
5652
diff
changeset
|
949 ngx_log_error(NGX_LOG_INFO, sc->connection->log, 0, |
de93bbe2d8cd
SPDY: Stream-ID restrictions according to specification.
Valentin Bartenev <vbart@nginx.com>
parents:
5652
diff
changeset
|
950 "client sent SYN_STREAM frame " |
de93bbe2d8cd
SPDY: Stream-ID restrictions according to specification.
Valentin Bartenev <vbart@nginx.com>
parents:
5652
diff
changeset
|
951 "with invalid Stream-ID %ui", sid); |
de93bbe2d8cd
SPDY: Stream-ID restrictions according to specification.
Valentin Bartenev <vbart@nginx.com>
parents:
5652
diff
changeset
|
952 |
de93bbe2d8cd
SPDY: Stream-ID restrictions according to specification.
Valentin Bartenev <vbart@nginx.com>
parents:
5652
diff
changeset
|
953 stream = ngx_http_spdy_get_stream_by_id(sc, sid); |
de93bbe2d8cd
SPDY: Stream-ID restrictions according to specification.
Valentin Bartenev <vbart@nginx.com>
parents:
5652
diff
changeset
|
954 |
de93bbe2d8cd
SPDY: Stream-ID restrictions according to specification.
Valentin Bartenev <vbart@nginx.com>
parents:
5652
diff
changeset
|
955 if (stream) { |
de93bbe2d8cd
SPDY: Stream-ID restrictions according to specification.
Valentin Bartenev <vbart@nginx.com>
parents:
5652
diff
changeset
|
956 if (ngx_http_spdy_terminate_stream(sc, stream, |
de93bbe2d8cd
SPDY: Stream-ID restrictions according to specification.
Valentin Bartenev <vbart@nginx.com>
parents:
5652
diff
changeset
|
957 NGX_SPDY_PROTOCOL_ERROR) |
de93bbe2d8cd
SPDY: Stream-ID restrictions according to specification.
Valentin Bartenev <vbart@nginx.com>
parents:
5652
diff
changeset
|
958 != NGX_OK) |
de93bbe2d8cd
SPDY: Stream-ID restrictions according to specification.
Valentin Bartenev <vbart@nginx.com>
parents:
5652
diff
changeset
|
959 { |
de93bbe2d8cd
SPDY: Stream-ID restrictions according to specification.
Valentin Bartenev <vbart@nginx.com>
parents:
5652
diff
changeset
|
960 return ngx_http_spdy_state_internal_error(sc); |
de93bbe2d8cd
SPDY: Stream-ID restrictions according to specification.
Valentin Bartenev <vbart@nginx.com>
parents:
5652
diff
changeset
|
961 } |
de93bbe2d8cd
SPDY: Stream-ID restrictions according to specification.
Valentin Bartenev <vbart@nginx.com>
parents:
5652
diff
changeset
|
962 } |
de93bbe2d8cd
SPDY: Stream-ID restrictions according to specification.
Valentin Bartenev <vbart@nginx.com>
parents:
5652
diff
changeset
|
963 |
de93bbe2d8cd
SPDY: Stream-ID restrictions according to specification.
Valentin Bartenev <vbart@nginx.com>
parents:
5652
diff
changeset
|
964 return ngx_http_spdy_state_protocol_error(sc); |
de93bbe2d8cd
SPDY: Stream-ID restrictions according to specification.
Valentin Bartenev <vbart@nginx.com>
parents:
5652
diff
changeset
|
965 } |
de93bbe2d8cd
SPDY: Stream-ID restrictions according to specification.
Valentin Bartenev <vbart@nginx.com>
parents:
5652
diff
changeset
|
966 |
de93bbe2d8cd
SPDY: Stream-ID restrictions according to specification.
Valentin Bartenev <vbart@nginx.com>
parents:
5652
diff
changeset
|
967 sc->last_sid = sid; |
de93bbe2d8cd
SPDY: Stream-ID restrictions according to specification.
Valentin Bartenev <vbart@nginx.com>
parents:
5652
diff
changeset
|
968 |
5121
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
969 sscf = ngx_http_get_module_srv_conf(sc->http_connection->conf_ctx, |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
970 ngx_http_spdy_module); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
971 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
972 if (sc->processing >= sscf->concurrent_streams) { |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
973 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
974 ngx_log_error(NGX_LOG_INFO, sc->connection->log, 0, |
5693
701d6e17e42c
SPDY: improved logging.
Valentin Bartenev <vbart@nginx.com>
parents:
5692
diff
changeset
|
975 "concurrent streams exceeded %ui", sc->processing); |
5121
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
976 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
977 if (ngx_http_spdy_send_rst_stream(sc, sid, NGX_SPDY_REFUSED_STREAM, |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
978 prio) |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
979 != NGX_OK) |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
980 { |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
981 return ngx_http_spdy_state_internal_error(sc); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
982 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
983 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
984 return ngx_http_spdy_state_headers_skip(sc, pos, end); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
985 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
986 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
987 stream = ngx_http_spdy_create_stream(sc, sid, prio); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
988 if (stream == NULL) { |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
989 return ngx_http_spdy_state_internal_error(sc); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
990 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
991 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
992 stream->in_closed = (sc->flags & NGX_SPDY_FLAG_FIN) ? 1 : 0; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
993 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
994 stream->request->request_length = NGX_SPDY_FRAME_HEADER_SIZE |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
995 + NGX_SPDY_SYN_STREAM_SIZE |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
996 + sc->length; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
997 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
998 sc->stream = stream; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
999 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1000 return ngx_http_spdy_state_headers(sc, pos, end); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1001 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1002 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1003 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1004 static u_char * |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1005 ngx_http_spdy_state_headers(ngx_http_spdy_connection_t *sc, u_char *pos, |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1006 u_char *end) |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1007 { |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1008 int z; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1009 size_t size; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1010 ngx_buf_t *buf; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1011 ngx_int_t rc; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1012 ngx_http_request_t *r; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1013 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1014 size = end - pos; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1015 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1016 if (size == 0) { |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1017 return ngx_http_spdy_state_save(sc, pos, end, |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1018 ngx_http_spdy_state_headers); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1019 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1020 |
5694
9a95eb9f448b
SPDY: refactored ngx_http_spdy_state_headers().
Valentin Bartenev <vbart@nginx.com>
parents:
5693
diff
changeset
|
1021 if (size > sc->length) { |
5121
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1022 size = sc->length; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1023 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1024 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1025 r = sc->stream->request; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1026 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1027 ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, |
5693
701d6e17e42c
SPDY: improved logging.
Valentin Bartenev <vbart@nginx.com>
parents:
5692
diff
changeset
|
1028 "process spdy header block %uz of %uz", size, sc->length); |
5121
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1029 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1030 buf = r->header_in; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1031 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1032 sc->zstream_in.next_in = pos; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1033 sc->zstream_in.avail_in = size; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1034 sc->zstream_in.next_out = buf->last; |
5323
2be1a9ce9d8e
SPDY: fixed corruption of headers with names longer than 255.
Valentin Bartenev <vbart@nginx.com>
parents:
5281
diff
changeset
|
1035 |
2be1a9ce9d8e
SPDY: fixed corruption of headers with names longer than 255.
Valentin Bartenev <vbart@nginx.com>
parents:
5281
diff
changeset
|
1036 /* one byte is reserved for null-termination of the last header value */ |
5121
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1037 sc->zstream_in.avail_out = buf->end - buf->last - 1; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1038 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1039 z = inflate(&sc->zstream_in, Z_NO_FLUSH); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1040 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1041 if (z == Z_NEED_DICT) { |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1042 z = inflateSetDictionary(&sc->zstream_in, ngx_http_spdy_dict, |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1043 sizeof(ngx_http_spdy_dict)); |
5690
fb56f5d612a0
SPDY: improved error handling of header block decompression.
Valentin Bartenev <vbart@nginx.com>
parents:
5689
diff
changeset
|
1044 |
5121
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1045 if (z != Z_OK) { |
5690
fb56f5d612a0
SPDY: improved error handling of header block decompression.
Valentin Bartenev <vbart@nginx.com>
parents:
5689
diff
changeset
|
1046 if (z == Z_DATA_ERROR) { |
fb56f5d612a0
SPDY: improved error handling of header block decompression.
Valentin Bartenev <vbart@nginx.com>
parents:
5689
diff
changeset
|
1047 ngx_log_error(NGX_LOG_INFO, r->connection->log, 0, |
fb56f5d612a0
SPDY: improved error handling of header block decompression.
Valentin Bartenev <vbart@nginx.com>
parents:
5689
diff
changeset
|
1048 "client sent SYN_STREAM frame with header " |
fb56f5d612a0
SPDY: improved error handling of header block decompression.
Valentin Bartenev <vbart@nginx.com>
parents:
5689
diff
changeset
|
1049 "block encoded using wrong dictionary: %ul", |
fb56f5d612a0
SPDY: improved error handling of header block decompression.
Valentin Bartenev <vbart@nginx.com>
parents:
5689
diff
changeset
|
1050 (u_long) sc->zstream_in.adler); |
fb56f5d612a0
SPDY: improved error handling of header block decompression.
Valentin Bartenev <vbart@nginx.com>
parents:
5689
diff
changeset
|
1051 |
fb56f5d612a0
SPDY: improved error handling of header block decompression.
Valentin Bartenev <vbart@nginx.com>
parents:
5689
diff
changeset
|
1052 return ngx_http_spdy_state_protocol_error(sc); |
fb56f5d612a0
SPDY: improved error handling of header block decompression.
Valentin Bartenev <vbart@nginx.com>
parents:
5689
diff
changeset
|
1053 } |
fb56f5d612a0
SPDY: improved error handling of header block decompression.
Valentin Bartenev <vbart@nginx.com>
parents:
5689
diff
changeset
|
1054 |
fb56f5d612a0
SPDY: improved error handling of header block decompression.
Valentin Bartenev <vbart@nginx.com>
parents:
5689
diff
changeset
|
1055 ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, |
fb56f5d612a0
SPDY: improved error handling of header block decompression.
Valentin Bartenev <vbart@nginx.com>
parents:
5689
diff
changeset
|
1056 "inflateSetDictionary() failed: %d", z); |
fb56f5d612a0
SPDY: improved error handling of header block decompression.
Valentin Bartenev <vbart@nginx.com>
parents:
5689
diff
changeset
|
1057 |
fb56f5d612a0
SPDY: improved error handling of header block decompression.
Valentin Bartenev <vbart@nginx.com>
parents:
5689
diff
changeset
|
1058 return ngx_http_spdy_state_internal_error(sc); |
5121
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1059 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1060 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1061 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1062 "spdy inflateSetDictionary(): %d", z); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1063 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1064 z = sc->zstream_in.avail_in ? inflate(&sc->zstream_in, Z_NO_FLUSH) |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1065 : Z_OK; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1066 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1067 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1068 ngx_log_debug5(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1069 "spdy inflate out: ni:%p no:%p ai:%ud ao:%ud rc:%d", |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1070 sc->zstream_in.next_in, sc->zstream_in.next_out, |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1071 sc->zstream_in.avail_in, sc->zstream_in.avail_out, |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1072 z); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1073 |
5903
571e66f7c12c
SPDY: improved debug logging of inflate() calls.
Valentin Bartenev <vbart@nginx.com>
parents:
5899
diff
changeset
|
1074 if (z != Z_OK) { |
571e66f7c12c
SPDY: improved debug logging of inflate() calls.
Valentin Bartenev <vbart@nginx.com>
parents:
5899
diff
changeset
|
1075 return ngx_http_spdy_state_inflate_error(sc, z); |
571e66f7c12c
SPDY: improved debug logging of inflate() calls.
Valentin Bartenev <vbart@nginx.com>
parents:
5899
diff
changeset
|
1076 } |
571e66f7c12c
SPDY: improved debug logging of inflate() calls.
Valentin Bartenev <vbart@nginx.com>
parents:
5899
diff
changeset
|
1077 |
5121
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1078 sc->length -= sc->zstream_in.next_in - pos; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1079 pos = sc->zstream_in.next_in; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1080 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1081 buf->last = sc->zstream_in.next_out; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1082 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1083 if (r->headers_in.headers.part.elts == NULL) { |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1084 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1085 if (buf->last - buf->pos < NGX_SPDY_NV_NUM_SIZE) { |
5625
372cc6e532a6
SPDY: detect premature end of frame while start parsing headers.
Valentin Bartenev <vbart@nginx.com>
parents:
5618
diff
changeset
|
1086 |
5694
9a95eb9f448b
SPDY: refactored ngx_http_spdy_state_headers().
Valentin Bartenev <vbart@nginx.com>
parents:
5693
diff
changeset
|
1087 if (sc->length == 0) { |
5691
31349361558e
SPDY: ngx_http_spdy_state_headers() error handling cleanup.
Valentin Bartenev <vbart@nginx.com>
parents:
5690
diff
changeset
|
1088 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, |
31349361558e
SPDY: ngx_http_spdy_state_headers() error handling cleanup.
Valentin Bartenev <vbart@nginx.com>
parents:
5690
diff
changeset
|
1089 "premature end of spdy header block"); |
31349361558e
SPDY: ngx_http_spdy_state_headers() error handling cleanup.
Valentin Bartenev <vbart@nginx.com>
parents:
5690
diff
changeset
|
1090 |
31349361558e
SPDY: ngx_http_spdy_state_headers() error handling cleanup.
Valentin Bartenev <vbart@nginx.com>
parents:
5690
diff
changeset
|
1091 return ngx_http_spdy_state_headers_error(sc, pos, end); |
5625
372cc6e532a6
SPDY: detect premature end of frame while start parsing headers.
Valentin Bartenev <vbart@nginx.com>
parents:
5618
diff
changeset
|
1092 } |
372cc6e532a6
SPDY: detect premature end of frame while start parsing headers.
Valentin Bartenev <vbart@nginx.com>
parents:
5618
diff
changeset
|
1093 |
5121
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1094 return ngx_http_spdy_state_save(sc, pos, end, |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1095 ngx_http_spdy_state_headers); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1096 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1097 |
5549
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1098 sc->entries = ngx_spdy_frame_parse_uint32(buf->pos); |
5121
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1099 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1100 buf->pos += NGX_SPDY_NV_NUM_SIZE; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1101 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1102 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, |
5693
701d6e17e42c
SPDY: improved logging.
Valentin Bartenev <vbart@nginx.com>
parents:
5692
diff
changeset
|
1103 "spdy header block has %ui entries", |
5525
206c56e23a96
SPDY: better name for frame entries counter.
Valentin Bartenev <vbart@nginx.com>
parents:
5524
diff
changeset
|
1104 sc->entries); |
206c56e23a96
SPDY: better name for frame entries counter.
Valentin Bartenev <vbart@nginx.com>
parents:
5524
diff
changeset
|
1105 |
5589
a9116d9b63f9
SPDY: constant number of preallocated structures for headers.
Valentin Bartenev <vbart@nginx.com>
parents:
5574
diff
changeset
|
1106 if (ngx_list_init(&r->headers_in.headers, r->pool, 20, |
5121
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1107 sizeof(ngx_table_elt_t)) |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1108 != NGX_OK) |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1109 { |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1110 ngx_http_spdy_close_stream(sc->stream, |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1111 NGX_HTTP_INTERNAL_SERVER_ERROR); |
5689
5d55f03b1e12
SPDY: removed ngx_http_spdy_state_headers_error().
Valentin Bartenev <vbart@nginx.com>
parents:
5688
diff
changeset
|
1112 return ngx_http_spdy_state_headers_skip(sc, pos, end); |
5121
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1113 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1114 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1115 if (ngx_array_init(&r->headers_in.cookies, r->pool, 2, |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1116 sizeof(ngx_table_elt_t *)) |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1117 != NGX_OK) |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1118 { |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1119 ngx_http_spdy_close_stream(sc->stream, |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1120 NGX_HTTP_INTERNAL_SERVER_ERROR); |
5689
5d55f03b1e12
SPDY: removed ngx_http_spdy_state_headers_error().
Valentin Bartenev <vbart@nginx.com>
parents:
5688
diff
changeset
|
1121 return ngx_http_spdy_state_headers_skip(sc, pos, end); |
5121
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1122 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1123 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1124 |
5525
206c56e23a96
SPDY: better name for frame entries counter.
Valentin Bartenev <vbart@nginx.com>
parents:
5524
diff
changeset
|
1125 while (sc->entries) { |
5121
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1126 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1127 rc = ngx_http_spdy_parse_header(r); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1128 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1129 switch (rc) { |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1130 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1131 case NGX_DONE: |
5525
206c56e23a96
SPDY: better name for frame entries counter.
Valentin Bartenev <vbart@nginx.com>
parents:
5524
diff
changeset
|
1132 sc->entries--; |
5121
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1133 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1134 case NGX_OK: |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1135 break; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1136 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1137 case NGX_AGAIN: |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1138 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1139 if (sc->zstream_in.avail_in) { |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1140 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1141 rc = ngx_http_spdy_alloc_large_header_buffer(r); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1142 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1143 if (rc == NGX_DECLINED) { |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1144 ngx_http_finalize_request(r, |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1145 NGX_HTTP_REQUEST_HEADER_TOO_LARGE); |
5689
5d55f03b1e12
SPDY: removed ngx_http_spdy_state_headers_error().
Valentin Bartenev <vbart@nginx.com>
parents:
5688
diff
changeset
|
1146 return ngx_http_spdy_state_headers_skip(sc, pos, end); |
5121
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1147 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1148 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1149 if (rc != NGX_OK) { |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1150 ngx_http_spdy_close_stream(sc->stream, |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1151 NGX_HTTP_INTERNAL_SERVER_ERROR); |
5689
5d55f03b1e12
SPDY: removed ngx_http_spdy_state_headers_error().
Valentin Bartenev <vbart@nginx.com>
parents:
5688
diff
changeset
|
1152 return ngx_http_spdy_state_headers_skip(sc, pos, end); |
5121
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1153 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1154 |
5323
2be1a9ce9d8e
SPDY: fixed corruption of headers with names longer than 255.
Valentin Bartenev <vbart@nginx.com>
parents:
5281
diff
changeset
|
1155 /* null-terminate the last processed header name or value */ |
2be1a9ce9d8e
SPDY: fixed corruption of headers with names longer than 255.
Valentin Bartenev <vbart@nginx.com>
parents:
5281
diff
changeset
|
1156 *buf->pos = '\0'; |
2be1a9ce9d8e
SPDY: fixed corruption of headers with names longer than 255.
Valentin Bartenev <vbart@nginx.com>
parents:
5281
diff
changeset
|
1157 |
5121
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1158 buf = r->header_in; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1159 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1160 sc->zstream_in.next_out = buf->last; |
5323
2be1a9ce9d8e
SPDY: fixed corruption of headers with names longer than 255.
Valentin Bartenev <vbart@nginx.com>
parents:
5281
diff
changeset
|
1161 |
2be1a9ce9d8e
SPDY: fixed corruption of headers with names longer than 255.
Valentin Bartenev <vbart@nginx.com>
parents:
5281
diff
changeset
|
1162 /* one byte is reserved for null-termination */ |
5121
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1163 sc->zstream_in.avail_out = buf->end - buf->last - 1; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1164 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1165 z = inflate(&sc->zstream_in, Z_NO_FLUSH); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1166 |
5903
571e66f7c12c
SPDY: improved debug logging of inflate() calls.
Valentin Bartenev <vbart@nginx.com>
parents:
5899
diff
changeset
|
1167 ngx_log_debug5(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, |
571e66f7c12c
SPDY: improved debug logging of inflate() calls.
Valentin Bartenev <vbart@nginx.com>
parents:
5899
diff
changeset
|
1168 "spdy inflate out: ni:%p no:%p ai:%ud ao:%ud rc:%d", |
571e66f7c12c
SPDY: improved debug logging of inflate() calls.
Valentin Bartenev <vbart@nginx.com>
parents:
5899
diff
changeset
|
1169 sc->zstream_in.next_in, sc->zstream_in.next_out, |
571e66f7c12c
SPDY: improved debug logging of inflate() calls.
Valentin Bartenev <vbart@nginx.com>
parents:
5899
diff
changeset
|
1170 sc->zstream_in.avail_in, sc->zstream_in.avail_out, |
571e66f7c12c
SPDY: improved debug logging of inflate() calls.
Valentin Bartenev <vbart@nginx.com>
parents:
5899
diff
changeset
|
1171 z); |
571e66f7c12c
SPDY: improved debug logging of inflate() calls.
Valentin Bartenev <vbart@nginx.com>
parents:
5899
diff
changeset
|
1172 |
5121
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1173 if (z != Z_OK) { |
5690
fb56f5d612a0
SPDY: improved error handling of header block decompression.
Valentin Bartenev <vbart@nginx.com>
parents:
5689
diff
changeset
|
1174 return ngx_http_spdy_state_inflate_error(sc, z); |
5121
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1175 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1176 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1177 sc->length -= sc->zstream_in.next_in - pos; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1178 pos = sc->zstream_in.next_in; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1179 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1180 buf->last = sc->zstream_in.next_out; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1181 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1182 continue; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1183 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1184 |
5694
9a95eb9f448b
SPDY: refactored ngx_http_spdy_state_headers().
Valentin Bartenev <vbart@nginx.com>
parents:
5693
diff
changeset
|
1185 if (sc->length == 0) { |
5121
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1186 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, |
5693
701d6e17e42c
SPDY: improved logging.
Valentin Bartenev <vbart@nginx.com>
parents:
5692
diff
changeset
|
1187 "premature end of spdy header block"); |
5687
6642690698f1
SPDY: improved ngx_http_spdy_state_protocol_error().
Valentin Bartenev <vbart@nginx.com>
parents:
5686
diff
changeset
|
1188 |
5691
31349361558e
SPDY: ngx_http_spdy_state_headers() error handling cleanup.
Valentin Bartenev <vbart@nginx.com>
parents:
5690
diff
changeset
|
1189 return ngx_http_spdy_state_headers_error(sc, pos, end); |
5121
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1190 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1191 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1192 return ngx_http_spdy_state_save(sc, pos, end, |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1193 ngx_http_spdy_state_headers); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1194 |
5691
31349361558e
SPDY: ngx_http_spdy_state_headers() error handling cleanup.
Valentin Bartenev <vbart@nginx.com>
parents:
5690
diff
changeset
|
1195 case NGX_HTTP_PARSE_INVALID_HEADER: |
5121
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1196 ngx_http_finalize_request(r, NGX_HTTP_BAD_REQUEST); |
5689
5d55f03b1e12
SPDY: removed ngx_http_spdy_state_headers_error().
Valentin Bartenev <vbart@nginx.com>
parents:
5688
diff
changeset
|
1197 return ngx_http_spdy_state_headers_skip(sc, pos, end); |
5121
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1198 |
5691
31349361558e
SPDY: ngx_http_spdy_state_headers() error handling cleanup.
Valentin Bartenev <vbart@nginx.com>
parents:
5690
diff
changeset
|
1199 default: /* NGX_ERROR */ |
31349361558e
SPDY: ngx_http_spdy_state_headers() error handling cleanup.
Valentin Bartenev <vbart@nginx.com>
parents:
5690
diff
changeset
|
1200 return ngx_http_spdy_state_headers_error(sc, pos, end); |
5121
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1201 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1202 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1203 /* a header line has been parsed successfully */ |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1204 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1205 rc = ngx_http_spdy_handle_request_header(r); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1206 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1207 if (rc != NGX_OK) { |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1208 if (rc == NGX_HTTP_PARSE_INVALID_HEADER) { |
5691
31349361558e
SPDY: ngx_http_spdy_state_headers() error handling cleanup.
Valentin Bartenev <vbart@nginx.com>
parents:
5690
diff
changeset
|
1209 ngx_http_finalize_request(r, NGX_HTTP_BAD_REQUEST); |
31349361558e
SPDY: ngx_http_spdy_state_headers() error handling cleanup.
Valentin Bartenev <vbart@nginx.com>
parents:
5690
diff
changeset
|
1210 return ngx_http_spdy_state_headers_skip(sc, pos, end); |
5121
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1211 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1212 |
5691
31349361558e
SPDY: ngx_http_spdy_state_headers() error handling cleanup.
Valentin Bartenev <vbart@nginx.com>
parents:
5690
diff
changeset
|
1213 if (rc != NGX_ABORT) { |
31349361558e
SPDY: ngx_http_spdy_state_headers() error handling cleanup.
Valentin Bartenev <vbart@nginx.com>
parents:
5690
diff
changeset
|
1214 ngx_http_spdy_close_stream(sc->stream, |
31349361558e
SPDY: ngx_http_spdy_state_headers() error handling cleanup.
Valentin Bartenev <vbart@nginx.com>
parents:
5690
diff
changeset
|
1215 NGX_HTTP_INTERNAL_SERVER_ERROR); |
5121
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1216 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1217 |
5689
5d55f03b1e12
SPDY: removed ngx_http_spdy_state_headers_error().
Valentin Bartenev <vbart@nginx.com>
parents:
5688
diff
changeset
|
1218 return ngx_http_spdy_state_headers_skip(sc, pos, end); |
5121
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1219 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1220 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1221 |
5626
2411d4b5be2c
SPDY: better detect if headers block has wrong entries count.
Valentin Bartenev <vbart@nginx.com>
parents:
5625
diff
changeset
|
1222 if (buf->pos != buf->last || sc->zstream_in.avail_in) { |
5691
31349361558e
SPDY: ngx_http_spdy_state_headers() error handling cleanup.
Valentin Bartenev <vbart@nginx.com>
parents:
5690
diff
changeset
|
1223 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, |
31349361558e
SPDY: ngx_http_spdy_state_headers() error handling cleanup.
Valentin Bartenev <vbart@nginx.com>
parents:
5690
diff
changeset
|
1224 "incorrect number of spdy header block entries"); |
31349361558e
SPDY: ngx_http_spdy_state_headers() error handling cleanup.
Valentin Bartenev <vbart@nginx.com>
parents:
5690
diff
changeset
|
1225 |
31349361558e
SPDY: ngx_http_spdy_state_headers() error handling cleanup.
Valentin Bartenev <vbart@nginx.com>
parents:
5690
diff
changeset
|
1226 return ngx_http_spdy_state_headers_error(sc, pos, end); |
5121
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1227 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1228 |
5694
9a95eb9f448b
SPDY: refactored ngx_http_spdy_state_headers().
Valentin Bartenev <vbart@nginx.com>
parents:
5693
diff
changeset
|
1229 if (sc->length) { |
5121
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1230 return ngx_http_spdy_state_save(sc, pos, end, |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1231 ngx_http_spdy_state_headers); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1232 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1233 |
5323
2be1a9ce9d8e
SPDY: fixed corruption of headers with names longer than 255.
Valentin Bartenev <vbart@nginx.com>
parents:
5281
diff
changeset
|
1234 /* null-terminate the last header value */ |
2be1a9ce9d8e
SPDY: fixed corruption of headers with names longer than 255.
Valentin Bartenev <vbart@nginx.com>
parents:
5281
diff
changeset
|
1235 *buf->pos = '\0'; |
2be1a9ce9d8e
SPDY: fixed corruption of headers with names longer than 255.
Valentin Bartenev <vbart@nginx.com>
parents:
5281
diff
changeset
|
1236 |
5121
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1237 ngx_http_spdy_run_request(r); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1238 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1239 return ngx_http_spdy_state_complete(sc, pos, end); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1240 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1241 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1242 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1243 static u_char * |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1244 ngx_http_spdy_state_headers_skip(ngx_http_spdy_connection_t *sc, u_char *pos, |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1245 u_char *end) |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1246 { |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1247 int n; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1248 size_t size; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1249 u_char buffer[NGX_SPDY_SKIP_HEADERS_BUFFER_SIZE]; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1250 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1251 if (sc->length == 0) { |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1252 return ngx_http_spdy_state_complete(sc, pos, end); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1253 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1254 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1255 size = end - pos; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1256 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1257 if (size == 0) { |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1258 return ngx_http_spdy_state_save(sc, pos, end, |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1259 ngx_http_spdy_state_headers_skip); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1260 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1261 |
5693
701d6e17e42c
SPDY: improved logging.
Valentin Bartenev <vbart@nginx.com>
parents:
5692
diff
changeset
|
1262 ngx_log_debug2(NGX_LOG_DEBUG_HTTP, sc->connection->log, 0, |
701d6e17e42c
SPDY: improved logging.
Valentin Bartenev <vbart@nginx.com>
parents:
5692
diff
changeset
|
1263 "spdy header block skip %uz of %uz", size, sc->length); |
701d6e17e42c
SPDY: improved logging.
Valentin Bartenev <vbart@nginx.com>
parents:
5692
diff
changeset
|
1264 |
5121
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1265 sc->zstream_in.next_in = pos; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1266 sc->zstream_in.avail_in = (size < sc->length) ? size : sc->length; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1267 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1268 while (sc->zstream_in.avail_in) { |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1269 sc->zstream_in.next_out = buffer; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1270 sc->zstream_in.avail_out = NGX_SPDY_SKIP_HEADERS_BUFFER_SIZE; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1271 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1272 n = inflate(&sc->zstream_in, Z_NO_FLUSH); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1273 |
5903
571e66f7c12c
SPDY: improved debug logging of inflate() calls.
Valentin Bartenev <vbart@nginx.com>
parents:
5899
diff
changeset
|
1274 ngx_log_debug5(NGX_LOG_DEBUG_HTTP, sc->connection->log, 0, |
571e66f7c12c
SPDY: improved debug logging of inflate() calls.
Valentin Bartenev <vbart@nginx.com>
parents:
5899
diff
changeset
|
1275 "spdy inflate out: ni:%p no:%p ai:%ud ao:%ud rc:%d", |
571e66f7c12c
SPDY: improved debug logging of inflate() calls.
Valentin Bartenev <vbart@nginx.com>
parents:
5899
diff
changeset
|
1276 sc->zstream_in.next_in, sc->zstream_in.next_out, |
571e66f7c12c
SPDY: improved debug logging of inflate() calls.
Valentin Bartenev <vbart@nginx.com>
parents:
5899
diff
changeset
|
1277 sc->zstream_in.avail_in, sc->zstream_in.avail_out, |
571e66f7c12c
SPDY: improved debug logging of inflate() calls.
Valentin Bartenev <vbart@nginx.com>
parents:
5899
diff
changeset
|
1278 n); |
571e66f7c12c
SPDY: improved debug logging of inflate() calls.
Valentin Bartenev <vbart@nginx.com>
parents:
5899
diff
changeset
|
1279 |
5121
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1280 if (n != Z_OK) { |
5690
fb56f5d612a0
SPDY: improved error handling of header block decompression.
Valentin Bartenev <vbart@nginx.com>
parents:
5689
diff
changeset
|
1281 return ngx_http_spdy_state_inflate_error(sc, n); |
5121
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1282 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1283 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1284 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1285 pos = sc->zstream_in.next_in; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1286 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1287 if (size < sc->length) { |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1288 sc->length -= size; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1289 return ngx_http_spdy_state_save(sc, pos, end, |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1290 ngx_http_spdy_state_headers_skip); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1291 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1292 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1293 return ngx_http_spdy_state_complete(sc, pos, end); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1294 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1295 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1296 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1297 static u_char * |
5691
31349361558e
SPDY: ngx_http_spdy_state_headers() error handling cleanup.
Valentin Bartenev <vbart@nginx.com>
parents:
5690
diff
changeset
|
1298 ngx_http_spdy_state_headers_error(ngx_http_spdy_connection_t *sc, u_char *pos, |
31349361558e
SPDY: ngx_http_spdy_state_headers() error handling cleanup.
Valentin Bartenev <vbart@nginx.com>
parents:
5690
diff
changeset
|
1299 u_char *end) |
31349361558e
SPDY: ngx_http_spdy_state_headers() error handling cleanup.
Valentin Bartenev <vbart@nginx.com>
parents:
5690
diff
changeset
|
1300 { |
31349361558e
SPDY: ngx_http_spdy_state_headers() error handling cleanup.
Valentin Bartenev <vbart@nginx.com>
parents:
5690
diff
changeset
|
1301 ngx_http_spdy_stream_t *stream; |
31349361558e
SPDY: ngx_http_spdy_state_headers() error handling cleanup.
Valentin Bartenev <vbart@nginx.com>
parents:
5690
diff
changeset
|
1302 |
31349361558e
SPDY: ngx_http_spdy_state_headers() error handling cleanup.
Valentin Bartenev <vbart@nginx.com>
parents:
5690
diff
changeset
|
1303 stream = sc->stream; |
31349361558e
SPDY: ngx_http_spdy_state_headers() error handling cleanup.
Valentin Bartenev <vbart@nginx.com>
parents:
5690
diff
changeset
|
1304 |
31349361558e
SPDY: ngx_http_spdy_state_headers() error handling cleanup.
Valentin Bartenev <vbart@nginx.com>
parents:
5690
diff
changeset
|
1305 ngx_log_error(NGX_LOG_INFO, sc->connection->log, 0, |
31349361558e
SPDY: ngx_http_spdy_state_headers() error handling cleanup.
Valentin Bartenev <vbart@nginx.com>
parents:
5690
diff
changeset
|
1306 "client sent SYN_STREAM frame for stream %ui " |
31349361558e
SPDY: ngx_http_spdy_state_headers() error handling cleanup.
Valentin Bartenev <vbart@nginx.com>
parents:
5690
diff
changeset
|
1307 "with invalid header block", stream->id); |
31349361558e
SPDY: ngx_http_spdy_state_headers() error handling cleanup.
Valentin Bartenev <vbart@nginx.com>
parents:
5690
diff
changeset
|
1308 |
31349361558e
SPDY: ngx_http_spdy_state_headers() error handling cleanup.
Valentin Bartenev <vbart@nginx.com>
parents:
5690
diff
changeset
|
1309 if (ngx_http_spdy_send_rst_stream(sc, stream->id, NGX_SPDY_PROTOCOL_ERROR, |
31349361558e
SPDY: ngx_http_spdy_state_headers() error handling cleanup.
Valentin Bartenev <vbart@nginx.com>
parents:
5690
diff
changeset
|
1310 stream->priority) |
31349361558e
SPDY: ngx_http_spdy_state_headers() error handling cleanup.
Valentin Bartenev <vbart@nginx.com>
parents:
5690
diff
changeset
|
1311 != NGX_OK) |
31349361558e
SPDY: ngx_http_spdy_state_headers() error handling cleanup.
Valentin Bartenev <vbart@nginx.com>
parents:
5690
diff
changeset
|
1312 { |
31349361558e
SPDY: ngx_http_spdy_state_headers() error handling cleanup.
Valentin Bartenev <vbart@nginx.com>
parents:
5690
diff
changeset
|
1313 return ngx_http_spdy_state_internal_error(sc); |
31349361558e
SPDY: ngx_http_spdy_state_headers() error handling cleanup.
Valentin Bartenev <vbart@nginx.com>
parents:
5690
diff
changeset
|
1314 } |
31349361558e
SPDY: ngx_http_spdy_state_headers() error handling cleanup.
Valentin Bartenev <vbart@nginx.com>
parents:
5690
diff
changeset
|
1315 |
31349361558e
SPDY: ngx_http_spdy_state_headers() error handling cleanup.
Valentin Bartenev <vbart@nginx.com>
parents:
5690
diff
changeset
|
1316 stream->out_closed = 1; |
31349361558e
SPDY: ngx_http_spdy_state_headers() error handling cleanup.
Valentin Bartenev <vbart@nginx.com>
parents:
5690
diff
changeset
|
1317 |
31349361558e
SPDY: ngx_http_spdy_state_headers() error handling cleanup.
Valentin Bartenev <vbart@nginx.com>
parents:
5690
diff
changeset
|
1318 ngx_http_spdy_close_stream(stream, NGX_HTTP_BAD_REQUEST); |
31349361558e
SPDY: ngx_http_spdy_state_headers() error handling cleanup.
Valentin Bartenev <vbart@nginx.com>
parents:
5690
diff
changeset
|
1319 |
31349361558e
SPDY: ngx_http_spdy_state_headers() error handling cleanup.
Valentin Bartenev <vbart@nginx.com>
parents:
5690
diff
changeset
|
1320 return ngx_http_spdy_state_headers_skip(sc, pos, end); |
31349361558e
SPDY: ngx_http_spdy_state_headers() error handling cleanup.
Valentin Bartenev <vbart@nginx.com>
parents:
5690
diff
changeset
|
1321 } |
31349361558e
SPDY: ngx_http_spdy_state_headers() error handling cleanup.
Valentin Bartenev <vbart@nginx.com>
parents:
5690
diff
changeset
|
1322 |
31349361558e
SPDY: ngx_http_spdy_state_headers() error handling cleanup.
Valentin Bartenev <vbart@nginx.com>
parents:
5690
diff
changeset
|
1323 |
31349361558e
SPDY: ngx_http_spdy_state_headers() error handling cleanup.
Valentin Bartenev <vbart@nginx.com>
parents:
5690
diff
changeset
|
1324 static u_char * |
5549
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1325 ngx_http_spdy_state_window_update(ngx_http_spdy_connection_t *sc, u_char *pos, |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1326 u_char *end) |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1327 { |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1328 size_t delta; |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1329 ngx_uint_t sid; |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1330 ngx_event_t *wev; |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1331 ngx_queue_t *q; |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1332 ngx_http_spdy_stream_t *stream; |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1333 |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1334 if (end - pos < NGX_SPDY_WINDOW_UPDATE_SIZE) { |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1335 return ngx_http_spdy_state_save(sc, pos, end, |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1336 ngx_http_spdy_state_window_update); |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1337 } |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1338 |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1339 if (sc->length != NGX_SPDY_WINDOW_UPDATE_SIZE) { |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1340 ngx_log_error(NGX_LOG_INFO, sc->connection->log, 0, |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1341 "client sent WINDOW_UPDATE frame " |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1342 "with incorrect length %uz", sc->length); |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1343 |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1344 return ngx_http_spdy_state_protocol_error(sc); |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1345 } |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1346 |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1347 sid = ngx_spdy_frame_parse_sid(pos); |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1348 |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1349 pos += NGX_SPDY_SID_SIZE; |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1350 |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1351 delta = ngx_spdy_frame_parse_delta(pos); |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1352 |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1353 pos += NGX_SPDY_DELTA_SIZE; |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1354 |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1355 ngx_log_debug2(NGX_LOG_DEBUG_HTTP, sc->connection->log, 0, |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1356 "spdy WINDOW_UPDATE sid:%ui delta:%ui", sid, delta); |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1357 |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1358 if (sid) { |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1359 stream = ngx_http_spdy_get_stream_by_id(sc, sid); |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1360 |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1361 if (stream == NULL) { |
5665
46d0795a846c
SPDY: avoid sending RST_STREAM on WINDOW_UPDATE with unknown SID.
Valentin Bartenev <vbart@nginx.com>
parents:
5664
diff
changeset
|
1362 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, sc->connection->log, 0, |
46d0795a846c
SPDY: avoid sending RST_STREAM on WINDOW_UPDATE with unknown SID.
Valentin Bartenev <vbart@nginx.com>
parents:
5664
diff
changeset
|
1363 "unknown spdy stream"); |
5549
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1364 |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1365 return ngx_http_spdy_state_complete(sc, pos, end); |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1366 } |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1367 |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1368 if (stream->send_window > (ssize_t) (NGX_SPDY_MAX_WINDOW - delta)) { |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1369 |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1370 ngx_log_error(NGX_LOG_INFO, sc->connection->log, 0, |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1371 "client violated flow control for stream %ui: " |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1372 "received WINDOW_UPDATE frame with delta %uz " |
5693
701d6e17e42c
SPDY: improved logging.
Valentin Bartenev <vbart@nginx.com>
parents:
5692
diff
changeset
|
1373 "not allowed for window %z", |
5549
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1374 sid, delta, stream->send_window); |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1375 |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1376 if (ngx_http_spdy_terminate_stream(sc, stream, |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1377 NGX_SPDY_FLOW_CONTROL_ERROR) |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1378 == NGX_ERROR) |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1379 { |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1380 return ngx_http_spdy_state_internal_error(sc); |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1381 } |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1382 |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1383 return ngx_http_spdy_state_complete(sc, pos, end); |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1384 } |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1385 |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1386 stream->send_window += delta; |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1387 |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1388 if (stream->exhausted) { |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1389 stream->exhausted = 0; |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1390 |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1391 wev = stream->request->connection->write; |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1392 |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1393 if (!wev->timer_set) { |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1394 wev->delayed = 0; |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1395 wev->handler(wev); |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1396 } |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1397 } |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1398 |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1399 } else { |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1400 sc->send_window += delta; |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1401 |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1402 if (sc->send_window > NGX_SPDY_MAX_WINDOW) { |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1403 ngx_log_error(NGX_LOG_INFO, sc->connection->log, 0, |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1404 "client violated connection flow control: " |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1405 "received WINDOW_UPDATE frame with delta %uz " |
5693
701d6e17e42c
SPDY: improved logging.
Valentin Bartenev <vbart@nginx.com>
parents:
5692
diff
changeset
|
1406 "not allowed for window %uz", |
5549
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1407 delta, sc->send_window); |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1408 |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1409 return ngx_http_spdy_state_protocol_error(sc); |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1410 } |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1411 |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1412 while (!ngx_queue_empty(&sc->waiting)) { |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1413 q = ngx_queue_head(&sc->waiting); |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1414 |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1415 ngx_queue_remove(q); |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1416 |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1417 stream = ngx_queue_data(q, ngx_http_spdy_stream_t, queue); |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1418 |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1419 stream->handled = 0; |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1420 |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1421 wev = stream->request->connection->write; |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1422 |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1423 if (!wev->timer_set) { |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1424 wev->delayed = 0; |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1425 wev->handler(wev); |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1426 |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1427 if (sc->send_window == 0) { |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1428 break; |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1429 } |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1430 } |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1431 } |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1432 } |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1433 |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1434 return ngx_http_spdy_state_complete(sc, pos, end); |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1435 } |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1436 |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1437 |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1438 static u_char * |
5121
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1439 ngx_http_spdy_state_data(ngx_http_spdy_connection_t *sc, u_char *pos, |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1440 u_char *end) |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1441 { |
5549
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1442 ngx_http_spdy_stream_t *stream; |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1443 |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1444 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, sc->connection->log, 0, |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1445 "spdy DATA frame"); |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1446 |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1447 if (sc->length > sc->recv_window) { |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1448 ngx_log_error(NGX_LOG_INFO, sc->connection->log, 0, |
5693
701d6e17e42c
SPDY: improved logging.
Valentin Bartenev <vbart@nginx.com>
parents:
5692
diff
changeset
|
1449 "client violated connection flow control: " |
701d6e17e42c
SPDY: improved logging.
Valentin Bartenev <vbart@nginx.com>
parents:
5692
diff
changeset
|
1450 "received DATA frame length %uz, available window %uz", |
5649
e1dcb983d6b3
SPDY: fixed arguments supplied for an error message.
Valentin Bartenev <vbart@nginx.com>
parents:
5643
diff
changeset
|
1451 sc->length, sc->recv_window); |
5549
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1452 |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1453 return ngx_http_spdy_state_protocol_error(sc); |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1454 } |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1455 |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1456 sc->recv_window -= sc->length; |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1457 |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1458 if (sc->recv_window < NGX_SPDY_MAX_WINDOW / 4) { |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1459 |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1460 if (ngx_http_spdy_send_window_update(sc, 0, |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1461 NGX_SPDY_MAX_WINDOW |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1462 - sc->recv_window) |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1463 == NGX_ERROR) |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1464 { |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1465 return ngx_http_spdy_state_internal_error(sc); |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1466 } |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1467 |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1468 sc->recv_window = NGX_SPDY_MAX_WINDOW; |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1469 } |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1470 |
5650
363395795384
SPDY: moved a variable initialization near to its check.
Valentin Bartenev <vbart@nginx.com>
parents:
5649
diff
changeset
|
1471 stream = sc->stream; |
363395795384
SPDY: moved a variable initialization near to its check.
Valentin Bartenev <vbart@nginx.com>
parents:
5649
diff
changeset
|
1472 |
5549
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1473 if (stream == NULL) { |
5693
701d6e17e42c
SPDY: improved logging.
Valentin Bartenev <vbart@nginx.com>
parents:
5692
diff
changeset
|
1474 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, sc->connection->log, 0, |
701d6e17e42c
SPDY: improved logging.
Valentin Bartenev <vbart@nginx.com>
parents:
5692
diff
changeset
|
1475 "unknown spdy stream"); |
701d6e17e42c
SPDY: improved logging.
Valentin Bartenev <vbart@nginx.com>
parents:
5692
diff
changeset
|
1476 |
5549
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1477 return ngx_http_spdy_state_skip(sc, pos, end); |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1478 } |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1479 |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1480 if (sc->length > stream->recv_window) { |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1481 ngx_log_error(NGX_LOG_INFO, sc->connection->log, 0, |
5693
701d6e17e42c
SPDY: improved logging.
Valentin Bartenev <vbart@nginx.com>
parents:
5692
diff
changeset
|
1482 "client violated flow control for stream %ui: " |
701d6e17e42c
SPDY: improved logging.
Valentin Bartenev <vbart@nginx.com>
parents:
5692
diff
changeset
|
1483 "received DATA frame length %uz, available window %uz", |
5549
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1484 stream->id, sc->length, stream->recv_window); |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1485 |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1486 if (ngx_http_spdy_terminate_stream(sc, stream, |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1487 NGX_SPDY_FLOW_CONTROL_ERROR) |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1488 == NGX_ERROR) |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1489 { |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1490 return ngx_http_spdy_state_internal_error(sc); |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1491 } |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1492 |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1493 return ngx_http_spdy_state_skip(sc, pos, end); |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1494 } |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1495 |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1496 stream->recv_window -= sc->length; |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1497 |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1498 if (stream->recv_window < NGX_SPDY_STREAM_WINDOW / 4) { |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1499 |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1500 if (ngx_http_spdy_send_window_update(sc, stream->id, |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1501 NGX_SPDY_STREAM_WINDOW |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1502 - stream->recv_window) |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1503 == NGX_ERROR) |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1504 { |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1505 return ngx_http_spdy_state_internal_error(sc); |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1506 } |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1507 |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1508 stream->recv_window = NGX_SPDY_STREAM_WINDOW; |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1509 } |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1510 |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1511 if (stream->in_closed) { |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1512 ngx_log_error(NGX_LOG_INFO, sc->connection->log, 0, |
5693
701d6e17e42c
SPDY: improved logging.
Valentin Bartenev <vbart@nginx.com>
parents:
5692
diff
changeset
|
1513 "client sent DATA frame for half-closed stream %ui", |
5549
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1514 stream->id); |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1515 |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1516 if (ngx_http_spdy_terminate_stream(sc, stream, |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1517 NGX_SPDY_STREAM_ALREADY_CLOSED) |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1518 == NGX_ERROR) |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1519 { |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1520 return ngx_http_spdy_state_internal_error(sc); |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1521 } |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1522 |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1523 return ngx_http_spdy_state_skip(sc, pos, end); |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1524 } |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1525 |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1526 return ngx_http_spdy_state_read_data(sc, pos, end); |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1527 } |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1528 |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1529 |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1530 static u_char * |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1531 ngx_http_spdy_state_read_data(ngx_http_spdy_connection_t *sc, u_char *pos, |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1532 u_char *end) |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1533 { |
5121
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1534 size_t size; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1535 ssize_t n; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1536 ngx_buf_t *buf; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1537 ngx_int_t rc; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1538 ngx_temp_file_t *tf; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1539 ngx_http_request_t *r; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1540 ngx_http_spdy_stream_t *stream; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1541 ngx_http_request_body_t *rb; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1542 ngx_http_core_loc_conf_t *clcf; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1543 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1544 stream = sc->stream; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1545 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1546 if (stream == NULL) { |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1547 return ngx_http_spdy_state_skip(sc, pos, end); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1548 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1549 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1550 if (stream->skip_data) { |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1551 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1552 if (sc->flags & NGX_SPDY_FLAG_FIN) { |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1553 stream->in_closed = 1; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1554 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1555 |
5693
701d6e17e42c
SPDY: improved logging.
Valentin Bartenev <vbart@nginx.com>
parents:
5692
diff
changeset
|
1556 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, sc->connection->log, 0, |
701d6e17e42c
SPDY: improved logging.
Valentin Bartenev <vbart@nginx.com>
parents:
5692
diff
changeset
|
1557 "skipping spdy DATA frame, reason: %d", |
701d6e17e42c
SPDY: improved logging.
Valentin Bartenev <vbart@nginx.com>
parents:
5692
diff
changeset
|
1558 stream->skip_data); |
701d6e17e42c
SPDY: improved logging.
Valentin Bartenev <vbart@nginx.com>
parents:
5692
diff
changeset
|
1559 |
5121
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1560 return ngx_http_spdy_state_skip(sc, pos, end); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1561 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1562 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1563 size = end - pos; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1564 |
5642
d2ac5cf4056d
SPDY: refactored ngx_http_spdy_state_read_data().
Valentin Bartenev <vbart@nginx.com>
parents:
5641
diff
changeset
|
1565 if (size > sc->length) { |
5121
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1566 size = sc->length; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1567 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1568 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1569 r = stream->request; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1570 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1571 if (r->request_body == NULL |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1572 && ngx_http_spdy_init_request_body(r) != NGX_OK) |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1573 { |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1574 stream->skip_data = NGX_SPDY_DATA_INTERNAL_ERROR; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1575 return ngx_http_spdy_state_skip(sc, pos, end); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1576 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1577 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1578 rb = r->request_body; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1579 tf = rb->temp_file; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1580 buf = rb->buf; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1581 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1582 if (size) { |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1583 rb->rest += size; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1584 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1585 if (r->headers_in.content_length_n != -1 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1586 && r->headers_in.content_length_n < rb->rest) |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1587 { |
5693
701d6e17e42c
SPDY: improved logging.
Valentin Bartenev <vbart@nginx.com>
parents:
5692
diff
changeset
|
1588 ngx_log_error(NGX_LOG_INFO, r->connection->log, 0, |
701d6e17e42c
SPDY: improved logging.
Valentin Bartenev <vbart@nginx.com>
parents:
5692
diff
changeset
|
1589 "client intended to send body data " |
701d6e17e42c
SPDY: improved logging.
Valentin Bartenev <vbart@nginx.com>
parents:
5692
diff
changeset
|
1590 "larger than declared"); |
701d6e17e42c
SPDY: improved logging.
Valentin Bartenev <vbart@nginx.com>
parents:
5692
diff
changeset
|
1591 |
5121
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1592 stream->skip_data = NGX_SPDY_DATA_ERROR; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1593 goto error; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1594 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1595 } else { |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1596 clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1597 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1598 if (clcf->client_max_body_size |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1599 && clcf->client_max_body_size < rb->rest) |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1600 { |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1601 ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, |
5693
701d6e17e42c
SPDY: improved logging.
Valentin Bartenev <vbart@nginx.com>
parents:
5692
diff
changeset
|
1602 "client intended to send " |
701d6e17e42c
SPDY: improved logging.
Valentin Bartenev <vbart@nginx.com>
parents:
5692
diff
changeset
|
1603 "too large chunked body: %O bytes", rb->rest); |
5121
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1604 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1605 stream->skip_data = NGX_SPDY_DATA_ERROR; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1606 goto error; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1607 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1608 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1609 |
5627
d74889fbf06d
SPDY: fixed the DATA frame length handling in case of some errors.
Valentin Bartenev <vbart@nginx.com>
parents:
5626
diff
changeset
|
1610 sc->length -= size; |
d74889fbf06d
SPDY: fixed the DATA frame length handling in case of some errors.
Valentin Bartenev <vbart@nginx.com>
parents:
5626
diff
changeset
|
1611 |
5121
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1612 if (tf) { |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1613 buf->start = pos; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1614 buf->pos = pos; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1615 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1616 pos += size; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1617 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1618 buf->end = pos; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1619 buf->last = pos; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1620 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1621 n = ngx_write_chain_to_temp_file(tf, rb->bufs); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1622 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1623 /* TODO: n == 0 or not complete and level event */ |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1624 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1625 if (n == NGX_ERROR) { |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1626 stream->skip_data = NGX_SPDY_DATA_INTERNAL_ERROR; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1627 goto error; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1628 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1629 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1630 tf->offset += n; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1631 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1632 } else { |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1633 buf->last = ngx_cpymem(buf->last, pos, size); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1634 pos += size; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1635 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1636 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1637 r->request_length += size; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1638 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1639 |
5642
d2ac5cf4056d
SPDY: refactored ngx_http_spdy_state_read_data().
Valentin Bartenev <vbart@nginx.com>
parents:
5641
diff
changeset
|
1640 if (sc->length) { |
5121
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1641 return ngx_http_spdy_state_save(sc, pos, end, |
5549
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1642 ngx_http_spdy_state_read_data); |
5121
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1643 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1644 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1645 if (sc->flags & NGX_SPDY_FLAG_FIN) { |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1646 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1647 stream->in_closed = 1; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1648 |
5628
a24f88eff684
SPDY: detect premature closing of stream.
Valentin Bartenev <vbart@nginx.com>
parents:
5627
diff
changeset
|
1649 if (r->headers_in.content_length_n < 0) { |
a24f88eff684
SPDY: detect premature closing of stream.
Valentin Bartenev <vbart@nginx.com>
parents:
5627
diff
changeset
|
1650 r->headers_in.content_length_n = rb->rest; |
a24f88eff684
SPDY: detect premature closing of stream.
Valentin Bartenev <vbart@nginx.com>
parents:
5627
diff
changeset
|
1651 |
a24f88eff684
SPDY: detect premature closing of stream.
Valentin Bartenev <vbart@nginx.com>
parents:
5627
diff
changeset
|
1652 } else if (r->headers_in.content_length_n != rb->rest) { |
a24f88eff684
SPDY: detect premature closing of stream.
Valentin Bartenev <vbart@nginx.com>
parents:
5627
diff
changeset
|
1653 ngx_log_error(NGX_LOG_INFO, r->connection->log, 0, |
a24f88eff684
SPDY: detect premature closing of stream.
Valentin Bartenev <vbart@nginx.com>
parents:
5627
diff
changeset
|
1654 "client prematurely closed stream: " |
5693
701d6e17e42c
SPDY: improved logging.
Valentin Bartenev <vbart@nginx.com>
parents:
5692
diff
changeset
|
1655 "only %O out of %O bytes of request body received", |
5628
a24f88eff684
SPDY: detect premature closing of stream.
Valentin Bartenev <vbart@nginx.com>
parents:
5627
diff
changeset
|
1656 rb->rest, r->headers_in.content_length_n); |
a24f88eff684
SPDY: detect premature closing of stream.
Valentin Bartenev <vbart@nginx.com>
parents:
5627
diff
changeset
|
1657 |
a24f88eff684
SPDY: detect premature closing of stream.
Valentin Bartenev <vbart@nginx.com>
parents:
5627
diff
changeset
|
1658 stream->skip_data = NGX_SPDY_DATA_ERROR; |
a24f88eff684
SPDY: detect premature closing of stream.
Valentin Bartenev <vbart@nginx.com>
parents:
5627
diff
changeset
|
1659 goto error; |
a24f88eff684
SPDY: detect premature closing of stream.
Valentin Bartenev <vbart@nginx.com>
parents:
5627
diff
changeset
|
1660 } |
a24f88eff684
SPDY: detect premature closing of stream.
Valentin Bartenev <vbart@nginx.com>
parents:
5627
diff
changeset
|
1661 |
5121
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1662 if (tf) { |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1663 ngx_memzero(buf, sizeof(ngx_buf_t)); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1664 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1665 buf->in_file = 1; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1666 buf->file_last = tf->file.offset; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1667 buf->file = &tf->file; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1668 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1669 rb->buf = NULL; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1670 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1671 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1672 if (rb->post_handler) { |
5402
4d0c70541784
SPDY: fixed connection leak while waiting for request body.
Valentin Bartenev <vbart@nginx.com>
parents:
5325
diff
changeset
|
1673 r->read_event_handler = ngx_http_block_reading; |
5121
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1674 rb->post_handler(r); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1675 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1676 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1677 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1678 return ngx_http_spdy_state_complete(sc, pos, end); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1679 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1680 error: |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1681 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1682 if (rb->post_handler) { |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1683 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1684 if (stream->skip_data == NGX_SPDY_DATA_ERROR) { |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1685 rc = (r->headers_in.content_length_n == -1) |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1686 ? NGX_HTTP_REQUEST_ENTITY_TOO_LARGE |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1687 : NGX_HTTP_BAD_REQUEST; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1688 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1689 } else { |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1690 rc = NGX_HTTP_INTERNAL_SERVER_ERROR; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1691 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1692 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1693 ngx_http_finalize_request(r, rc); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1694 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1695 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1696 return ngx_http_spdy_state_skip(sc, pos, end); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1697 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1698 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1699 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1700 static u_char * |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1701 ngx_http_spdy_state_rst_stream(ngx_http_spdy_connection_t *sc, u_char *pos, |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1702 u_char *end) |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1703 { |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1704 ngx_uint_t sid, status; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1705 ngx_event_t *ev; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1706 ngx_connection_t *fc; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1707 ngx_http_spdy_stream_t *stream; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1708 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1709 if (end - pos < NGX_SPDY_RST_STREAM_SIZE) { |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1710 return ngx_http_spdy_state_save(sc, pos, end, |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1711 ngx_http_spdy_state_rst_stream); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1712 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1713 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1714 if (sc->length != NGX_SPDY_RST_STREAM_SIZE) { |
5527
f3f7b72ca6e9
SPDY: proper handling of all RST_STREAM statuses.
Valentin Bartenev <vbart@nginx.com>
parents:
5526
diff
changeset
|
1715 ngx_log_error(NGX_LOG_INFO, sc->connection->log, 0, |
f3f7b72ca6e9
SPDY: proper handling of all RST_STREAM statuses.
Valentin Bartenev <vbart@nginx.com>
parents:
5526
diff
changeset
|
1716 "client sent RST_STREAM frame with incorrect length %uz", |
f3f7b72ca6e9
SPDY: proper handling of all RST_STREAM statuses.
Valentin Bartenev <vbart@nginx.com>
parents:
5526
diff
changeset
|
1717 sc->length); |
f3f7b72ca6e9
SPDY: proper handling of all RST_STREAM statuses.
Valentin Bartenev <vbart@nginx.com>
parents:
5526
diff
changeset
|
1718 |
5121
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1719 return ngx_http_spdy_state_protocol_error(sc); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1720 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1721 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1722 sid = ngx_spdy_frame_parse_sid(pos); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1723 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1724 pos += NGX_SPDY_SID_SIZE; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1725 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1726 status = ngx_spdy_frame_parse_uint32(pos); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1727 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1728 pos += sizeof(uint32_t); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1729 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1730 ngx_log_debug2(NGX_LOG_DEBUG_HTTP, sc->connection->log, 0, |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1731 "spdy RST_STREAM sid:%ui st:%ui", sid, status); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1732 |
5527
f3f7b72ca6e9
SPDY: proper handling of all RST_STREAM statuses.
Valentin Bartenev <vbart@nginx.com>
parents:
5526
diff
changeset
|
1733 stream = ngx_http_spdy_get_stream_by_id(sc, sid); |
5693
701d6e17e42c
SPDY: improved logging.
Valentin Bartenev <vbart@nginx.com>
parents:
5692
diff
changeset
|
1734 |
5527
f3f7b72ca6e9
SPDY: proper handling of all RST_STREAM statuses.
Valentin Bartenev <vbart@nginx.com>
parents:
5526
diff
changeset
|
1735 if (stream == NULL) { |
f3f7b72ca6e9
SPDY: proper handling of all RST_STREAM statuses.
Valentin Bartenev <vbart@nginx.com>
parents:
5526
diff
changeset
|
1736 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, sc->connection->log, 0, |
5693
701d6e17e42c
SPDY: improved logging.
Valentin Bartenev <vbart@nginx.com>
parents:
5692
diff
changeset
|
1737 "unknown spdy stream"); |
701d6e17e42c
SPDY: improved logging.
Valentin Bartenev <vbart@nginx.com>
parents:
5692
diff
changeset
|
1738 |
5527
f3f7b72ca6e9
SPDY: proper handling of all RST_STREAM statuses.
Valentin Bartenev <vbart@nginx.com>
parents:
5526
diff
changeset
|
1739 return ngx_http_spdy_state_complete(sc, pos, end); |
f3f7b72ca6e9
SPDY: proper handling of all RST_STREAM statuses.
Valentin Bartenev <vbart@nginx.com>
parents:
5526
diff
changeset
|
1740 } |
f3f7b72ca6e9
SPDY: proper handling of all RST_STREAM statuses.
Valentin Bartenev <vbart@nginx.com>
parents:
5526
diff
changeset
|
1741 |
f3f7b72ca6e9
SPDY: proper handling of all RST_STREAM statuses.
Valentin Bartenev <vbart@nginx.com>
parents:
5526
diff
changeset
|
1742 stream->in_closed = 1; |
f3f7b72ca6e9
SPDY: proper handling of all RST_STREAM statuses.
Valentin Bartenev <vbart@nginx.com>
parents:
5526
diff
changeset
|
1743 stream->out_closed = 1; |
f3f7b72ca6e9
SPDY: proper handling of all RST_STREAM statuses.
Valentin Bartenev <vbart@nginx.com>
parents:
5526
diff
changeset
|
1744 |
f3f7b72ca6e9
SPDY: proper handling of all RST_STREAM statuses.
Valentin Bartenev <vbart@nginx.com>
parents:
5526
diff
changeset
|
1745 fc = stream->request->connection; |
f3f7b72ca6e9
SPDY: proper handling of all RST_STREAM statuses.
Valentin Bartenev <vbart@nginx.com>
parents:
5526
diff
changeset
|
1746 fc->error = 1; |
5121
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1747 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1748 switch (status) { |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1749 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1750 case NGX_SPDY_CANCEL: |
5527
f3f7b72ca6e9
SPDY: proper handling of all RST_STREAM statuses.
Valentin Bartenev <vbart@nginx.com>
parents:
5526
diff
changeset
|
1751 ngx_log_error(NGX_LOG_INFO, fc->log, 0, |
f3f7b72ca6e9
SPDY: proper handling of all RST_STREAM statuses.
Valentin Bartenev <vbart@nginx.com>
parents:
5526
diff
changeset
|
1752 "client canceled stream %ui", sid); |
f3f7b72ca6e9
SPDY: proper handling of all RST_STREAM statuses.
Valentin Bartenev <vbart@nginx.com>
parents:
5526
diff
changeset
|
1753 break; |
f3f7b72ca6e9
SPDY: proper handling of all RST_STREAM statuses.
Valentin Bartenev <vbart@nginx.com>
parents:
5526
diff
changeset
|
1754 |
5121
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1755 case NGX_SPDY_INTERNAL_ERROR: |
5527
f3f7b72ca6e9
SPDY: proper handling of all RST_STREAM statuses.
Valentin Bartenev <vbart@nginx.com>
parents:
5526
diff
changeset
|
1756 ngx_log_error(NGX_LOG_INFO, fc->log, 0, |
5693
701d6e17e42c
SPDY: improved logging.
Valentin Bartenev <vbart@nginx.com>
parents:
5692
diff
changeset
|
1757 "client terminated stream %ui due to internal error", |
5527
f3f7b72ca6e9
SPDY: proper handling of all RST_STREAM statuses.
Valentin Bartenev <vbart@nginx.com>
parents:
5526
diff
changeset
|
1758 sid); |
5121
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1759 break; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1760 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1761 default: |
5527
f3f7b72ca6e9
SPDY: proper handling of all RST_STREAM statuses.
Valentin Bartenev <vbart@nginx.com>
parents:
5526
diff
changeset
|
1762 ngx_log_error(NGX_LOG_INFO, fc->log, 0, |
f3f7b72ca6e9
SPDY: proper handling of all RST_STREAM statuses.
Valentin Bartenev <vbart@nginx.com>
parents:
5526
diff
changeset
|
1763 "client terminated stream %ui with status %ui", |
f3f7b72ca6e9
SPDY: proper handling of all RST_STREAM statuses.
Valentin Bartenev <vbart@nginx.com>
parents:
5526
diff
changeset
|
1764 sid, status); |
f3f7b72ca6e9
SPDY: proper handling of all RST_STREAM statuses.
Valentin Bartenev <vbart@nginx.com>
parents:
5526
diff
changeset
|
1765 break; |
5121
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1766 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1767 |
5527
f3f7b72ca6e9
SPDY: proper handling of all RST_STREAM statuses.
Valentin Bartenev <vbart@nginx.com>
parents:
5526
diff
changeset
|
1768 ev = fc->read; |
f3f7b72ca6e9
SPDY: proper handling of all RST_STREAM statuses.
Valentin Bartenev <vbart@nginx.com>
parents:
5526
diff
changeset
|
1769 ev->handler(ev); |
f3f7b72ca6e9
SPDY: proper handling of all RST_STREAM statuses.
Valentin Bartenev <vbart@nginx.com>
parents:
5526
diff
changeset
|
1770 |
5121
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1771 return ngx_http_spdy_state_complete(sc, pos, end); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1772 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1773 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1774 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1775 static u_char * |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1776 ngx_http_spdy_state_ping(ngx_http_spdy_connection_t *sc, u_char *pos, |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1777 u_char *end) |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1778 { |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1779 u_char *p; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1780 ngx_buf_t *buf; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1781 ngx_http_spdy_out_frame_t *frame; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1782 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1783 if (end - pos < NGX_SPDY_PING_SIZE) { |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1784 return ngx_http_spdy_state_save(sc, pos, end, |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1785 ngx_http_spdy_state_ping); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1786 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1787 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1788 if (sc->length != NGX_SPDY_PING_SIZE) { |
5693
701d6e17e42c
SPDY: improved logging.
Valentin Bartenev <vbart@nginx.com>
parents:
5692
diff
changeset
|
1789 ngx_log_error(NGX_LOG_INFO, sc->connection->log, 0, |
701d6e17e42c
SPDY: improved logging.
Valentin Bartenev <vbart@nginx.com>
parents:
5692
diff
changeset
|
1790 "client sent PING frame with incorrect length %uz", |
701d6e17e42c
SPDY: improved logging.
Valentin Bartenev <vbart@nginx.com>
parents:
5692
diff
changeset
|
1791 sc->length); |
701d6e17e42c
SPDY: improved logging.
Valentin Bartenev <vbart@nginx.com>
parents:
5692
diff
changeset
|
1792 |
5121
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1793 return ngx_http_spdy_state_protocol_error(sc); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1794 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1795 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1796 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, sc->connection->log, 0, |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1797 "spdy PING frame"); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1798 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1799 frame = ngx_http_spdy_get_ctl_frame(sc, NGX_SPDY_PING_SIZE, |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1800 NGX_SPDY_HIGHEST_PRIORITY); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1801 if (frame == NULL) { |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1802 return ngx_http_spdy_state_internal_error(sc); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1803 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1804 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1805 buf = frame->first->buf; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1806 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1807 p = buf->pos; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1808 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1809 p = ngx_spdy_frame_write_head(p, NGX_SPDY_PING); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1810 p = ngx_spdy_frame_write_flags_and_len(p, 0, NGX_SPDY_PING_SIZE); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1811 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1812 p = ngx_cpymem(p, pos, NGX_SPDY_PING_SIZE); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1813 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1814 buf->last = p; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1815 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1816 ngx_http_spdy_queue_frame(sc, frame); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1817 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1818 pos += NGX_SPDY_PING_SIZE; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1819 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1820 return ngx_http_spdy_state_complete(sc, pos, end); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1821 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1822 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1823 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1824 static u_char * |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1825 ngx_http_spdy_state_skip(ngx_http_spdy_connection_t *sc, u_char *pos, |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1826 u_char *end) |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1827 { |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1828 size_t size; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1829 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1830 size = end - pos; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1831 |
5693
701d6e17e42c
SPDY: improved logging.
Valentin Bartenev <vbart@nginx.com>
parents:
5692
diff
changeset
|
1832 ngx_log_debug2(NGX_LOG_DEBUG_HTTP, sc->connection->log, 0, |
701d6e17e42c
SPDY: improved logging.
Valentin Bartenev <vbart@nginx.com>
parents:
5692
diff
changeset
|
1833 "spdy frame skip %uz of %uz", size, sc->length); |
701d6e17e42c
SPDY: improved logging.
Valentin Bartenev <vbart@nginx.com>
parents:
5692
diff
changeset
|
1834 |
5121
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1835 if (size < sc->length) { |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1836 sc->length -= size; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1837 return ngx_http_spdy_state_save(sc, end, end, |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1838 ngx_http_spdy_state_skip); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1839 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1840 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1841 return ngx_http_spdy_state_complete(sc, pos + sc->length, end); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1842 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1843 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1844 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1845 static u_char * |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1846 ngx_http_spdy_state_settings(ngx_http_spdy_connection_t *sc, u_char *pos, |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1847 u_char *end) |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1848 { |
5549
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1849 ngx_uint_t fid, val; |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1850 |
5525
206c56e23a96
SPDY: better name for frame entries counter.
Valentin Bartenev <vbart@nginx.com>
parents:
5524
diff
changeset
|
1851 if (sc->entries == 0) { |
5121
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1852 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1853 if (end - pos < NGX_SPDY_SETTINGS_NUM_SIZE) { |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1854 return ngx_http_spdy_state_save(sc, pos, end, |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1855 ngx_http_spdy_state_settings); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1856 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1857 |
5525
206c56e23a96
SPDY: better name for frame entries counter.
Valentin Bartenev <vbart@nginx.com>
parents:
5524
diff
changeset
|
1858 sc->entries = ngx_spdy_frame_parse_uint32(pos); |
5121
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1859 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1860 pos += NGX_SPDY_SETTINGS_NUM_SIZE; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1861 sc->length -= NGX_SPDY_SETTINGS_NUM_SIZE; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1862 |
5525
206c56e23a96
SPDY: better name for frame entries counter.
Valentin Bartenev <vbart@nginx.com>
parents:
5524
diff
changeset
|
1863 if (sc->length < sc->entries * NGX_SPDY_SETTINGS_PAIR_SIZE) { |
5693
701d6e17e42c
SPDY: improved logging.
Valentin Bartenev <vbart@nginx.com>
parents:
5692
diff
changeset
|
1864 ngx_log_error(NGX_LOG_INFO, sc->connection->log, 0, |
701d6e17e42c
SPDY: improved logging.
Valentin Bartenev <vbart@nginx.com>
parents:
5692
diff
changeset
|
1865 "client sent SETTINGS frame with incorrect " |
701d6e17e42c
SPDY: improved logging.
Valentin Bartenev <vbart@nginx.com>
parents:
5692
diff
changeset
|
1866 "length %uz or number of entries %ui", |
701d6e17e42c
SPDY: improved logging.
Valentin Bartenev <vbart@nginx.com>
parents:
5692
diff
changeset
|
1867 sc->length, sc->entries); |
701d6e17e42c
SPDY: improved logging.
Valentin Bartenev <vbart@nginx.com>
parents:
5692
diff
changeset
|
1868 |
5121
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1869 return ngx_http_spdy_state_protocol_error(sc); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1870 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1871 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1872 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, sc->connection->log, 0, |
5693
701d6e17e42c
SPDY: improved logging.
Valentin Bartenev <vbart@nginx.com>
parents:
5692
diff
changeset
|
1873 "spdy SETTINGS frame has %ui entries", sc->entries); |
5121
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1874 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1875 |
5525
206c56e23a96
SPDY: better name for frame entries counter.
Valentin Bartenev <vbart@nginx.com>
parents:
5524
diff
changeset
|
1876 while (sc->entries) { |
5121
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1877 if (end - pos < NGX_SPDY_SETTINGS_PAIR_SIZE) { |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1878 return ngx_http_spdy_state_save(sc, pos, end, |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1879 ngx_http_spdy_state_settings); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1880 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1881 |
5525
206c56e23a96
SPDY: better name for frame entries counter.
Valentin Bartenev <vbart@nginx.com>
parents:
5524
diff
changeset
|
1882 sc->entries--; |
5526
2c6f82c0cec2
SPDY: removed state to check first SETTINGS frame.
Valentin Bartenev <vbart@nginx.com>
parents:
5525
diff
changeset
|
1883 sc->length -= NGX_SPDY_SETTINGS_PAIR_SIZE; |
5549
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1884 |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1885 fid = ngx_spdy_frame_parse_uint32(pos); |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1886 |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1887 pos += NGX_SPDY_SETTINGS_FID_SIZE; |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1888 |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1889 val = ngx_spdy_frame_parse_uint32(pos); |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1890 |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1891 pos += NGX_SPDY_SETTINGS_VAL_SIZE; |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1892 |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1893 ngx_log_debug3(NGX_LOG_DEBUG_HTTP, sc->connection->log, 0, |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1894 "spdy SETTINGS entry fl:%ui id:%ui val:%ui", |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1895 ngx_spdy_frame_flags(fid), ngx_spdy_frame_id(fid), val); |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1896 |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1897 if (ngx_spdy_frame_flags(fid) == NGX_SPDY_SETTINGS_FLAG_PERSISTED) { |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1898 continue; |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1899 } |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1900 |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1901 switch (ngx_spdy_frame_id(fid)) { |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1902 |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1903 case NGX_SPDY_SETTINGS_INIT_WINDOW: |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1904 |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1905 if (val > NGX_SPDY_MAX_WINDOW) { |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1906 ngx_log_error(NGX_LOG_INFO, sc->connection->log, 0, |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1907 "client sent SETTINGS frame with " |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1908 "incorrect INIT_WINDOW value: %ui", val); |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1909 |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1910 return ngx_http_spdy_state_protocol_error(sc); |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1911 } |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1912 |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1913 if (ngx_http_spdy_adjust_windows(sc, val - sc->init_window) |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1914 != NGX_OK) |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1915 { |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1916 return ngx_http_spdy_state_internal_error(sc); |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1917 } |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1918 |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1919 sc->init_window = val; |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1920 |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1921 continue; |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
1922 } |
5121
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1923 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1924 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1925 return ngx_http_spdy_state_complete(sc, pos, end); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1926 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1927 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1928 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1929 static u_char * |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1930 ngx_http_spdy_state_complete(ngx_http_spdy_connection_t *sc, u_char *pos, |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1931 u_char *end) |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1932 { |
5693
701d6e17e42c
SPDY: improved logging.
Valentin Bartenev <vbart@nginx.com>
parents:
5692
diff
changeset
|
1933 ngx_log_debug2(NGX_LOG_DEBUG_HTTP, sc->connection->log, 0, |
701d6e17e42c
SPDY: improved logging.
Valentin Bartenev <vbart@nginx.com>
parents:
5692
diff
changeset
|
1934 "spdy frame complete pos:%p end:%p", pos, end); |
701d6e17e42c
SPDY: improved logging.
Valentin Bartenev <vbart@nginx.com>
parents:
5692
diff
changeset
|
1935 |
5696
19a14a484707
SPDY: added protection from overrun of the receive buffer.
Valentin Bartenev <vbart@nginx.com>
parents:
5695
diff
changeset
|
1936 if (pos > end) { |
19a14a484707
SPDY: added protection from overrun of the receive buffer.
Valentin Bartenev <vbart@nginx.com>
parents:
5695
diff
changeset
|
1937 ngx_log_error(NGX_LOG_ALERT, sc->connection->log, 0, |
19a14a484707
SPDY: added protection from overrun of the receive buffer.
Valentin Bartenev <vbart@nginx.com>
parents:
5695
diff
changeset
|
1938 "receive buffer overrun"); |
19a14a484707
SPDY: added protection from overrun of the receive buffer.
Valentin Bartenev <vbart@nginx.com>
parents:
5695
diff
changeset
|
1939 |
19a14a484707
SPDY: added protection from overrun of the receive buffer.
Valentin Bartenev <vbart@nginx.com>
parents:
5695
diff
changeset
|
1940 ngx_debug_point(); |
19a14a484707
SPDY: added protection from overrun of the receive buffer.
Valentin Bartenev <vbart@nginx.com>
parents:
5695
diff
changeset
|
1941 return ngx_http_spdy_state_internal_error(sc); |
19a14a484707
SPDY: added protection from overrun of the receive buffer.
Valentin Bartenev <vbart@nginx.com>
parents:
5695
diff
changeset
|
1942 } |
19a14a484707
SPDY: added protection from overrun of the receive buffer.
Valentin Bartenev <vbart@nginx.com>
parents:
5695
diff
changeset
|
1943 |
5121
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1944 sc->handler = ngx_http_spdy_state_head; |
5687
6642690698f1
SPDY: improved ngx_http_spdy_state_protocol_error().
Valentin Bartenev <vbart@nginx.com>
parents:
5686
diff
changeset
|
1945 sc->stream = NULL; |
6642690698f1
SPDY: improved ngx_http_spdy_state_protocol_error().
Valentin Bartenev <vbart@nginx.com>
parents:
5686
diff
changeset
|
1946 |
5121
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1947 return pos; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1948 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1949 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1950 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1951 static u_char * |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1952 ngx_http_spdy_state_save(ngx_http_spdy_connection_t *sc, |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1953 u_char *pos, u_char *end, ngx_http_spdy_handler_pt handler) |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1954 { |
5616
b93db4e4ff77
SPDY: improved ngx_http_spdy_state_save() check.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5606
diff
changeset
|
1955 size_t size; |
b93db4e4ff77
SPDY: improved ngx_http_spdy_state_save() check.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5606
diff
changeset
|
1956 |
5693
701d6e17e42c
SPDY: improved logging.
Valentin Bartenev <vbart@nginx.com>
parents:
5692
diff
changeset
|
1957 ngx_log_debug3(NGX_LOG_DEBUG_HTTP, sc->connection->log, 0, |
701d6e17e42c
SPDY: improved logging.
Valentin Bartenev <vbart@nginx.com>
parents:
5692
diff
changeset
|
1958 "spdy frame state save pos:%p end:%p handler:%p", |
701d6e17e42c
SPDY: improved logging.
Valentin Bartenev <vbart@nginx.com>
parents:
5692
diff
changeset
|
1959 pos, end, handler); |
701d6e17e42c
SPDY: improved logging.
Valentin Bartenev <vbart@nginx.com>
parents:
5692
diff
changeset
|
1960 |
5616
b93db4e4ff77
SPDY: improved ngx_http_spdy_state_save() check.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5606
diff
changeset
|
1961 size = end - pos; |
b93db4e4ff77
SPDY: improved ngx_http_spdy_state_save() check.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5606
diff
changeset
|
1962 |
b93db4e4ff77
SPDY: improved ngx_http_spdy_state_save() check.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5606
diff
changeset
|
1963 if (size > NGX_SPDY_STATE_BUFFER_SIZE) { |
5121
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1964 ngx_log_error(NGX_LOG_ALERT, sc->connection->log, 0, |
5693
701d6e17e42c
SPDY: improved logging.
Valentin Bartenev <vbart@nginx.com>
parents:
5692
diff
changeset
|
1965 "state buffer overflow: %uz bytes required", size); |
701d6e17e42c
SPDY: improved logging.
Valentin Bartenev <vbart@nginx.com>
parents:
5692
diff
changeset
|
1966 |
5695
231588611230
SPDY: added a debug point to the state buffer overflow protection.
Valentin Bartenev <vbart@nginx.com>
parents:
5694
diff
changeset
|
1967 ngx_debug_point(); |
5121
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1968 return ngx_http_spdy_state_internal_error(sc); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1969 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1970 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1971 ngx_memcpy(sc->buffer, pos, NGX_SPDY_STATE_BUFFER_SIZE); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1972 |
5618
c15350f4071c
SPDY: improved ngx_http_spdy_state_save() again.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5616
diff
changeset
|
1973 sc->buffer_used = size; |
5121
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1974 sc->handler = handler; |
5509
877a7bd72070
SPDY: better name for flag that indicates incomplete frame state.
Valentin Bartenev <vbart@nginx.com>
parents:
5508
diff
changeset
|
1975 sc->incomplete = 1; |
5121
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1976 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1977 return end; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1978 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1979 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1980 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
1981 static u_char * |
5690
fb56f5d612a0
SPDY: improved error handling of header block decompression.
Valentin Bartenev <vbart@nginx.com>
parents:
5689
diff
changeset
|
1982 ngx_http_spdy_state_inflate_error(ngx_http_spdy_connection_t *sc, int rc) |
fb56f5d612a0
SPDY: improved error handling of header block decompression.
Valentin Bartenev <vbart@nginx.com>
parents:
5689
diff
changeset
|
1983 { |
fb56f5d612a0
SPDY: improved error handling of header block decompression.
Valentin Bartenev <vbart@nginx.com>
parents:
5689
diff
changeset
|
1984 if (rc == Z_DATA_ERROR || rc == Z_STREAM_END) { |
fb56f5d612a0
SPDY: improved error handling of header block decompression.
Valentin Bartenev <vbart@nginx.com>
parents:
5689
diff
changeset
|
1985 ngx_log_error(NGX_LOG_INFO, sc->connection->log, 0, |
fb56f5d612a0
SPDY: improved error handling of header block decompression.
Valentin Bartenev <vbart@nginx.com>
parents:
5689
diff
changeset
|
1986 "client sent SYN_STREAM frame with " |
fb56f5d612a0
SPDY: improved error handling of header block decompression.
Valentin Bartenev <vbart@nginx.com>
parents:
5689
diff
changeset
|
1987 "corrupted header block, inflate() failed: %d", rc); |
fb56f5d612a0
SPDY: improved error handling of header block decompression.
Valentin Bartenev <vbart@nginx.com>
parents:
5689
diff
changeset
|
1988 |
fb56f5d612a0
SPDY: improved error handling of header block decompression.
Valentin Bartenev <vbart@nginx.com>
parents:
5689
diff
changeset
|
1989 return ngx_http_spdy_state_protocol_error(sc); |
fb56f5d612a0
SPDY: improved error handling of header block decompression.
Valentin Bartenev <vbart@nginx.com>
parents:
5689
diff
changeset
|
1990 } |
fb56f5d612a0
SPDY: improved error handling of header block decompression.
Valentin Bartenev <vbart@nginx.com>
parents:
5689
diff
changeset
|
1991 |
fb56f5d612a0
SPDY: improved error handling of header block decompression.
Valentin Bartenev <vbart@nginx.com>
parents:
5689
diff
changeset
|
1992 ngx_log_error(NGX_LOG_ERR, sc->connection->log, 0, |
fb56f5d612a0
SPDY: improved error handling of header block decompression.
Valentin Bartenev <vbart@nginx.com>
parents:
5689
diff
changeset
|
1993 "inflate() failed: %d", rc); |
fb56f5d612a0
SPDY: improved error handling of header block decompression.
Valentin Bartenev <vbart@nginx.com>
parents:
5689
diff
changeset
|
1994 |
fb56f5d612a0
SPDY: improved error handling of header block decompression.
Valentin Bartenev <vbart@nginx.com>
parents:
5689
diff
changeset
|
1995 return ngx_http_spdy_state_internal_error(sc); |
fb56f5d612a0
SPDY: improved error handling of header block decompression.
Valentin Bartenev <vbart@nginx.com>
parents:
5689
diff
changeset
|
1996 } |
fb56f5d612a0
SPDY: improved error handling of header block decompression.
Valentin Bartenev <vbart@nginx.com>
parents:
5689
diff
changeset
|
1997 |
fb56f5d612a0
SPDY: improved error handling of header block decompression.
Valentin Bartenev <vbart@nginx.com>
parents:
5689
diff
changeset
|
1998 |
fb56f5d612a0
SPDY: improved error handling of header block decompression.
Valentin Bartenev <vbart@nginx.com>
parents:
5689
diff
changeset
|
1999 static u_char * |
5121
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2000 ngx_http_spdy_state_protocol_error(ngx_http_spdy_connection_t *sc) |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2001 { |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2002 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, sc->connection->log, 0, |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2003 "spdy state protocol error"); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2004 |
5687
6642690698f1
SPDY: improved ngx_http_spdy_state_protocol_error().
Valentin Bartenev <vbart@nginx.com>
parents:
5686
diff
changeset
|
2005 if (sc->stream) { |
5688
86232c95623d
SPDY: prevented creation of RST_STREAM in protocol error state.
Valentin Bartenev <vbart@nginx.com>
parents:
5687
diff
changeset
|
2006 sc->stream->out_closed = 1; |
5687
6642690698f1
SPDY: improved ngx_http_spdy_state_protocol_error().
Valentin Bartenev <vbart@nginx.com>
parents:
5686
diff
changeset
|
2007 ngx_http_spdy_close_stream(sc->stream, NGX_HTTP_BAD_REQUEST); |
6642690698f1
SPDY: improved ngx_http_spdy_state_protocol_error().
Valentin Bartenev <vbart@nginx.com>
parents:
5686
diff
changeset
|
2008 } |
6642690698f1
SPDY: improved ngx_http_spdy_state_protocol_error().
Valentin Bartenev <vbart@nginx.com>
parents:
5686
diff
changeset
|
2009 |
5121
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2010 ngx_http_spdy_finalize_connection(sc, NGX_HTTP_CLIENT_CLOSED_REQUEST); |
5687
6642690698f1
SPDY: improved ngx_http_spdy_state_protocol_error().
Valentin Bartenev <vbart@nginx.com>
parents:
5686
diff
changeset
|
2011 |
5121
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2012 return NULL; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2013 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2014 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2015 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2016 static u_char * |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2017 ngx_http_spdy_state_internal_error(ngx_http_spdy_connection_t *sc) |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2018 { |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2019 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, sc->connection->log, 0, |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2020 "spdy state internal error"); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2021 |
5690
fb56f5d612a0
SPDY: improved error handling of header block decompression.
Valentin Bartenev <vbart@nginx.com>
parents:
5689
diff
changeset
|
2022 if (sc->stream) { |
fb56f5d612a0
SPDY: improved error handling of header block decompression.
Valentin Bartenev <vbart@nginx.com>
parents:
5689
diff
changeset
|
2023 sc->stream->out_closed = 1; |
fb56f5d612a0
SPDY: improved error handling of header block decompression.
Valentin Bartenev <vbart@nginx.com>
parents:
5689
diff
changeset
|
2024 ngx_http_spdy_close_stream(sc->stream, NGX_HTTP_INTERNAL_SERVER_ERROR); |
fb56f5d612a0
SPDY: improved error handling of header block decompression.
Valentin Bartenev <vbart@nginx.com>
parents:
5689
diff
changeset
|
2025 } |
fb56f5d612a0
SPDY: improved error handling of header block decompression.
Valentin Bartenev <vbart@nginx.com>
parents:
5689
diff
changeset
|
2026 |
5121
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2027 ngx_http_spdy_finalize_connection(sc, NGX_HTTP_INTERNAL_SERVER_ERROR); |
5690
fb56f5d612a0
SPDY: improved error handling of header block decompression.
Valentin Bartenev <vbart@nginx.com>
parents:
5689
diff
changeset
|
2028 |
5121
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2029 return NULL; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2030 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2031 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2032 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2033 static ngx_int_t |
5549
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
2034 ngx_http_spdy_send_window_update(ngx_http_spdy_connection_t *sc, ngx_uint_t sid, |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
2035 ngx_uint_t delta) |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
2036 { |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
2037 u_char *p; |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
2038 ngx_buf_t *buf; |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
2039 ngx_http_spdy_out_frame_t *frame; |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
2040 |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
2041 ngx_log_debug2(NGX_LOG_DEBUG_HTTP, sc->connection->log, 0, |
5693
701d6e17e42c
SPDY: improved logging.
Valentin Bartenev <vbart@nginx.com>
parents:
5692
diff
changeset
|
2042 "spdy send WINDOW_UPDATE sid:%ui delta:%ui", sid, delta); |
5549
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
2043 |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
2044 frame = ngx_http_spdy_get_ctl_frame(sc, NGX_SPDY_WINDOW_UPDATE_SIZE, |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
2045 NGX_SPDY_HIGHEST_PRIORITY); |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
2046 if (frame == NULL) { |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
2047 return NGX_ERROR; |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
2048 } |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
2049 |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
2050 buf = frame->first->buf; |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
2051 |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
2052 p = buf->pos; |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
2053 |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
2054 p = ngx_spdy_frame_write_head(p, NGX_SPDY_WINDOW_UPDATE); |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
2055 p = ngx_spdy_frame_write_flags_and_len(p, 0, NGX_SPDY_WINDOW_UPDATE_SIZE); |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
2056 |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
2057 p = ngx_spdy_frame_write_sid(p, sid); |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
2058 p = ngx_spdy_frame_aligned_write_uint32(p, delta); |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
2059 |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
2060 buf->last = p; |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
2061 |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
2062 ngx_http_spdy_queue_frame(sc, frame); |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
2063 |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
2064 return NGX_OK; |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
2065 } |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
2066 |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
2067 |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
2068 static ngx_int_t |
5121
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2069 ngx_http_spdy_send_rst_stream(ngx_http_spdy_connection_t *sc, ngx_uint_t sid, |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2070 ngx_uint_t status, ngx_uint_t priority) |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2071 { |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2072 u_char *p; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2073 ngx_buf_t *buf; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2074 ngx_http_spdy_out_frame_t *frame; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2075 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2076 if (sc->connection->error) { |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2077 return NGX_OK; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2078 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2079 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2080 ngx_log_debug2(NGX_LOG_DEBUG_HTTP, sc->connection->log, 0, |
5693
701d6e17e42c
SPDY: improved logging.
Valentin Bartenev <vbart@nginx.com>
parents:
5692
diff
changeset
|
2081 "spdy send RST_STREAM sid:%ui st:%ui", sid, status); |
5121
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2082 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2083 frame = ngx_http_spdy_get_ctl_frame(sc, NGX_SPDY_RST_STREAM_SIZE, |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2084 priority); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2085 if (frame == NULL) { |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2086 return NGX_ERROR; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2087 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2088 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2089 buf = frame->first->buf; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2090 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2091 p = buf->pos; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2092 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2093 p = ngx_spdy_frame_write_head(p, NGX_SPDY_RST_STREAM); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2094 p = ngx_spdy_frame_write_flags_and_len(p, 0, NGX_SPDY_RST_STREAM_SIZE); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2095 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2096 p = ngx_spdy_frame_write_sid(p, sid); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2097 p = ngx_spdy_frame_aligned_write_uint32(p, status); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2098 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2099 buf->last = p; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2100 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2101 ngx_http_spdy_queue_frame(sc, frame); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2102 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2103 return NGX_OK; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2104 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2105 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2106 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2107 #if 0 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2108 static ngx_int_t |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2109 ngx_http_spdy_send_goaway(ngx_http_spdy_connection_t *sc) |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2110 { |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2111 u_char *p; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2112 ngx_buf_t *buf; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2113 ngx_http_spdy_out_frame_t *frame; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2114 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2115 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, sc->connection->log, 0, |
5693
701d6e17e42c
SPDY: improved logging.
Valentin Bartenev <vbart@nginx.com>
parents:
5692
diff
changeset
|
2116 "spdy send GOAWAY sid:%ui", sc->last_sid); |
5121
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2117 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2118 frame = ngx_http_spdy_get_ctl_frame(sc, NGX_SPDY_GOAWAY_SIZE, |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2119 NGX_SPDY_HIGHEST_PRIORITY); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2120 if (frame == NULL) { |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2121 return NGX_ERROR; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2122 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2123 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2124 buf = frame->first->buf; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2125 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2126 p = buf->pos; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2127 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2128 p = ngx_spdy_frame_write_head(p, NGX_SPDY_GOAWAY); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2129 p = ngx_spdy_frame_write_flags_and_len(p, 0, NGX_SPDY_GOAWAY_SIZE); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2130 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2131 p = ngx_spdy_frame_write_sid(p, sc->last_sid); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2132 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2133 buf->last = p; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2134 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2135 ngx_http_spdy_queue_frame(sc, frame); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2136 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2137 return NGX_OK; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2138 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2139 #endif |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2140 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2141 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2142 static ngx_int_t |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2143 ngx_http_spdy_send_settings(ngx_http_spdy_connection_t *sc) |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2144 { |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2145 u_char *p; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2146 ngx_buf_t *buf; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2147 ngx_chain_t *cl; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2148 ngx_http_spdy_srv_conf_t *sscf; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2149 ngx_http_spdy_out_frame_t *frame; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2150 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2151 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, sc->connection->log, 0, |
5693
701d6e17e42c
SPDY: improved logging.
Valentin Bartenev <vbart@nginx.com>
parents:
5692
diff
changeset
|
2152 "spdy send SETTINGS frame"); |
5121
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2153 |
5519
22c249dac7c1
SPDY: the SETTINGS frame should be allocated from sc->pool.
Valentin Bartenev <vbart@nginx.com>
parents:
5518
diff
changeset
|
2154 frame = ngx_palloc(sc->pool, sizeof(ngx_http_spdy_out_frame_t)); |
5121
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2155 if (frame == NULL) { |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2156 return NGX_ERROR; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2157 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2158 |
5519
22c249dac7c1
SPDY: the SETTINGS frame should be allocated from sc->pool.
Valentin Bartenev <vbart@nginx.com>
parents:
5518
diff
changeset
|
2159 cl = ngx_alloc_chain_link(sc->pool); |
5121
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2160 if (cl == NULL) { |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2161 return NGX_ERROR; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2162 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2163 |
5519
22c249dac7c1
SPDY: the SETTINGS frame should be allocated from sc->pool.
Valentin Bartenev <vbart@nginx.com>
parents:
5518
diff
changeset
|
2164 buf = ngx_create_temp_buf(sc->pool, NGX_SPDY_FRAME_HEADER_SIZE |
22c249dac7c1
SPDY: the SETTINGS frame should be allocated from sc->pool.
Valentin Bartenev <vbart@nginx.com>
parents:
5518
diff
changeset
|
2165 + NGX_SPDY_SETTINGS_NUM_SIZE |
5549
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
2166 + 2 * NGX_SPDY_SETTINGS_PAIR_SIZE); |
5121
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2167 if (buf == NULL) { |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2168 return NGX_ERROR; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2169 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2170 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2171 buf->last_buf = 1; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2172 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2173 cl->buf = buf; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2174 cl->next = NULL; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2175 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2176 frame->first = cl; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2177 frame->last = cl; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2178 frame->handler = ngx_http_spdy_settings_frame_handler; |
5518
ec9e9da4c1fb
SPDY: fixed possible uninitialized memory access.
Valentin Bartenev <vbart@nginx.com>
parents:
5510
diff
changeset
|
2179 frame->stream = NULL; |
5121
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2180 #if (NGX_DEBUG) |
5549
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
2181 frame->length = NGX_SPDY_SETTINGS_NUM_SIZE |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
2182 + 2 * NGX_SPDY_SETTINGS_PAIR_SIZE; |
5121
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2183 #endif |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2184 frame->priority = NGX_SPDY_HIGHEST_PRIORITY; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2185 frame->blocked = 0; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2186 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2187 p = buf->pos; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2188 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2189 p = ngx_spdy_frame_write_head(p, NGX_SPDY_SETTINGS); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2190 p = ngx_spdy_frame_write_flags_and_len(p, NGX_SPDY_FLAG_CLEAR_SETTINGS, |
5549
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
2191 NGX_SPDY_SETTINGS_NUM_SIZE |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
2192 + 2 * NGX_SPDY_SETTINGS_PAIR_SIZE); |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
2193 |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
2194 p = ngx_spdy_frame_aligned_write_uint32(p, 2); |
5121
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2195 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2196 sscf = ngx_http_get_module_srv_conf(sc->http_connection->conf_ctx, |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2197 ngx_http_spdy_module); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2198 |
5549
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
2199 p = ngx_spdy_frame_write_flags_and_id(p, 0, NGX_SPDY_SETTINGS_MAX_STREAMS); |
5121
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2200 p = ngx_spdy_frame_aligned_write_uint32(p, sscf->concurrent_streams); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2201 |
5549
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
2202 p = ngx_spdy_frame_write_flags_and_id(p, 0, NGX_SPDY_SETTINGS_INIT_WINDOW); |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
2203 p = ngx_spdy_frame_aligned_write_uint32(p, NGX_SPDY_STREAM_WINDOW); |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
2204 |
5121
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2205 buf->last = p; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2206 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2207 ngx_http_spdy_queue_frame(sc, frame); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2208 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2209 return NGX_OK; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2210 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2211 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2212 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2213 ngx_int_t |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2214 ngx_http_spdy_settings_frame_handler(ngx_http_spdy_connection_t *sc, |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2215 ngx_http_spdy_out_frame_t *frame) |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2216 { |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2217 ngx_buf_t *buf; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2218 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2219 buf = frame->first->buf; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2220 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2221 if (buf->pos != buf->last) { |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2222 return NGX_AGAIN; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2223 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2224 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2225 ngx_free_chain(sc->pool, frame->first); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2226 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2227 return NGX_OK; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2228 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2229 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2230 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2231 static ngx_http_spdy_out_frame_t * |
5529
e4adaa47af65
SPDY: store the length of frame instead of its whole size.
Valentin Bartenev <vbart@nginx.com>
parents:
5528
diff
changeset
|
2232 ngx_http_spdy_get_ctl_frame(ngx_http_spdy_connection_t *sc, size_t length, |
5121
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2233 ngx_uint_t priority) |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2234 { |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2235 ngx_chain_t *cl; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2236 ngx_http_spdy_out_frame_t *frame; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2237 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2238 frame = sc->free_ctl_frames; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2239 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2240 if (frame) { |
5528
d5de6c25b759
SPDY: use frame->next pointer to chain free frames.
Valentin Bartenev <vbart@nginx.com>
parents:
5527
diff
changeset
|
2241 sc->free_ctl_frames = frame->next; |
5121
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2242 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2243 cl = frame->first; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2244 cl->buf->pos = cl->buf->start; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2245 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2246 } else { |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2247 frame = ngx_palloc(sc->pool, sizeof(ngx_http_spdy_out_frame_t)); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2248 if (frame == NULL) { |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2249 return NULL; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2250 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2251 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2252 cl = ngx_alloc_chain_link(sc->pool); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2253 if (cl == NULL) { |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2254 return NULL; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2255 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2256 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2257 cl->buf = ngx_create_temp_buf(sc->pool, |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2258 NGX_SPDY_CTL_FRAME_BUFFER_SIZE); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2259 if (cl->buf == NULL) { |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2260 return NULL; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2261 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2262 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2263 cl->buf->last_buf = 1; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2264 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2265 frame->first = cl; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2266 frame->last = cl; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2267 frame->handler = ngx_http_spdy_ctl_frame_handler; |
5518
ec9e9da4c1fb
SPDY: fixed possible uninitialized memory access.
Valentin Bartenev <vbart@nginx.com>
parents:
5510
diff
changeset
|
2268 frame->stream = NULL; |
5121
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2269 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2270 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2271 #if (NGX_DEBUG) |
5529
e4adaa47af65
SPDY: store the length of frame instead of its whole size.
Valentin Bartenev <vbart@nginx.com>
parents:
5528
diff
changeset
|
2272 if (length > NGX_SPDY_CTL_FRAME_BUFFER_SIZE - NGX_SPDY_FRAME_HEADER_SIZE) { |
5121
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2273 ngx_log_error(NGX_LOG_ALERT, sc->pool->log, 0, |
5693
701d6e17e42c
SPDY: improved logging.
Valentin Bartenev <vbart@nginx.com>
parents:
5692
diff
changeset
|
2274 "requested control frame is too large: %uz", length); |
5121
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2275 return NULL; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2276 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2277 |
5529
e4adaa47af65
SPDY: store the length of frame instead of its whole size.
Valentin Bartenev <vbart@nginx.com>
parents:
5528
diff
changeset
|
2278 frame->length = length; |
5121
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2279 #endif |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2280 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2281 frame->priority = priority; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2282 frame->blocked = 0; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2283 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2284 return frame; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2285 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2286 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2287 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2288 static ngx_int_t |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2289 ngx_http_spdy_ctl_frame_handler(ngx_http_spdy_connection_t *sc, |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2290 ngx_http_spdy_out_frame_t *frame) |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2291 { |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2292 ngx_buf_t *buf; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2293 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2294 buf = frame->first->buf; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2295 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2296 if (buf->pos != buf->last) { |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2297 return NGX_AGAIN; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2298 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2299 |
5528
d5de6c25b759
SPDY: use frame->next pointer to chain free frames.
Valentin Bartenev <vbart@nginx.com>
parents:
5527
diff
changeset
|
2300 frame->next = sc->free_ctl_frames; |
5121
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2301 sc->free_ctl_frames = frame; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2302 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2303 return NGX_OK; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2304 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2305 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2306 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2307 static ngx_http_spdy_stream_t * |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2308 ngx_http_spdy_create_stream(ngx_http_spdy_connection_t *sc, ngx_uint_t id, |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2309 ngx_uint_t priority) |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2310 { |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2311 ngx_log_t *log; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2312 ngx_uint_t index; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2313 ngx_event_t *rev, *wev; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2314 ngx_connection_t *fc; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2315 ngx_http_log_ctx_t *ctx; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2316 ngx_http_request_t *r; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2317 ngx_http_spdy_stream_t *stream; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2318 ngx_http_core_srv_conf_t *cscf; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2319 ngx_http_spdy_srv_conf_t *sscf; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2320 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2321 fc = sc->free_fake_connections; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2322 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2323 if (fc) { |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2324 sc->free_fake_connections = fc->data; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2325 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2326 rev = fc->read; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2327 wev = fc->write; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2328 log = fc->log; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2329 ctx = log->data; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2330 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2331 } else { |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2332 fc = ngx_palloc(sc->pool, sizeof(ngx_connection_t)); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2333 if (fc == NULL) { |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2334 return NULL; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2335 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2336 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2337 rev = ngx_palloc(sc->pool, sizeof(ngx_event_t)); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2338 if (rev == NULL) { |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2339 return NULL; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2340 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2341 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2342 wev = ngx_palloc(sc->pool, sizeof(ngx_event_t)); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2343 if (wev == NULL) { |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2344 return NULL; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2345 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2346 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2347 log = ngx_palloc(sc->pool, sizeof(ngx_log_t)); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2348 if (log == NULL) { |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2349 return NULL; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2350 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2351 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2352 ctx = ngx_palloc(sc->pool, sizeof(ngx_http_log_ctx_t)); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2353 if (ctx == NULL) { |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2354 return NULL; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2355 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2356 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2357 ctx->connection = fc; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2358 ctx->request = NULL; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2359 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2360 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2361 ngx_memcpy(log, sc->connection->log, sizeof(ngx_log_t)); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2362 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2363 log->data = ctx; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2364 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2365 ngx_memzero(rev, sizeof(ngx_event_t)); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2366 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2367 rev->data = fc; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2368 rev->ready = 1; |
5403
7e062646da6f
SPDY: fixed connection leak while waiting for request headers.
Valentin Bartenev <vbart@nginx.com>
parents:
5402
diff
changeset
|
2369 rev->handler = ngx_http_spdy_close_stream_handler; |
5121
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2370 rev->log = log; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2371 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2372 ngx_memcpy(wev, rev, sizeof(ngx_event_t)); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2373 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2374 wev->write = 1; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2375 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2376 ngx_memcpy(fc, sc->connection, sizeof(ngx_connection_t)); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2377 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2378 fc->data = sc->http_connection; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2379 fc->read = rev; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2380 fc->write = wev; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2381 fc->sent = 0; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2382 fc->log = log; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2383 fc->buffered = 0; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2384 fc->sndlowat = 1; |
5182
7a015bbda96f
SPDY: set NGX_TCP_NODELAY_DISABLED for fake connections.
Valentin Bartenev <vbart@nginx.com>
parents:
5121
diff
changeset
|
2385 fc->tcp_nodelay = NGX_TCP_NODELAY_DISABLED; |
5121
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2386 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2387 r = ngx_http_create_request(fc); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2388 if (r == NULL) { |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2389 return NULL; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2390 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2391 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2392 r->valid_location = 1; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2393 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2394 fc->data = r; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2395 sc->connection->requests++; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2396 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2397 cscf = ngx_http_get_module_srv_conf(r, ngx_http_core_module); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2398 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2399 r->header_in = ngx_create_temp_buf(r->pool, |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2400 cscf->client_header_buffer_size); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2401 if (r->header_in == NULL) { |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2402 ngx_http_free_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2403 return NULL; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2404 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2405 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2406 r->headers_in.connection_type = NGX_HTTP_CONNECTION_CLOSE; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2407 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2408 stream = ngx_pcalloc(r->pool, sizeof(ngx_http_spdy_stream_t)); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2409 if (stream == NULL) { |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2410 ngx_http_free_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2411 return NULL; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2412 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2413 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2414 r->spdy_stream = stream; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2415 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2416 stream->id = id; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2417 stream->request = r; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2418 stream->connection = sc; |
5549
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
2419 |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
2420 stream->send_window = sc->init_window; |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
2421 stream->recv_window = NGX_SPDY_STREAM_WINDOW; |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
2422 |
5121
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2423 stream->priority = priority; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2424 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2425 sscf = ngx_http_get_module_srv_conf(r, ngx_http_spdy_module); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2426 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2427 index = ngx_http_spdy_stream_index(sscf, id); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2428 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2429 stream->index = sc->streams_index[index]; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2430 sc->streams_index[index] = stream; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2431 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2432 sc->processing++; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2433 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2434 return stream; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2435 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2436 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2437 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2438 static ngx_http_spdy_stream_t * |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2439 ngx_http_spdy_get_stream_by_id(ngx_http_spdy_connection_t *sc, |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2440 ngx_uint_t sid) |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2441 { |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2442 ngx_http_spdy_stream_t *stream; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2443 ngx_http_spdy_srv_conf_t *sscf; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2444 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2445 sscf = ngx_http_get_module_srv_conf(sc->http_connection->conf_ctx, |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2446 ngx_http_spdy_module); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2447 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2448 stream = sc->streams_index[ngx_http_spdy_stream_index(sscf, sid)]; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2449 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2450 while (stream) { |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2451 if (stream->id == sid) { |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2452 return stream; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2453 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2454 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2455 stream = stream->index; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2456 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2457 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2458 return NULL; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2459 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2460 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2461 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2462 static ngx_int_t |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2463 ngx_http_spdy_parse_header(ngx_http_request_t *r) |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2464 { |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2465 u_char *p, *end, ch; |
5590
6808ea2d69e4
SPDY: fixed potential integer overflow while parsing headers.
Valentin Bartenev <vbart@nginx.com>
parents:
5589
diff
changeset
|
2466 ngx_uint_t hash; |
5121
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2467 ngx_http_core_srv_conf_t *cscf; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2468 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2469 enum { |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2470 sw_name_len = 0, |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2471 sw_name, |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2472 sw_value_len, |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2473 sw_value |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2474 } state; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2475 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2476 state = r->state; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2477 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2478 p = r->header_in->pos; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2479 end = r->header_in->last; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2480 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2481 switch (state) { |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2482 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2483 case sw_name_len: |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2484 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2485 if (end - p < NGX_SPDY_NV_NLEN_SIZE) { |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2486 return NGX_AGAIN; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2487 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2488 |
5590
6808ea2d69e4
SPDY: fixed potential integer overflow while parsing headers.
Valentin Bartenev <vbart@nginx.com>
parents:
5589
diff
changeset
|
2489 r->lowcase_index = ngx_spdy_frame_parse_uint32(p); |
6808ea2d69e4
SPDY: fixed potential integer overflow while parsing headers.
Valentin Bartenev <vbart@nginx.com>
parents:
5589
diff
changeset
|
2490 |
6808ea2d69e4
SPDY: fixed potential integer overflow while parsing headers.
Valentin Bartenev <vbart@nginx.com>
parents:
5589
diff
changeset
|
2491 if (r->lowcase_index == 0) { |
5691
31349361558e
SPDY: ngx_http_spdy_state_headers() error handling cleanup.
Valentin Bartenev <vbart@nginx.com>
parents:
5690
diff
changeset
|
2492 return NGX_ERROR; |
5121
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2493 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2494 |
5323
2be1a9ce9d8e
SPDY: fixed corruption of headers with names longer than 255.
Valentin Bartenev <vbart@nginx.com>
parents:
5281
diff
changeset
|
2495 /* null-terminate the previous header value */ |
2be1a9ce9d8e
SPDY: fixed corruption of headers with names longer than 255.
Valentin Bartenev <vbart@nginx.com>
parents:
5281
diff
changeset
|
2496 *p = '\0'; |
2be1a9ce9d8e
SPDY: fixed corruption of headers with names longer than 255.
Valentin Bartenev <vbart@nginx.com>
parents:
5281
diff
changeset
|
2497 |
5121
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2498 p += NGX_SPDY_NV_NLEN_SIZE; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2499 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2500 r->invalid_header = 0; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2501 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2502 state = sw_name; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2503 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2504 /* fall through */ |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2505 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2506 case sw_name: |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2507 |
5590
6808ea2d69e4
SPDY: fixed potential integer overflow while parsing headers.
Valentin Bartenev <vbart@nginx.com>
parents:
5589
diff
changeset
|
2508 if ((ngx_uint_t) (end - p) < r->lowcase_index) { |
5121
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2509 break; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2510 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2511 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2512 cscf = ngx_http_get_module_srv_conf(r, ngx_http_core_module); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2513 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2514 r->header_name_start = p; |
5590
6808ea2d69e4
SPDY: fixed potential integer overflow while parsing headers.
Valentin Bartenev <vbart@nginx.com>
parents:
5589
diff
changeset
|
2515 r->header_name_end = p + r->lowcase_index; |
5121
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2516 |
5549
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
2517 if (p[0] == ':') { |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
2518 p++; |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
2519 } |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
2520 |
5121
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2521 hash = 0; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2522 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2523 for ( /* void */ ; p != r->header_name_end; p++) { |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2524 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2525 ch = *p; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2526 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2527 hash = ngx_hash(hash, ch); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2528 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2529 if ((ch >= 'a' && ch <= 'z') |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2530 || (ch == '-') |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2531 || (ch >= '0' && ch <= '9') |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2532 || (ch == '_' && cscf->underscores_in_headers)) |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2533 { |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2534 continue; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2535 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2536 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2537 switch (ch) { |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2538 case '\0': |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2539 case LF: |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2540 case CR: |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2541 case ':': |
5693
701d6e17e42c
SPDY: improved logging.
Valentin Bartenev <vbart@nginx.com>
parents:
5692
diff
changeset
|
2542 ngx_log_error(NGX_LOG_INFO, r->connection->log, 0, |
701d6e17e42c
SPDY: improved logging.
Valentin Bartenev <vbart@nginx.com>
parents:
5692
diff
changeset
|
2543 "client sent invalid header name: \"%*s\"", |
701d6e17e42c
SPDY: improved logging.
Valentin Bartenev <vbart@nginx.com>
parents:
5692
diff
changeset
|
2544 r->lowcase_index, r->header_name_start); |
701d6e17e42c
SPDY: improved logging.
Valentin Bartenev <vbart@nginx.com>
parents:
5692
diff
changeset
|
2545 |
5691
31349361558e
SPDY: ngx_http_spdy_state_headers() error handling cleanup.
Valentin Bartenev <vbart@nginx.com>
parents:
5690
diff
changeset
|
2546 return NGX_HTTP_PARSE_INVALID_HEADER; |
5121
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2547 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2548 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2549 if (ch >= 'A' && ch <= 'Z') { |
5691
31349361558e
SPDY: ngx_http_spdy_state_headers() error handling cleanup.
Valentin Bartenev <vbart@nginx.com>
parents:
5690
diff
changeset
|
2550 return NGX_ERROR; |
5121
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2551 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2552 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2553 r->invalid_header = 1; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2554 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2555 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2556 r->header_hash = hash; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2557 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2558 state = sw_value_len; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2559 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2560 /* fall through */ |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2561 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2562 case sw_value_len: |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2563 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2564 if (end - p < NGX_SPDY_NV_VLEN_SIZE) { |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2565 break; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2566 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2567 |
5590
6808ea2d69e4
SPDY: fixed potential integer overflow while parsing headers.
Valentin Bartenev <vbart@nginx.com>
parents:
5589
diff
changeset
|
2568 r->lowcase_index = ngx_spdy_frame_parse_uint32(p); |
5121
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2569 |
5323
2be1a9ce9d8e
SPDY: fixed corruption of headers with names longer than 255.
Valentin Bartenev <vbart@nginx.com>
parents:
5281
diff
changeset
|
2570 /* null-terminate header name */ |
2be1a9ce9d8e
SPDY: fixed corruption of headers with names longer than 255.
Valentin Bartenev <vbart@nginx.com>
parents:
5281
diff
changeset
|
2571 *p = '\0'; |
2be1a9ce9d8e
SPDY: fixed corruption of headers with names longer than 255.
Valentin Bartenev <vbart@nginx.com>
parents:
5281
diff
changeset
|
2572 |
5121
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2573 p += NGX_SPDY_NV_VLEN_SIZE; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2574 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2575 state = sw_value; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2576 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2577 /* fall through */ |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2578 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2579 case sw_value: |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2580 |
5590
6808ea2d69e4
SPDY: fixed potential integer overflow while parsing headers.
Valentin Bartenev <vbart@nginx.com>
parents:
5589
diff
changeset
|
2581 if ((ngx_uint_t) (end - p) < r->lowcase_index) { |
5121
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2582 break; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2583 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2584 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2585 r->header_start = p; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2586 |
5590
6808ea2d69e4
SPDY: fixed potential integer overflow while parsing headers.
Valentin Bartenev <vbart@nginx.com>
parents:
5589
diff
changeset
|
2587 while (r->lowcase_index--) { |
5121
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2588 ch = *p; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2589 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2590 if (ch == '\0') { |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2591 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2592 if (p == r->header_start) { |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2593 return NGX_ERROR; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2594 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2595 |
5590
6808ea2d69e4
SPDY: fixed potential integer overflow while parsing headers.
Valentin Bartenev <vbart@nginx.com>
parents:
5589
diff
changeset
|
2596 r->header_end = p; |
5121
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2597 r->header_in->pos = p + 1; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2598 |
5762
b522d5b137fd
SPDY: fix support for headers with multiple values.
Piotr Sikora <piotr@cloudflare.com>
parents:
5696
diff
changeset
|
2599 r->state = sw_value; |
b522d5b137fd
SPDY: fix support for headers with multiple values.
Piotr Sikora <piotr@cloudflare.com>
parents:
5696
diff
changeset
|
2600 |
5121
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2601 return NGX_OK; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2602 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2603 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2604 if (ch == CR || ch == LF) { |
5693
701d6e17e42c
SPDY: improved logging.
Valentin Bartenev <vbart@nginx.com>
parents:
5692
diff
changeset
|
2605 ngx_log_error(NGX_LOG_INFO, r->connection->log, 0, |
701d6e17e42c
SPDY: improved logging.
Valentin Bartenev <vbart@nginx.com>
parents:
5692
diff
changeset
|
2606 "client sent header \"%*s\" with " |
701d6e17e42c
SPDY: improved logging.
Valentin Bartenev <vbart@nginx.com>
parents:
5692
diff
changeset
|
2607 "invalid value: \"%*s\\%c...\"", |
701d6e17e42c
SPDY: improved logging.
Valentin Bartenev <vbart@nginx.com>
parents:
5692
diff
changeset
|
2608 r->header_name_end - r->header_name_start, |
701d6e17e42c
SPDY: improved logging.
Valentin Bartenev <vbart@nginx.com>
parents:
5692
diff
changeset
|
2609 r->header_name_start, |
701d6e17e42c
SPDY: improved logging.
Valentin Bartenev <vbart@nginx.com>
parents:
5692
diff
changeset
|
2610 p - r->header_start, |
701d6e17e42c
SPDY: improved logging.
Valentin Bartenev <vbart@nginx.com>
parents:
5692
diff
changeset
|
2611 r->header_start, |
701d6e17e42c
SPDY: improved logging.
Valentin Bartenev <vbart@nginx.com>
parents:
5692
diff
changeset
|
2612 ch == CR ? 'r' : 'n'); |
701d6e17e42c
SPDY: improved logging.
Valentin Bartenev <vbart@nginx.com>
parents:
5692
diff
changeset
|
2613 |
5121
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2614 return NGX_HTTP_PARSE_INVALID_HEADER; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2615 } |
5590
6808ea2d69e4
SPDY: fixed potential integer overflow while parsing headers.
Valentin Bartenev <vbart@nginx.com>
parents:
5589
diff
changeset
|
2616 |
6808ea2d69e4
SPDY: fixed potential integer overflow while parsing headers.
Valentin Bartenev <vbart@nginx.com>
parents:
5589
diff
changeset
|
2617 p++; |
5121
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2618 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2619 |
5590
6808ea2d69e4
SPDY: fixed potential integer overflow while parsing headers.
Valentin Bartenev <vbart@nginx.com>
parents:
5589
diff
changeset
|
2620 r->header_end = p; |
5121
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2621 r->header_in->pos = p; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2622 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2623 r->state = 0; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2624 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2625 return NGX_DONE; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2626 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2627 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2628 r->header_in->pos = p; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2629 r->state = state; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2630 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2631 return NGX_AGAIN; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2632 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2633 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2634 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2635 static ngx_int_t |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2636 ngx_http_spdy_alloc_large_header_buffer(ngx_http_request_t *r) |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2637 { |
5693
701d6e17e42c
SPDY: improved logging.
Valentin Bartenev <vbart@nginx.com>
parents:
5692
diff
changeset
|
2638 u_char *old, *new, *p; |
5121
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2639 size_t rest; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2640 ngx_buf_t *buf; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2641 ngx_http_spdy_stream_t *stream; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2642 ngx_http_core_srv_conf_t *cscf; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2643 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2644 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2645 "spdy alloc large header buffer"); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2646 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2647 stream = r->spdy_stream; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2648 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2649 cscf = ngx_http_get_module_srv_conf(r, ngx_http_core_module); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2650 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2651 if (stream->header_buffers |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2652 == (ngx_uint_t) cscf->large_client_header_buffers.num) |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2653 { |
5693
701d6e17e42c
SPDY: improved logging.
Valentin Bartenev <vbart@nginx.com>
parents:
5692
diff
changeset
|
2654 ngx_log_error(NGX_LOG_INFO, r->connection->log, 0, |
701d6e17e42c
SPDY: improved logging.
Valentin Bartenev <vbart@nginx.com>
parents:
5692
diff
changeset
|
2655 "client sent too large request"); |
701d6e17e42c
SPDY: improved logging.
Valentin Bartenev <vbart@nginx.com>
parents:
5692
diff
changeset
|
2656 |
5121
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2657 return NGX_DECLINED; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2658 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2659 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2660 rest = r->header_in->last - r->header_in->pos; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2661 |
5693
701d6e17e42c
SPDY: improved logging.
Valentin Bartenev <vbart@nginx.com>
parents:
5692
diff
changeset
|
2662 /* |
5904
abb466a57a22
SPDY: fixed check for too long header name or value.
Valentin Bartenev <vbart@nginx.com>
parents:
5903
diff
changeset
|
2663 * One more byte is needed for null-termination |
abb466a57a22
SPDY: fixed check for too long header name or value.
Valentin Bartenev <vbart@nginx.com>
parents:
5903
diff
changeset
|
2664 * and another one for further progress. |
5693
701d6e17e42c
SPDY: improved logging.
Valentin Bartenev <vbart@nginx.com>
parents:
5692
diff
changeset
|
2665 */ |
5904
abb466a57a22
SPDY: fixed check for too long header name or value.
Valentin Bartenev <vbart@nginx.com>
parents:
5903
diff
changeset
|
2666 if (rest > cscf->large_client_header_buffers.size - 2) { |
5693
701d6e17e42c
SPDY: improved logging.
Valentin Bartenev <vbart@nginx.com>
parents:
5692
diff
changeset
|
2667 p = r->header_in->pos; |
701d6e17e42c
SPDY: improved logging.
Valentin Bartenev <vbart@nginx.com>
parents:
5692
diff
changeset
|
2668 |
701d6e17e42c
SPDY: improved logging.
Valentin Bartenev <vbart@nginx.com>
parents:
5692
diff
changeset
|
2669 if (rest > NGX_MAX_ERROR_STR - 300) { |
701d6e17e42c
SPDY: improved logging.
Valentin Bartenev <vbart@nginx.com>
parents:
5692
diff
changeset
|
2670 rest = NGX_MAX_ERROR_STR - 300; |
701d6e17e42c
SPDY: improved logging.
Valentin Bartenev <vbart@nginx.com>
parents:
5692
diff
changeset
|
2671 } |
701d6e17e42c
SPDY: improved logging.
Valentin Bartenev <vbart@nginx.com>
parents:
5692
diff
changeset
|
2672 |
701d6e17e42c
SPDY: improved logging.
Valentin Bartenev <vbart@nginx.com>
parents:
5692
diff
changeset
|
2673 ngx_log_error(NGX_LOG_INFO, r->connection->log, 0, |
5899
234c5ecb00c0
SPDY: fixed "too long header line" logging.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5821
diff
changeset
|
2674 "client sent too long header name or value: \"%*s...\"", |
5693
701d6e17e42c
SPDY: improved logging.
Valentin Bartenev <vbart@nginx.com>
parents:
5692
diff
changeset
|
2675 rest, p); |
701d6e17e42c
SPDY: improved logging.
Valentin Bartenev <vbart@nginx.com>
parents:
5692
diff
changeset
|
2676 |
5121
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2677 return NGX_DECLINED; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2678 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2679 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2680 buf = ngx_create_temp_buf(r->pool, cscf->large_client_header_buffers.size); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2681 if (buf == NULL) { |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2682 return NGX_ERROR; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2683 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2684 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2685 ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, |
5693
701d6e17e42c
SPDY: improved logging.
Valentin Bartenev <vbart@nginx.com>
parents:
5692
diff
changeset
|
2686 "spdy large header alloc: %p %uz", |
5121
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2687 buf->pos, buf->end - buf->last); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2688 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2689 old = r->header_in->pos; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2690 new = buf->pos; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2691 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2692 if (rest) { |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2693 buf->last = ngx_cpymem(new, old, rest); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2694 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2695 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2696 r->header_in = buf; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2697 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2698 stream->header_buffers++; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2699 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2700 return NGX_OK; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2701 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2702 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2703 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2704 static ngx_int_t |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2705 ngx_http_spdy_handle_request_header(ngx_http_request_t *r) |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2706 { |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2707 ngx_uint_t i; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2708 ngx_table_elt_t *h; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2709 ngx_http_core_srv_conf_t *cscf; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2710 ngx_http_spdy_request_header_t *sh; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2711 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2712 if (r->invalid_header) { |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2713 cscf = ngx_http_get_module_srv_conf(r, ngx_http_core_module); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2714 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2715 if (cscf->ignore_invalid_headers) { |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2716 ngx_log_error(NGX_LOG_INFO, r->connection->log, 0, |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2717 "client sent invalid header: \"%*s\"", |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2718 r->header_end - r->header_name_start, |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2719 r->header_name_start); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2720 return NGX_OK; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2721 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2722 |
5549
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
2723 } |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
2724 |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
2725 if (r->header_name_start[0] == ':') { |
5590
6808ea2d69e4
SPDY: fixed potential integer overflow while parsing headers.
Valentin Bartenev <vbart@nginx.com>
parents:
5589
diff
changeset
|
2726 r->header_name_start++; |
6808ea2d69e4
SPDY: fixed potential integer overflow while parsing headers.
Valentin Bartenev <vbart@nginx.com>
parents:
5589
diff
changeset
|
2727 |
5121
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2728 for (i = 0; i < NGX_SPDY_REQUEST_HEADERS; i++) { |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2729 sh = &ngx_http_spdy_request_headers[i]; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2730 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2731 if (sh->hash != r->header_hash |
5590
6808ea2d69e4
SPDY: fixed potential integer overflow while parsing headers.
Valentin Bartenev <vbart@nginx.com>
parents:
5589
diff
changeset
|
2732 || sh->len != r->header_name_end - r->header_name_start |
6808ea2d69e4
SPDY: fixed potential integer overflow while parsing headers.
Valentin Bartenev <vbart@nginx.com>
parents:
5589
diff
changeset
|
2733 || ngx_strncmp(sh->header, r->header_name_start, sh->len) != 0) |
5121
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2734 { |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2735 continue; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2736 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2737 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2738 return sh->handler(r); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2739 } |
5549
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
2740 |
5693
701d6e17e42c
SPDY: improved logging.
Valentin Bartenev <vbart@nginx.com>
parents:
5692
diff
changeset
|
2741 ngx_log_error(NGX_LOG_INFO, r->connection->log, 0, |
701d6e17e42c
SPDY: improved logging.
Valentin Bartenev <vbart@nginx.com>
parents:
5692
diff
changeset
|
2742 "client sent invalid header name: \":%*s\"", |
701d6e17e42c
SPDY: improved logging.
Valentin Bartenev <vbart@nginx.com>
parents:
5692
diff
changeset
|
2743 r->header_end - r->header_name_start, |
701d6e17e42c
SPDY: improved logging.
Valentin Bartenev <vbart@nginx.com>
parents:
5692
diff
changeset
|
2744 r->header_name_start); |
701d6e17e42c
SPDY: improved logging.
Valentin Bartenev <vbart@nginx.com>
parents:
5692
diff
changeset
|
2745 |
5691
31349361558e
SPDY: ngx_http_spdy_state_headers() error handling cleanup.
Valentin Bartenev <vbart@nginx.com>
parents:
5690
diff
changeset
|
2746 return NGX_HTTP_PARSE_INVALID_HEADER; |
5121
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2747 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2748 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2749 h = ngx_list_push(&r->headers_in.headers); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2750 if (h == NULL) { |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2751 return NGX_ERROR; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2752 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2753 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2754 h->hash = r->header_hash; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2755 |
5590
6808ea2d69e4
SPDY: fixed potential integer overflow while parsing headers.
Valentin Bartenev <vbart@nginx.com>
parents:
5589
diff
changeset
|
2756 h->key.len = r->header_name_end - r->header_name_start; |
5121
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2757 h->key.data = r->header_name_start; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2758 |
5590
6808ea2d69e4
SPDY: fixed potential integer overflow while parsing headers.
Valentin Bartenev <vbart@nginx.com>
parents:
5589
diff
changeset
|
2759 h->value.len = r->header_end - r->header_start; |
5121
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2760 h->value.data = r->header_start; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2761 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2762 h->lowcase_key = h->key.data; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2763 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2764 return NGX_OK; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2765 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2766 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2767 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2768 void |
5225
15a7deeaa19a
Use "void" for functions with empty parameter list.
Sergey Kandaurov <pluknet@nginx.com>
parents:
5182
diff
changeset
|
2769 ngx_http_spdy_request_headers_init(void) |
5121
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2770 { |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2771 ngx_uint_t i; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2772 ngx_http_spdy_request_header_t *h; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2773 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2774 for (i = 0; i < NGX_SPDY_REQUEST_HEADERS; i++) { |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2775 h = &ngx_http_spdy_request_headers[i]; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2776 h->hash = ngx_hash_key(h->header, h->len); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2777 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2778 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2779 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2780 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2781 static ngx_int_t |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2782 ngx_http_spdy_parse_method(ngx_http_request_t *r) |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2783 { |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2784 size_t k, len; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2785 ngx_uint_t n; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2786 const u_char *p, *m; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2787 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2788 /* |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2789 * This array takes less than 256 sequential bytes, |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2790 * and if typical CPU cache line size is 64 bytes, |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2791 * it is prefetched for 4 load operations. |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2792 */ |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2793 static const struct { |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2794 u_char len; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2795 const u_char method[11]; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2796 uint32_t value; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2797 } tests[] = { |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2798 { 3, "GET", NGX_HTTP_GET }, |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2799 { 4, "POST", NGX_HTTP_POST }, |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2800 { 4, "HEAD", NGX_HTTP_HEAD }, |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2801 { 7, "OPTIONS", NGX_HTTP_OPTIONS }, |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2802 { 8, "PROPFIND", NGX_HTTP_PROPFIND }, |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2803 { 3, "PUT", NGX_HTTP_PUT }, |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2804 { 5, "MKCOL", NGX_HTTP_MKCOL }, |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2805 { 6, "DELETE", NGX_HTTP_DELETE }, |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2806 { 4, "COPY", NGX_HTTP_COPY }, |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2807 { 4, "MOVE", NGX_HTTP_MOVE }, |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2808 { 9, "PROPPATCH", NGX_HTTP_PROPPATCH }, |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2809 { 4, "LOCK", NGX_HTTP_LOCK }, |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2810 { 6, "UNLOCK", NGX_HTTP_UNLOCK }, |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2811 { 5, "PATCH", NGX_HTTP_PATCH }, |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2812 { 5, "TRACE", NGX_HTTP_TRACE } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2813 }, *test; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2814 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2815 if (r->method_name.len) { |
5693
701d6e17e42c
SPDY: improved logging.
Valentin Bartenev <vbart@nginx.com>
parents:
5692
diff
changeset
|
2816 ngx_log_error(NGX_LOG_INFO, r->connection->log, 0, |
701d6e17e42c
SPDY: improved logging.
Valentin Bartenev <vbart@nginx.com>
parents:
5692
diff
changeset
|
2817 "client sent duplicate :method header"); |
701d6e17e42c
SPDY: improved logging.
Valentin Bartenev <vbart@nginx.com>
parents:
5692
diff
changeset
|
2818 |
5121
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2819 return NGX_HTTP_PARSE_INVALID_HEADER; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2820 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2821 |
5590
6808ea2d69e4
SPDY: fixed potential integer overflow while parsing headers.
Valentin Bartenev <vbart@nginx.com>
parents:
5589
diff
changeset
|
2822 len = r->header_end - r->header_start; |
5121
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2823 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2824 r->method_name.len = len; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2825 r->method_name.data = r->header_start; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2826 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2827 test = tests; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2828 n = sizeof(tests) / sizeof(tests[0]); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2829 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2830 do { |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2831 if (len == test->len) { |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2832 p = r->method_name.data; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2833 m = test->method; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2834 k = len; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2835 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2836 do { |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2837 if (*p++ != *m++) { |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2838 goto next; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2839 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2840 } while (--k); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2841 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2842 r->method = test->value; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2843 return NGX_OK; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2844 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2845 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2846 next: |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2847 test++; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2848 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2849 } while (--n); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2850 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2851 p = r->method_name.data; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2852 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2853 do { |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2854 if ((*p < 'A' || *p > 'Z') && *p != '_') { |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2855 ngx_log_error(NGX_LOG_INFO, r->connection->log, 0, |
5693
701d6e17e42c
SPDY: improved logging.
Valentin Bartenev <vbart@nginx.com>
parents:
5692
diff
changeset
|
2856 "client sent invalid method: \"%V\"", |
701d6e17e42c
SPDY: improved logging.
Valentin Bartenev <vbart@nginx.com>
parents:
5692
diff
changeset
|
2857 &r->method_name); |
701d6e17e42c
SPDY: improved logging.
Valentin Bartenev <vbart@nginx.com>
parents:
5692
diff
changeset
|
2858 |
5691
31349361558e
SPDY: ngx_http_spdy_state_headers() error handling cleanup.
Valentin Bartenev <vbart@nginx.com>
parents:
5690
diff
changeset
|
2859 return NGX_HTTP_PARSE_INVALID_HEADER; |
5121
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2860 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2861 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2862 p++; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2863 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2864 } while (--len); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2865 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2866 return NGX_OK; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2867 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2868 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2869 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2870 static ngx_int_t |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2871 ngx_http_spdy_parse_scheme(ngx_http_request_t *r) |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2872 { |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2873 if (r->schema_start) { |
5693
701d6e17e42c
SPDY: improved logging.
Valentin Bartenev <vbart@nginx.com>
parents:
5692
diff
changeset
|
2874 ngx_log_error(NGX_LOG_INFO, r->connection->log, 0, |
701d6e17e42c
SPDY: improved logging.
Valentin Bartenev <vbart@nginx.com>
parents:
5692
diff
changeset
|
2875 "client sent duplicate :schema header"); |
701d6e17e42c
SPDY: improved logging.
Valentin Bartenev <vbart@nginx.com>
parents:
5692
diff
changeset
|
2876 |
5121
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2877 return NGX_HTTP_PARSE_INVALID_HEADER; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2878 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2879 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2880 r->schema_start = r->header_start; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2881 r->schema_end = r->header_end; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2882 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2883 return NGX_OK; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2884 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2885 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2886 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2887 static ngx_int_t |
5549
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
2888 ngx_http_spdy_parse_host(ngx_http_request_t *r) |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
2889 { |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
2890 ngx_table_elt_t *h; |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
2891 |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
2892 if (r->headers_in.host) { |
5693
701d6e17e42c
SPDY: improved logging.
Valentin Bartenev <vbart@nginx.com>
parents:
5692
diff
changeset
|
2893 ngx_log_error(NGX_LOG_INFO, r->connection->log, 0, |
701d6e17e42c
SPDY: improved logging.
Valentin Bartenev <vbart@nginx.com>
parents:
5692
diff
changeset
|
2894 "client sent duplicate :host header"); |
701d6e17e42c
SPDY: improved logging.
Valentin Bartenev <vbart@nginx.com>
parents:
5692
diff
changeset
|
2895 |
5549
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
2896 return NGX_HTTP_PARSE_INVALID_HEADER; |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
2897 } |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
2898 |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
2899 h = ngx_list_push(&r->headers_in.headers); |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
2900 if (h == NULL) { |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
2901 return NGX_ERROR; |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
2902 } |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
2903 |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
2904 r->headers_in.host = h; |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
2905 |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
2906 h->hash = r->header_hash; |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
2907 |
5590
6808ea2d69e4
SPDY: fixed potential integer overflow while parsing headers.
Valentin Bartenev <vbart@nginx.com>
parents:
5589
diff
changeset
|
2908 h->key.len = r->header_name_end - r->header_name_start; |
6808ea2d69e4
SPDY: fixed potential integer overflow while parsing headers.
Valentin Bartenev <vbart@nginx.com>
parents:
5589
diff
changeset
|
2909 h->key.data = r->header_name_start; |
6808ea2d69e4
SPDY: fixed potential integer overflow while parsing headers.
Valentin Bartenev <vbart@nginx.com>
parents:
5589
diff
changeset
|
2910 |
6808ea2d69e4
SPDY: fixed potential integer overflow while parsing headers.
Valentin Bartenev <vbart@nginx.com>
parents:
5589
diff
changeset
|
2911 h->value.len = r->header_end - r->header_start; |
5549
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
2912 h->value.data = r->header_start; |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
2913 |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
2914 h->lowcase_key = h->key.data; |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
2915 |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
2916 return NGX_OK; |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
2917 } |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
2918 |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
2919 |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
2920 static ngx_int_t |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
2921 ngx_http_spdy_parse_path(ngx_http_request_t *r) |
5121
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2922 { |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2923 if (r->unparsed_uri.len) { |
5693
701d6e17e42c
SPDY: improved logging.
Valentin Bartenev <vbart@nginx.com>
parents:
5692
diff
changeset
|
2924 ngx_log_error(NGX_LOG_INFO, r->connection->log, 0, |
701d6e17e42c
SPDY: improved logging.
Valentin Bartenev <vbart@nginx.com>
parents:
5692
diff
changeset
|
2925 "client sent duplicate :path header"); |
701d6e17e42c
SPDY: improved logging.
Valentin Bartenev <vbart@nginx.com>
parents:
5692
diff
changeset
|
2926 |
5121
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2927 return NGX_HTTP_PARSE_INVALID_HEADER; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2928 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2929 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2930 r->uri_start = r->header_start; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2931 r->uri_end = r->header_end; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2932 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2933 if (ngx_http_parse_uri(r) != NGX_OK) { |
5693
701d6e17e42c
SPDY: improved logging.
Valentin Bartenev <vbart@nginx.com>
parents:
5692
diff
changeset
|
2934 ngx_log_error(NGX_LOG_INFO, r->connection->log, 0, |
701d6e17e42c
SPDY: improved logging.
Valentin Bartenev <vbart@nginx.com>
parents:
5692
diff
changeset
|
2935 "client sent invalid URI: \"%*s\"", |
701d6e17e42c
SPDY: improved logging.
Valentin Bartenev <vbart@nginx.com>
parents:
5692
diff
changeset
|
2936 r->uri_end - r->uri_start, r->uri_start); |
701d6e17e42c
SPDY: improved logging.
Valentin Bartenev <vbart@nginx.com>
parents:
5692
diff
changeset
|
2937 |
5691
31349361558e
SPDY: ngx_http_spdy_state_headers() error handling cleanup.
Valentin Bartenev <vbart@nginx.com>
parents:
5690
diff
changeset
|
2938 return NGX_HTTP_PARSE_INVALID_HEADER; |
5121
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2939 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2940 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2941 if (ngx_http_process_request_uri(r) != NGX_OK) { |
5691
31349361558e
SPDY: ngx_http_spdy_state_headers() error handling cleanup.
Valentin Bartenev <vbart@nginx.com>
parents:
5690
diff
changeset
|
2942 /* |
31349361558e
SPDY: ngx_http_spdy_state_headers() error handling cleanup.
Valentin Bartenev <vbart@nginx.com>
parents:
5690
diff
changeset
|
2943 * request has been finalized already |
31349361558e
SPDY: ngx_http_spdy_state_headers() error handling cleanup.
Valentin Bartenev <vbart@nginx.com>
parents:
5690
diff
changeset
|
2944 * in ngx_http_process_request_uri() |
31349361558e
SPDY: ngx_http_spdy_state_headers() error handling cleanup.
Valentin Bartenev <vbart@nginx.com>
parents:
5690
diff
changeset
|
2945 */ |
31349361558e
SPDY: ngx_http_spdy_state_headers() error handling cleanup.
Valentin Bartenev <vbart@nginx.com>
parents:
5690
diff
changeset
|
2946 return NGX_ABORT; |
5121
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2947 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2948 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2949 return NGX_OK; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2950 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2951 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2952 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2953 static ngx_int_t |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2954 ngx_http_spdy_parse_version(ngx_http_request_t *r) |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2955 { |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2956 u_char *p, ch; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2957 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2958 if (r->http_protocol.len) { |
5693
701d6e17e42c
SPDY: improved logging.
Valentin Bartenev <vbart@nginx.com>
parents:
5692
diff
changeset
|
2959 ngx_log_error(NGX_LOG_INFO, r->connection->log, 0, |
701d6e17e42c
SPDY: improved logging.
Valentin Bartenev <vbart@nginx.com>
parents:
5692
diff
changeset
|
2960 "client sent duplicate :version header"); |
701d6e17e42c
SPDY: improved logging.
Valentin Bartenev <vbart@nginx.com>
parents:
5692
diff
changeset
|
2961 |
5121
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2962 return NGX_HTTP_PARSE_INVALID_HEADER; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2963 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2964 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2965 p = r->header_start; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2966 |
5590
6808ea2d69e4
SPDY: fixed potential integer overflow while parsing headers.
Valentin Bartenev <vbart@nginx.com>
parents:
5589
diff
changeset
|
2967 if (r->header_end - p < 8 || !(ngx_str5cmp(p, 'H', 'T', 'T', 'P', '/'))) { |
5693
701d6e17e42c
SPDY: improved logging.
Valentin Bartenev <vbart@nginx.com>
parents:
5692
diff
changeset
|
2968 goto invalid; |
5121
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2969 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2970 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2971 ch = *(p + 5); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2972 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2973 if (ch < '1' || ch > '9') { |
5693
701d6e17e42c
SPDY: improved logging.
Valentin Bartenev <vbart@nginx.com>
parents:
5692
diff
changeset
|
2974 goto invalid; |
5121
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2975 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2976 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2977 r->http_major = ch - '0'; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2978 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2979 for (p += 6; p != r->header_end - 2; p++) { |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2980 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2981 ch = *p; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2982 |
5574
cff36d2d7fe6
SPDY: fixed parsing of http version.
Xiaochen Wang <wangxiaochen0@gmail.com>
parents:
5553
diff
changeset
|
2983 if (ch == '.') { |
cff36d2d7fe6
SPDY: fixed parsing of http version.
Xiaochen Wang <wangxiaochen0@gmail.com>
parents:
5553
diff
changeset
|
2984 break; |
cff36d2d7fe6
SPDY: fixed parsing of http version.
Xiaochen Wang <wangxiaochen0@gmail.com>
parents:
5553
diff
changeset
|
2985 } |
cff36d2d7fe6
SPDY: fixed parsing of http version.
Xiaochen Wang <wangxiaochen0@gmail.com>
parents:
5553
diff
changeset
|
2986 |
5121
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2987 if (ch < '0' || ch > '9') { |
5693
701d6e17e42c
SPDY: improved logging.
Valentin Bartenev <vbart@nginx.com>
parents:
5692
diff
changeset
|
2988 goto invalid; |
5121
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2989 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2990 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2991 r->http_major = r->http_major * 10 + ch - '0'; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2992 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2993 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2994 if (*p != '.') { |
5693
701d6e17e42c
SPDY: improved logging.
Valentin Bartenev <vbart@nginx.com>
parents:
5692
diff
changeset
|
2995 goto invalid; |
5121
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2996 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2997 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2998 ch = *(p + 1); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
2999 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3000 if (ch < '0' || ch > '9') { |
5693
701d6e17e42c
SPDY: improved logging.
Valentin Bartenev <vbart@nginx.com>
parents:
5692
diff
changeset
|
3001 goto invalid; |
5121
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3002 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3003 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3004 r->http_minor = ch - '0'; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3005 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3006 for (p += 2; p != r->header_end; p++) { |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3007 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3008 ch = *p; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3009 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3010 if (ch < '0' || ch > '9') { |
5693
701d6e17e42c
SPDY: improved logging.
Valentin Bartenev <vbart@nginx.com>
parents:
5692
diff
changeset
|
3011 goto invalid; |
5121
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3012 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3013 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3014 r->http_minor = r->http_minor * 10 + ch - '0'; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3015 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3016 |
5590
6808ea2d69e4
SPDY: fixed potential integer overflow while parsing headers.
Valentin Bartenev <vbart@nginx.com>
parents:
5589
diff
changeset
|
3017 r->http_protocol.len = r->header_end - r->header_start; |
5121
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3018 r->http_protocol.data = r->header_start; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3019 r->http_version = r->http_major * 1000 + r->http_minor; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3020 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3021 return NGX_OK; |
5693
701d6e17e42c
SPDY: improved logging.
Valentin Bartenev <vbart@nginx.com>
parents:
5692
diff
changeset
|
3022 |
701d6e17e42c
SPDY: improved logging.
Valentin Bartenev <vbart@nginx.com>
parents:
5692
diff
changeset
|
3023 invalid: |
701d6e17e42c
SPDY: improved logging.
Valentin Bartenev <vbart@nginx.com>
parents:
5692
diff
changeset
|
3024 |
701d6e17e42c
SPDY: improved logging.
Valentin Bartenev <vbart@nginx.com>
parents:
5692
diff
changeset
|
3025 ngx_log_error(NGX_LOG_INFO, r->connection->log, 0, |
701d6e17e42c
SPDY: improved logging.
Valentin Bartenev <vbart@nginx.com>
parents:
5692
diff
changeset
|
3026 "client sent invalid http version: \"%*s\"", |
701d6e17e42c
SPDY: improved logging.
Valentin Bartenev <vbart@nginx.com>
parents:
5692
diff
changeset
|
3027 r->header_end - r->header_start, r->header_start); |
701d6e17e42c
SPDY: improved logging.
Valentin Bartenev <vbart@nginx.com>
parents:
5692
diff
changeset
|
3028 |
701d6e17e42c
SPDY: improved logging.
Valentin Bartenev <vbart@nginx.com>
parents:
5692
diff
changeset
|
3029 return NGX_HTTP_PARSE_INVALID_HEADER; |
5121
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3030 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3031 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3032 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3033 static ngx_int_t |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3034 ngx_http_spdy_construct_request_line(ngx_http_request_t *r) |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3035 { |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3036 u_char *p; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3037 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3038 if (r->method_name.len == 0 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3039 || r->unparsed_uri.len == 0 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3040 || r->http_protocol.len == 0) |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3041 { |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3042 ngx_http_finalize_request(r, NGX_HTTP_BAD_REQUEST); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3043 return NGX_ERROR; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3044 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3045 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3046 r->request_line.len = r->method_name.len + 1 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3047 + r->unparsed_uri.len + 1 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3048 + r->http_protocol.len; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3049 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3050 p = ngx_pnalloc(r->pool, r->request_line.len + 1); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3051 if (p == NULL) { |
5686
5cf537731218
SPDY: fixed one case of improper memory allocation error handling.
Valentin Bartenev <vbart@nginx.com>
parents:
5665
diff
changeset
|
3052 ngx_http_spdy_close_stream(r->spdy_stream, |
5cf537731218
SPDY: fixed one case of improper memory allocation error handling.
Valentin Bartenev <vbart@nginx.com>
parents:
5665
diff
changeset
|
3053 NGX_HTTP_INTERNAL_SERVER_ERROR); |
5121
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3054 return NGX_ERROR; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3055 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3056 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3057 r->request_line.data = p; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3058 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3059 p = ngx_cpymem(p, r->method_name.data, r->method_name.len); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3060 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3061 *p++ = ' '; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3062 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3063 p = ngx_cpymem(p, r->unparsed_uri.data, r->unparsed_uri.len); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3064 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3065 *p++ = ' '; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3066 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3067 ngx_memcpy(p, r->http_protocol.data, r->http_protocol.len + 1); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3068 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3069 /* some modules expect the space character after method name */ |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3070 r->method_name.data = r->request_line.data; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3071 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3072 return NGX_OK; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3073 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3074 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3075 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3076 static void |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3077 ngx_http_spdy_run_request(ngx_http_request_t *r) |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3078 { |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3079 ngx_uint_t i; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3080 ngx_list_part_t *part; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3081 ngx_table_elt_t *h; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3082 ngx_http_header_t *hh; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3083 ngx_http_core_main_conf_t *cmcf; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3084 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3085 if (ngx_http_spdy_construct_request_line(r) != NGX_OK) { |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3086 return; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3087 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3088 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3089 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3090 "spdy http request line: \"%V\"", &r->request_line); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3091 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3092 cmcf = ngx_http_get_module_main_conf(r, ngx_http_core_module); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3093 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3094 part = &r->headers_in.headers.part; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3095 h = part->elts; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3096 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3097 for (i = 0 ;; i++) { |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3098 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3099 if (i >= part->nelts) { |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3100 if (part->next == NULL) { |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3101 break; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3102 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3103 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3104 part = part->next; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3105 h = part->elts; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3106 i = 0; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3107 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3108 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3109 hh = ngx_hash_find(&cmcf->headers_in_hash, h[i].hash, |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3110 h[i].lowcase_key, h[i].key.len); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3111 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3112 if (hh && hh->handler(r, &h[i], hh->offset) != NGX_OK) { |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3113 return; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3114 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3115 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3116 ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, |
5693
701d6e17e42c
SPDY: improved logging.
Valentin Bartenev <vbart@nginx.com>
parents:
5692
diff
changeset
|
3117 "spdy http header: \"%V: %V\"", &h[i].key, &h[i].value); |
5121
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3118 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3119 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3120 r->http_state = NGX_HTTP_PROCESS_REQUEST_STATE; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3121 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3122 if (ngx_http_process_request_header(r) != NGX_OK) { |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3123 return; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3124 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3125 |
5641
0aeb6f63d242
SPDY: better detect premature closing of stream.
Valentin Bartenev <vbart@nginx.com>
parents:
5628
diff
changeset
|
3126 if (r->headers_in.content_length_n > 0 && r->spdy_stream->in_closed) { |
0aeb6f63d242
SPDY: better detect premature closing of stream.
Valentin Bartenev <vbart@nginx.com>
parents:
5628
diff
changeset
|
3127 ngx_log_error(NGX_LOG_INFO, r->connection->log, 0, |
0aeb6f63d242
SPDY: better detect premature closing of stream.
Valentin Bartenev <vbart@nginx.com>
parents:
5628
diff
changeset
|
3128 "client prematurely closed stream"); |
0aeb6f63d242
SPDY: better detect premature closing of stream.
Valentin Bartenev <vbart@nginx.com>
parents:
5628
diff
changeset
|
3129 |
0aeb6f63d242
SPDY: better detect premature closing of stream.
Valentin Bartenev <vbart@nginx.com>
parents:
5628
diff
changeset
|
3130 r->spdy_stream->skip_data = NGX_SPDY_DATA_ERROR; |
0aeb6f63d242
SPDY: better detect premature closing of stream.
Valentin Bartenev <vbart@nginx.com>
parents:
5628
diff
changeset
|
3131 |
0aeb6f63d242
SPDY: better detect premature closing of stream.
Valentin Bartenev <vbart@nginx.com>
parents:
5628
diff
changeset
|
3132 ngx_http_finalize_request(r, NGX_HTTP_BAD_REQUEST); |
0aeb6f63d242
SPDY: better detect premature closing of stream.
Valentin Bartenev <vbart@nginx.com>
parents:
5628
diff
changeset
|
3133 return; |
0aeb6f63d242
SPDY: better detect premature closing of stream.
Valentin Bartenev <vbart@nginx.com>
parents:
5628
diff
changeset
|
3134 } |
0aeb6f63d242
SPDY: better detect premature closing of stream.
Valentin Bartenev <vbart@nginx.com>
parents:
5628
diff
changeset
|
3135 |
5121
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3136 ngx_http_process_request(r); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3137 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3138 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3139 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3140 static ngx_int_t |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3141 ngx_http_spdy_init_request_body(ngx_http_request_t *r) |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3142 { |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3143 ngx_buf_t *buf; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3144 ngx_temp_file_t *tf; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3145 ngx_http_request_body_t *rb; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3146 ngx_http_core_loc_conf_t *clcf; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3147 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3148 rb = ngx_pcalloc(r->pool, sizeof(ngx_http_request_body_t)); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3149 if (rb == NULL) { |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3150 return NGX_ERROR; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3151 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3152 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3153 r->request_body = rb; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3154 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3155 if (r->spdy_stream->in_closed) { |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3156 return NGX_OK; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3157 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3158 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3159 rb->rest = r->headers_in.content_length_n; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3160 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3161 clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3162 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3163 if (r->request_body_in_file_only |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3164 || rb->rest > (off_t) clcf->client_body_buffer_size |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3165 || rb->rest < 0) |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3166 { |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3167 tf = ngx_pcalloc(r->pool, sizeof(ngx_temp_file_t)); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3168 if (tf == NULL) { |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3169 return NGX_ERROR; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3170 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3171 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3172 tf->file.fd = NGX_INVALID_FILE; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3173 tf->file.log = r->connection->log; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3174 tf->path = clcf->client_body_temp_path; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3175 tf->pool = r->pool; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3176 tf->warn = "a client request body is buffered to a temporary file"; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3177 tf->log_level = r->request_body_file_log_level; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3178 tf->persistent = r->request_body_in_persistent_file; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3179 tf->clean = r->request_body_in_clean_file; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3180 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3181 if (r->request_body_file_group_access) { |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3182 tf->access = 0660; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3183 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3184 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3185 rb->temp_file = tf; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3186 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3187 if (r->spdy_stream->in_closed |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3188 && ngx_create_temp_file(&tf->file, tf->path, tf->pool, |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3189 tf->persistent, tf->clean, tf->access) |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3190 != NGX_OK) |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3191 { |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3192 return NGX_ERROR; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3193 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3194 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3195 buf = ngx_calloc_buf(r->pool); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3196 if (buf == NULL) { |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3197 return NGX_ERROR; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3198 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3199 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3200 } else { |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3201 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3202 if (rb->rest == 0) { |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3203 return NGX_OK; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3204 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3205 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3206 buf = ngx_create_temp_buf(r->pool, (size_t) rb->rest); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3207 if (buf == NULL) { |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3208 return NGX_ERROR; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3209 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3210 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3211 |
5281
7542b72fe4b1
SPDY: fixed segfault with "client_body_in_file_only" enabled.
Valentin Bartenev <vbart@nginx.com>
parents:
5225
diff
changeset
|
3212 rb->buf = buf; |
7542b72fe4b1
SPDY: fixed segfault with "client_body_in_file_only" enabled.
Valentin Bartenev <vbart@nginx.com>
parents:
5225
diff
changeset
|
3213 |
5121
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3214 rb->bufs = ngx_alloc_chain_link(r->pool); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3215 if (rb->bufs == NULL) { |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3216 return NGX_ERROR; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3217 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3218 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3219 rb->bufs->buf = buf; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3220 rb->bufs->next = NULL; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3221 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3222 rb->rest = 0; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3223 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3224 return NGX_OK; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3225 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3226 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3227 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3228 ngx_int_t |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3229 ngx_http_spdy_read_request_body(ngx_http_request_t *r, |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3230 ngx_http_client_body_handler_pt post_handler) |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3231 { |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3232 ngx_http_spdy_stream_t *stream; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3233 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3234 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3235 "spdy read request body"); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3236 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3237 stream = r->spdy_stream; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3238 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3239 switch (stream->skip_data) { |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3240 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3241 case NGX_SPDY_DATA_DISCARD: |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3242 post_handler(r); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3243 return NGX_OK; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3244 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3245 case NGX_SPDY_DATA_ERROR: |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3246 if (r->headers_in.content_length_n == -1) { |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3247 return NGX_HTTP_REQUEST_ENTITY_TOO_LARGE; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3248 } else { |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3249 return NGX_HTTP_BAD_REQUEST; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3250 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3251 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3252 case NGX_SPDY_DATA_INTERNAL_ERROR: |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3253 return NGX_HTTP_INTERNAL_SERVER_ERROR; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3254 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3255 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3256 if (!r->request_body && ngx_http_spdy_init_request_body(r) != NGX_OK) { |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3257 stream->skip_data = NGX_SPDY_DATA_INTERNAL_ERROR; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3258 return NGX_HTTP_INTERNAL_SERVER_ERROR; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3259 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3260 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3261 if (stream->in_closed) { |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3262 post_handler(r); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3263 return NGX_OK; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3264 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3265 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3266 r->request_body->post_handler = post_handler; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3267 |
5402
4d0c70541784
SPDY: fixed connection leak while waiting for request body.
Valentin Bartenev <vbart@nginx.com>
parents:
5325
diff
changeset
|
3268 r->read_event_handler = ngx_http_test_reading; |
4d0c70541784
SPDY: fixed connection leak while waiting for request body.
Valentin Bartenev <vbart@nginx.com>
parents:
5325
diff
changeset
|
3269 r->write_event_handler = ngx_http_request_empty_handler; |
4d0c70541784
SPDY: fixed connection leak while waiting for request body.
Valentin Bartenev <vbart@nginx.com>
parents:
5325
diff
changeset
|
3270 |
5121
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3271 return NGX_AGAIN; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3272 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3273 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3274 |
5549
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
3275 static ngx_int_t |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
3276 ngx_http_spdy_terminate_stream(ngx_http_spdy_connection_t *sc, |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
3277 ngx_http_spdy_stream_t *stream, ngx_uint_t status) |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
3278 { |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
3279 ngx_event_t *rev; |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
3280 ngx_connection_t *fc; |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
3281 |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
3282 if (ngx_http_spdy_send_rst_stream(sc, stream->id, status, |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
3283 NGX_SPDY_HIGHEST_PRIORITY) |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
3284 == NGX_ERROR) |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
3285 { |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
3286 return NGX_ERROR; |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
3287 } |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
3288 |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
3289 stream->out_closed = 1; |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
3290 |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
3291 fc = stream->request->connection; |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
3292 fc->error = 1; |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
3293 |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
3294 rev = fc->read; |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
3295 rev->handler(rev); |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
3296 |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
3297 return NGX_OK; |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
3298 } |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
3299 |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
3300 |
5403
7e062646da6f
SPDY: fixed connection leak while waiting for request headers.
Valentin Bartenev <vbart@nginx.com>
parents:
5402
diff
changeset
|
3301 static void |
7e062646da6f
SPDY: fixed connection leak while waiting for request headers.
Valentin Bartenev <vbart@nginx.com>
parents:
5402
diff
changeset
|
3302 ngx_http_spdy_close_stream_handler(ngx_event_t *ev) |
7e062646da6f
SPDY: fixed connection leak while waiting for request headers.
Valentin Bartenev <vbart@nginx.com>
parents:
5402
diff
changeset
|
3303 { |
7e062646da6f
SPDY: fixed connection leak while waiting for request headers.
Valentin Bartenev <vbart@nginx.com>
parents:
5402
diff
changeset
|
3304 ngx_connection_t *fc; |
7e062646da6f
SPDY: fixed connection leak while waiting for request headers.
Valentin Bartenev <vbart@nginx.com>
parents:
5402
diff
changeset
|
3305 ngx_http_request_t *r; |
7e062646da6f
SPDY: fixed connection leak while waiting for request headers.
Valentin Bartenev <vbart@nginx.com>
parents:
5402
diff
changeset
|
3306 |
7e062646da6f
SPDY: fixed connection leak while waiting for request headers.
Valentin Bartenev <vbart@nginx.com>
parents:
5402
diff
changeset
|
3307 fc = ev->data; |
7e062646da6f
SPDY: fixed connection leak while waiting for request headers.
Valentin Bartenev <vbart@nginx.com>
parents:
5402
diff
changeset
|
3308 r = fc->data; |
7e062646da6f
SPDY: fixed connection leak while waiting for request headers.
Valentin Bartenev <vbart@nginx.com>
parents:
5402
diff
changeset
|
3309 |
7e062646da6f
SPDY: fixed connection leak while waiting for request headers.
Valentin Bartenev <vbart@nginx.com>
parents:
5402
diff
changeset
|
3310 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, |
7e062646da6f
SPDY: fixed connection leak while waiting for request headers.
Valentin Bartenev <vbart@nginx.com>
parents:
5402
diff
changeset
|
3311 "spdy close stream handler"); |
7e062646da6f
SPDY: fixed connection leak while waiting for request headers.
Valentin Bartenev <vbart@nginx.com>
parents:
5402
diff
changeset
|
3312 |
7e062646da6f
SPDY: fixed connection leak while waiting for request headers.
Valentin Bartenev <vbart@nginx.com>
parents:
5402
diff
changeset
|
3313 ngx_http_spdy_close_stream(r->spdy_stream, 0); |
7e062646da6f
SPDY: fixed connection leak while waiting for request headers.
Valentin Bartenev <vbart@nginx.com>
parents:
5402
diff
changeset
|
3314 } |
7e062646da6f
SPDY: fixed connection leak while waiting for request headers.
Valentin Bartenev <vbart@nginx.com>
parents:
5402
diff
changeset
|
3315 |
7e062646da6f
SPDY: fixed connection leak while waiting for request headers.
Valentin Bartenev <vbart@nginx.com>
parents:
5402
diff
changeset
|
3316 |
5121
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3317 void |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3318 ngx_http_spdy_close_stream(ngx_http_spdy_stream_t *stream, ngx_int_t rc) |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3319 { |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3320 ngx_event_t *ev; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3321 ngx_connection_t *fc; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3322 ngx_http_spdy_stream_t **index, *s; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3323 ngx_http_spdy_srv_conf_t *sscf; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3324 ngx_http_spdy_connection_t *sc; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3325 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3326 sc = stream->connection; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3327 |
5510
3ff29c30effb
SPDY: elimination of r->blocked counter usage for queuing frames.
Valentin Bartenev <vbart@nginx.com>
parents:
5509
diff
changeset
|
3328 ngx_log_debug3(NGX_LOG_DEBUG_HTTP, sc->connection->log, 0, |
3ff29c30effb
SPDY: elimination of r->blocked counter usage for queuing frames.
Valentin Bartenev <vbart@nginx.com>
parents:
5509
diff
changeset
|
3329 "spdy close stream %ui, queued %ui, processing %ui", |
3ff29c30effb
SPDY: elimination of r->blocked counter usage for queuing frames.
Valentin Bartenev <vbart@nginx.com>
parents:
5509
diff
changeset
|
3330 stream->id, stream->queued, sc->processing); |
3ff29c30effb
SPDY: elimination of r->blocked counter usage for queuing frames.
Valentin Bartenev <vbart@nginx.com>
parents:
5509
diff
changeset
|
3331 |
3ff29c30effb
SPDY: elimination of r->blocked counter usage for queuing frames.
Valentin Bartenev <vbart@nginx.com>
parents:
5509
diff
changeset
|
3332 fc = stream->request->connection; |
3ff29c30effb
SPDY: elimination of r->blocked counter usage for queuing frames.
Valentin Bartenev <vbart@nginx.com>
parents:
5509
diff
changeset
|
3333 |
3ff29c30effb
SPDY: elimination of r->blocked counter usage for queuing frames.
Valentin Bartenev <vbart@nginx.com>
parents:
5509
diff
changeset
|
3334 if (stream->queued) { |
3ff29c30effb
SPDY: elimination of r->blocked counter usage for queuing frames.
Valentin Bartenev <vbart@nginx.com>
parents:
5509
diff
changeset
|
3335 fc->write->handler = ngx_http_spdy_close_stream_handler; |
3ff29c30effb
SPDY: elimination of r->blocked counter usage for queuing frames.
Valentin Bartenev <vbart@nginx.com>
parents:
5509
diff
changeset
|
3336 return; |
3ff29c30effb
SPDY: elimination of r->blocked counter usage for queuing frames.
Valentin Bartenev <vbart@nginx.com>
parents:
5509
diff
changeset
|
3337 } |
5121
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3338 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3339 if (!stream->out_closed) { |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3340 if (ngx_http_spdy_send_rst_stream(sc, stream->id, |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3341 NGX_SPDY_INTERNAL_ERROR, |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3342 stream->priority) |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3343 != NGX_OK) |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3344 { |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3345 sc->connection->error = 1; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3346 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3347 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3348 |
5524
03c198bb2acf
SPDY: fixed possible segfault.
Valentin Bartenev <vbart@nginx.com>
parents:
5520
diff
changeset
|
3349 if (sc->stream == stream) { |
03c198bb2acf
SPDY: fixed possible segfault.
Valentin Bartenev <vbart@nginx.com>
parents:
5520
diff
changeset
|
3350 sc->stream = NULL; |
03c198bb2acf
SPDY: fixed possible segfault.
Valentin Bartenev <vbart@nginx.com>
parents:
5520
diff
changeset
|
3351 } |
03c198bb2acf
SPDY: fixed possible segfault.
Valentin Bartenev <vbart@nginx.com>
parents:
5520
diff
changeset
|
3352 |
5121
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3353 sscf = ngx_http_get_module_srv_conf(sc->http_connection->conf_ctx, |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3354 ngx_http_spdy_module); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3355 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3356 index = sc->streams_index + ngx_http_spdy_stream_index(sscf, stream->id); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3357 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3358 for ( ;; ) { |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3359 s = *index; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3360 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3361 if (s == NULL) { |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3362 break; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3363 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3364 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3365 if (s == stream) { |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3366 *index = s->index; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3367 break; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3368 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3369 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3370 index = &s->index; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3371 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3372 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3373 ngx_http_free_request(stream->request, rc); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3374 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3375 ev = fc->read; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3376 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3377 if (ev->active || ev->disabled) { |
5325
abf7813b927e
SPDY: alert about activated fake events instead of deleting them.
Valentin Bartenev <vbart@nginx.com>
parents:
5324
diff
changeset
|
3378 ngx_log_error(NGX_LOG_ALERT, sc->connection->log, 0, |
5693
701d6e17e42c
SPDY: improved logging.
Valentin Bartenev <vbart@nginx.com>
parents:
5692
diff
changeset
|
3379 "fake read event was activated"); |
5121
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3380 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3381 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3382 if (ev->timer_set) { |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3383 ngx_del_timer(ev); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3384 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3385 |
5821
3f5f0ab59b35
Events: processing of posted events changed from LIFO to FIFO.
Valentin Bartenev <vbart@nginx.com>
parents:
5762
diff
changeset
|
3386 if (ev->posted) { |
5121
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3387 ngx_delete_posted_event(ev); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3388 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3389 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3390 ev = fc->write; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3391 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3392 if (ev->active || ev->disabled) { |
5325
abf7813b927e
SPDY: alert about activated fake events instead of deleting them.
Valentin Bartenev <vbart@nginx.com>
parents:
5324
diff
changeset
|
3393 ngx_log_error(NGX_LOG_ALERT, sc->connection->log, 0, |
5693
701d6e17e42c
SPDY: improved logging.
Valentin Bartenev <vbart@nginx.com>
parents:
5692
diff
changeset
|
3394 "fake write event was activated"); |
5121
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3395 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3396 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3397 if (ev->timer_set) { |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3398 ngx_del_timer(ev); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3399 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3400 |
5821
3f5f0ab59b35
Events: processing of posted events changed from LIFO to FIFO.
Valentin Bartenev <vbart@nginx.com>
parents:
5762
diff
changeset
|
3401 if (ev->posted) { |
5121
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3402 ngx_delete_posted_event(ev); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3403 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3404 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3405 fc->data = sc->free_fake_connections; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3406 sc->free_fake_connections = fc; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3407 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3408 sc->processing--; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3409 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3410 if (sc->processing || sc->blocked) { |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3411 return; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3412 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3413 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3414 ev = sc->connection->read; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3415 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3416 ev->handler = ngx_http_spdy_handle_connection_handler; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3417 ngx_post_event(ev, &ngx_posted_events); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3418 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3419 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3420 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3421 static void |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3422 ngx_http_spdy_handle_connection_handler(ngx_event_t *rev) |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3423 { |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3424 ngx_connection_t *c; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3425 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3426 rev->handler = ngx_http_spdy_read_handler; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3427 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3428 if (rev->ready) { |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3429 ngx_http_spdy_read_handler(rev); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3430 return; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3431 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3432 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3433 c = rev->data; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3434 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3435 ngx_http_spdy_handle_connection(c->data); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3436 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3437 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3438 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3439 static void |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3440 ngx_http_spdy_keepalive_handler(ngx_event_t *rev) |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3441 { |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3442 ngx_connection_t *c; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3443 ngx_http_spdy_srv_conf_t *sscf; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3444 ngx_http_spdy_connection_t *sc; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3445 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3446 c = rev->data; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3447 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3448 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, c->log, 0, "spdy keepalive handler"); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3449 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3450 if (rev->timedout || c->close) { |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3451 ngx_http_close_connection(c); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3452 return; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3453 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3454 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3455 #if (NGX_HAVE_KQUEUE) |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3456 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3457 if (ngx_event_flags & NGX_USE_KQUEUE_EVENT) { |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3458 if (rev->pending_eof) { |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3459 c->log->handler = NULL; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3460 ngx_log_error(NGX_LOG_INFO, c->log, rev->kq_errno, |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3461 "kevent() reported that client %V closed " |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3462 "keepalive connection", &c->addr_text); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3463 #if (NGX_HTTP_SSL) |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3464 if (c->ssl) { |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3465 c->ssl->no_send_shutdown = 1; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3466 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3467 #endif |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3468 ngx_http_close_connection(c); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3469 return; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3470 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3471 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3472 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3473 #endif |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3474 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3475 c->destroyed = 0; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3476 c->idle = 0; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3477 ngx_reusable_connection(c, 0); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3478 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3479 sc = c->data; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3480 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3481 sscf = ngx_http_get_module_srv_conf(sc->http_connection->conf_ctx, |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3482 ngx_http_spdy_module); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3483 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3484 sc->pool = ngx_create_pool(sscf->pool_size, sc->connection->log); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3485 if (sc->pool == NULL) { |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3486 ngx_http_close_connection(c); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3487 return; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3488 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3489 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3490 sc->streams_index = ngx_pcalloc(sc->pool, |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3491 ngx_http_spdy_streams_index_size(sscf) |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3492 * sizeof(ngx_http_spdy_stream_t *)); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3493 if (sc->streams_index == NULL) { |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3494 ngx_http_close_connection(c); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3495 return; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3496 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3497 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3498 c->write->handler = ngx_http_spdy_write_handler; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3499 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3500 rev->handler = ngx_http_spdy_read_handler; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3501 ngx_http_spdy_read_handler(rev); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3502 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3503 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3504 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3505 static void |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3506 ngx_http_spdy_finalize_connection(ngx_http_spdy_connection_t *sc, |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3507 ngx_int_t rc) |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3508 { |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3509 ngx_uint_t i, size; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3510 ngx_event_t *ev; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3511 ngx_connection_t *c, *fc; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3512 ngx_http_request_t *r; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3513 ngx_http_spdy_stream_t *stream; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3514 ngx_http_spdy_srv_conf_t *sscf; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3515 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3516 c = sc->connection; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3517 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3518 if (!sc->processing) { |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3519 ngx_http_close_connection(c); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3520 return; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3521 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3522 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3523 c->error = 1; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3524 c->read->handler = ngx_http_empty_handler; |
5404
db85dacfa013
SPDY: set empty write handler during connection finalization.
Valentin Bartenev <vbart@nginx.com>
parents:
5403
diff
changeset
|
3525 c->write->handler = ngx_http_empty_handler; |
5121
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3526 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3527 sc->last_out = NULL; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3528 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3529 sc->blocked = 1; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3530 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3531 sscf = ngx_http_get_module_srv_conf(sc->http_connection->conf_ctx, |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3532 ngx_http_spdy_module); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3533 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3534 size = ngx_http_spdy_streams_index_size(sscf); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3535 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3536 for (i = 0; i < size; i++) { |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3537 stream = sc->streams_index[i]; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3538 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3539 while (stream) { |
5493
916cb6d28f6a
SPDY: fixed possible request hang.
Valentin Bartenev <vbart@nginx.com>
parents:
5465
diff
changeset
|
3540 stream->handled = 0; |
916cb6d28f6a
SPDY: fixed possible request hang.
Valentin Bartenev <vbart@nginx.com>
parents:
5465
diff
changeset
|
3541 |
5121
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3542 r = stream->request; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3543 fc = r->connection; |
5493
916cb6d28f6a
SPDY: fixed possible request hang.
Valentin Bartenev <vbart@nginx.com>
parents:
5465
diff
changeset
|
3544 |
5121
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3545 fc->error = 1; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3546 |
5508
9053fdcea4b7
SPDY: better name for queued frames counter.
Valentin Bartenev <vbart@nginx.com>
parents:
5507
diff
changeset
|
3547 if (stream->queued) { |
9053fdcea4b7
SPDY: better name for queued frames counter.
Valentin Bartenev <vbart@nginx.com>
parents:
5507
diff
changeset
|
3548 stream->queued = 0; |
5465
a279d2a33dbf
SPDY: drop the "delayed" flag when finalizing connection.
Valentin Bartenev <vbart@nginx.com>
parents:
5404
diff
changeset
|
3549 |
5121
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3550 ev = fc->write; |
5465
a279d2a33dbf
SPDY: drop the "delayed" flag when finalizing connection.
Valentin Bartenev <vbart@nginx.com>
parents:
5404
diff
changeset
|
3551 ev->delayed = 0; |
5121
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3552 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3553 } else { |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3554 ev = fc->read; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3555 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3556 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3557 stream = stream->index; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3558 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3559 ev->eof = 1; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3560 ev->handler(ev); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3561 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3562 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3563 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3564 sc->blocked = 0; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3565 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3566 if (sc->processing) { |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3567 return; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3568 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3569 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3570 ngx_http_close_connection(c); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3571 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3572 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3573 |
5549
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
3574 static ngx_int_t |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
3575 ngx_http_spdy_adjust_windows(ngx_http_spdy_connection_t *sc, ssize_t delta) |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
3576 { |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
3577 ngx_uint_t i, size; |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
3578 ngx_event_t *wev; |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
3579 ngx_http_spdy_stream_t *stream, *sn; |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
3580 ngx_http_spdy_srv_conf_t *sscf; |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
3581 |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
3582 sscf = ngx_http_get_module_srv_conf(sc->http_connection->conf_ctx, |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
3583 ngx_http_spdy_module); |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
3584 |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
3585 size = ngx_http_spdy_streams_index_size(sscf); |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
3586 |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
3587 for (i = 0; i < size; i++) { |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
3588 |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
3589 for (stream = sc->streams_index[i]; stream; stream = sn) { |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
3590 sn = stream->index; |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
3591 |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
3592 if (delta > 0 |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
3593 && stream->send_window |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
3594 > (ssize_t) (NGX_SPDY_MAX_WINDOW - delta)) |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
3595 { |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
3596 if (ngx_http_spdy_terminate_stream(sc, stream, |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
3597 NGX_SPDY_FLOW_CONTROL_ERROR) |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
3598 == NGX_ERROR) |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
3599 { |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
3600 return NGX_ERROR; |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
3601 } |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
3602 |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
3603 continue; |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
3604 } |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
3605 |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
3606 stream->send_window += delta; |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
3607 |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
3608 ngx_log_debug2(NGX_LOG_DEBUG_HTTP, sc->connection->log, 0, |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
3609 "spdy:%ui adjust window:%z", |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
3610 stream->id, stream->send_window); |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
3611 |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
3612 if (stream->send_window > 0 && stream->exhausted) { |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
3613 stream->exhausted = 0; |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
3614 |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
3615 wev = stream->request->connection->write; |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
3616 |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
3617 if (!wev->timer_set) { |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
3618 wev->delayed = 0; |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
3619 wev->handler(wev); |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
3620 } |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
3621 } |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
3622 } |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
3623 } |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
3624 |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
3625 return NGX_OK; |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
3626 } |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
3627 |
39d7eef2e332
SPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev <vbart@nginx.com>
parents:
5530
diff
changeset
|
3628 |
5121
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3629 static void |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3630 ngx_http_spdy_pool_cleanup(void *data) |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3631 { |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3632 ngx_http_spdy_connection_t *sc = data; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3633 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3634 if (sc->pool) { |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3635 ngx_destroy_pool(sc->pool); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3636 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3637 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3638 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3639 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3640 static void * |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3641 ngx_http_spdy_zalloc(void *opaque, u_int items, u_int size) |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3642 { |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3643 ngx_http_spdy_connection_t *sc = opaque; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3644 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3645 return ngx_palloc(sc->connection->pool, items * size); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3646 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3647 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3648 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3649 static void |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3650 ngx_http_spdy_zfree(void *opaque, void *address) |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3651 { |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3652 #if 0 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3653 ngx_http_spdy_connection_t *sc = opaque; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3654 |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3655 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, sc->connection->log, 0, |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3656 "spdy zfree: %p", address); |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3657 #endif |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
diff
changeset
|
3658 } |