qspdyprotocolhandler.cpp

Absolute File Name:/home/qt/qt5_coco/qt5/qtbase/src/network/access/qspdyprotocolhandler.cpp
Switch to Source codePreprocessed file
LineSourceCount
1-
2-
3-
4-
5-
6static const char spdyDictionary[] = {-
7 0x00, 0x00, 0x00, 0x07, 0x6f, 0x70, 0x74, 0x69,-
8 0x6f, 0x6e, 0x73, 0x00, 0x00, 0x00, 0x04, 0x68,-
9 0x65, 0x61, 0x64, 0x00, 0x00, 0x00, 0x04, 0x70,-
10 0x6f, 0x73, 0x74, 0x00, 0x00, 0x00, 0x03, 0x70,-
11 0x75, 0x74, 0x00, 0x00, 0x00, 0x06, 0x64, 0x65,-
12 0x6c, 0x65, 0x74, 0x65, 0x00, 0x00, 0x00, 0x05,-
13 0x74, 0x72, 0x61, 0x63, 0x65, 0x00, 0x00, 0x00,-
14 0x06, 0x61, 0x63, 0x63, 0x65, 0x70, 0x74, 0x00,-
15 0x00, 0x00, 0x0e, 0x61, 0x63, 0x63, 0x65, 0x70,-
16 0x74, 0x2d, 0x63, 0x68, 0x61, 0x72, 0x73, 0x65,-
17 0x74, 0x00, 0x00, 0x00, 0x0f, 0x61, 0x63, 0x63,-
18 0x65, 0x70, 0x74, 0x2d, 0x65, 0x6e, 0x63, 0x6f,-
19 0x64, 0x69, 0x6e, 0x67, 0x00, 0x00, 0x00, 0x0f,-
20 0x61, 0x63, 0x63, 0x65, 0x70, 0x74, 0x2d, 0x6c,-
21 0x61, 0x6e, 0x67, 0x75, 0x61, 0x67, 0x65, 0x00,-
22 0x00, 0x00, 0x0d, 0x61, 0x63, 0x63, 0x65, 0x70,-
23 0x74, 0x2d, 0x72, 0x61, 0x6e, 0x67, 0x65, 0x73,-
24 0x00, 0x00, 0x00, 0x03, 0x61, 0x67, 0x65, 0x00,-
25 0x00, 0x00, 0x05, 0x61, 0x6c, 0x6c, 0x6f, 0x77,-
26 0x00, 0x00, 0x00, 0x0d, 0x61, 0x75, 0x74, 0x68,-
27 0x6f, 0x72, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f,-
28 0x6e, 0x00, 0x00, 0x00, 0x0d, 0x63, 0x61, 0x63,-
29 0x68, 0x65, 0x2d, 0x63, 0x6f, 0x6e, 0x74, 0x72,-
30 0x6f, 0x6c, 0x00, 0x00, 0x00, 0x0a, 0x63, 0x6f,-
31 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e,-
32 0x00, 0x00, 0x00, 0x0c, 0x63, 0x6f, 0x6e, 0x74,-
33 0x65, 0x6e, 0x74, 0x2d, 0x62, 0x61, 0x73, 0x65,-
34 0x00, 0x00, 0x00, 0x10, 0x63, 0x6f, 0x6e, 0x74,-
35 0x65, 0x6e, 0x74, 0x2d, 0x65, 0x6e, 0x63, 0x6f,-
36 0x64, 0x69, 0x6e, 0x67, 0x00, 0x00, 0x00, 0x10,-
37 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x2d,-
38 0x6c, 0x61, 0x6e, 0x67, 0x75, 0x61, 0x67, 0x65,-
39 0x00, 0x00, 0x00, 0x0e, 0x63, 0x6f, 0x6e, 0x74,-
40 0x65, 0x6e, 0x74, 0x2d, 0x6c, 0x65, 0x6e, 0x67,-
41 0x74, 0x68, 0x00, 0x00, 0x00, 0x10, 0x63, 0x6f,-
42 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x2d, 0x6c, 0x6f,-
43 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x00, 0x00,-
44 0x00, 0x0b, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e,-
45 0x74, 0x2d, 0x6d, 0x64, 0x35, 0x00, 0x00, 0x00,-
46 0x0d, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74,-
47 0x2d, 0x72, 0x61, 0x6e, 0x67, 0x65, 0x00, 0x00,-
48 0x00, 0x0c, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e,-
49 0x74, 0x2d, 0x74, 0x79, 0x70, 0x65, 0x00, 0x00,-
50 0x00, 0x04, 0x64, 0x61, 0x74, 0x65, 0x00, 0x00,-
51 0x00, 0x04, 0x65, 0x74, 0x61, 0x67, 0x00, 0x00,-
52 0x00, 0x06, 0x65, 0x78, 0x70, 0x65, 0x63, 0x74,-
53 0x00, 0x00, 0x00, 0x07, 0x65, 0x78, 0x70, 0x69,-
54 0x72, 0x65, 0x73, 0x00, 0x00, 0x00, 0x04, 0x66,-
55 0x72, 0x6f, 0x6d, 0x00, 0x00, 0x00, 0x04, 0x68,-
56 0x6f, 0x73, 0x74, 0x00, 0x00, 0x00, 0x08, 0x69,-
57 0x66, 0x2d, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x00,-
58 0x00, 0x00, 0x11, 0x69, 0x66, 0x2d, 0x6d, 0x6f,-
59 0x64, 0x69, 0x66, 0x69, 0x65, 0x64, 0x2d, 0x73,-
60 0x69, 0x6e, 0x63, 0x65, 0x00, 0x00, 0x00, 0x0d,-
61 0x69, 0x66, 0x2d, 0x6e, 0x6f, 0x6e, 0x65, 0x2d,-
62 0x6d, 0x61, 0x74, 0x63, 0x68, 0x00, 0x00, 0x00,-
63 0x08, 0x69, 0x66, 0x2d, 0x72, 0x61, 0x6e, 0x67,-
64 0x65, 0x00, 0x00, 0x00, 0x13, 0x69, 0x66, 0x2d,-
65 0x75, 0x6e, 0x6d, 0x6f, 0x64, 0x69, 0x66, 0x69,-
66 0x65, 0x64, 0x2d, 0x73, 0x69, 0x6e, 0x63, 0x65,-
67 0x00, 0x00, 0x00, 0x0d, 0x6c, 0x61, 0x73, 0x74,-
68 0x2d, 0x6d, 0x6f, 0x64, 0x69, 0x66, 0x69, 0x65,-
69 0x64, 0x00, 0x00, 0x00, 0x08, 0x6c, 0x6f, 0x63,-
70 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x00, 0x00, 0x00,-
71 0x0c, 0x6d, 0x61, 0x78, 0x2d, 0x66, 0x6f, 0x72,-
72 0x77, 0x61, 0x72, 0x64, 0x73, 0x00, 0x00, 0x00,-
73 0x06, 0x70, 0x72, 0x61, 0x67, 0x6d, 0x61, 0x00,-
74 0x00, 0x00, 0x12, 0x70, 0x72, 0x6f, 0x78, 0x79,-
75 0x2d, 0x61, 0x75, 0x74, 0x68, 0x65, 0x6e, 0x74,-
76 0x69, 0x63, 0x61, 0x74, 0x65, 0x00, 0x00, 0x00,-
77 0x13, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2d, 0x61,-
78 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x61,-
79 0x74, 0x69, 0x6f, 0x6e, 0x00, 0x00, 0x00, 0x05,-
80 0x72, 0x61, 0x6e, 0x67, 0x65, 0x00, 0x00, 0x00,-
81 0x07, 0x72, 0x65, 0x66, 0x65, 0x72, 0x65, 0x72,-
82 0x00, 0x00, 0x00, 0x0b, 0x72, 0x65, 0x74, 0x72,-
83 0x79, 0x2d, 0x61, 0x66, 0x74, 0x65, 0x72, 0x00,-
84 0x00, 0x00, 0x06, 0x73, 0x65, 0x72, 0x76, 0x65,-
85 0x72, 0x00, 0x00, 0x00, 0x02, 0x74, 0x65, 0x00,-
86 0x00, 0x00, 0x07, 0x74, 0x72, 0x61, 0x69, 0x6c,-
87 0x65, 0x72, 0x00, 0x00, 0x00, 0x11, 0x74, 0x72,-
88 0x61, 0x6e, 0x73, 0x66, 0x65, 0x72, 0x2d, 0x65,-
89 0x6e, 0x63, 0x6f, 0x64, 0x69, 0x6e, 0x67, 0x00,-
90 0x00, 0x00, 0x07, 0x75, 0x70, 0x67, 0x72, 0x61,-
91 0x64, 0x65, 0x00, 0x00, 0x00, 0x0a, 0x75, 0x73,-
92 0x65, 0x72, 0x2d, 0x61, 0x67, 0x65, 0x6e, 0x74,-
93 0x00, 0x00, 0x00, 0x04, 0x76, 0x61, 0x72, 0x79,-
94 0x00, 0x00, 0x00, 0x03, 0x76, 0x69, 0x61, 0x00,-
95 0x00, 0x00, 0x07, 0x77, 0x61, 0x72, 0x6e, 0x69,-
96 0x6e, 0x67, 0x00, 0x00, 0x00, 0x10, 0x77, 0x77,-
97 0x77, 0x2d, 0x61, 0x75, 0x74, 0x68, 0x65, 0x6e,-
98 0x74, 0x69, 0x63, 0x61, 0x74, 0x65, 0x00, 0x00,-
99 0x00, 0x06, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64,-
100 0x00, 0x00, 0x00, 0x03, 0x67, 0x65, 0x74, 0x00,-
101 0x00, 0x00, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75,-
102 0x73, 0x00, 0x00, 0x00, 0x06, 0x32, 0x30, 0x30,-
103 0x20, 0x4f, 0x4b, 0x00, 0x00, 0x00, 0x07, 0x76,-
104 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x00, 0x00,-
105 0x00, 0x08, 0x48, 0x54, 0x54, 0x50, 0x2f, 0x31,-
106 0x2e, 0x31, 0x00, 0x00, 0x00, 0x03, 0x75, 0x72,-
107 0x6c, 0x00, 0x00, 0x00, 0x06, 0x70, 0x75, 0x62,-
108 0x6c, 0x69, 0x63, 0x00, 0x00, 0x00, 0x0a, 0x73,-
109 0x65, 0x74, 0x2d, 0x63, 0x6f, 0x6f, 0x6b, 0x69,-
110 0x65, 0x00, 0x00, 0x00, 0x0a, 0x6b, 0x65, 0x65,-
111 0x70, 0x2d, 0x61, 0x6c, 0x69, 0x76, 0x65, 0x00,-
112 0x00, 0x00, 0x06, 0x6f, 0x72, 0x69, 0x67, 0x69,-
113 0x6e, 0x31, 0x30, 0x30, 0x31, 0x30, 0x31, 0x32,-
114 0x30, 0x31, 0x32, 0x30, 0x32, 0x32, 0x30, 0x35,-
115 0x32, 0x30, 0x36, 0x33, 0x30, 0x30, 0x33, 0x30,-
116 0x32, 0x33, 0x30, 0x33, 0x33, 0x30, 0x34, 0x33,-
117 0x30, 0x35, 0x33, 0x30, 0x36, 0x33, 0x30, 0x37,-
118 0x34, 0x30, 0x32, 0x34, 0x30, 0x35, 0x34, 0x30,-
119 0x36, 0x34, 0x30, 0x37, 0x34, 0x30, 0x38, 0x34,-
120 0x30, 0x39, 0x34, 0x31, 0x30, 0x34, 0x31, 0x31,-
121 0x34, 0x31, 0x32, 0x34, 0x31, 0x33, 0x34, 0x31,-
122 0x34, 0x34, 0x31, 0x35, 0x34, 0x31, 0x36, 0x34,-
123 0x31, 0x37, 0x35, 0x30, 0x32, 0x35, 0x30, 0x34,-
124 0x35, 0x30, 0x35, 0x32, 0x30, 0x33, 0x20, 0x4e,-
125 0x6f, 0x6e, 0x2d, 0x41, 0x75, 0x74, 0x68, 0x6f,-
126 0x72, 0x69, 0x74, 0x61, 0x74, 0x69, 0x76, 0x65,-
127 0x20, 0x49, 0x6e, 0x66, 0x6f, 0x72, 0x6d, 0x61,-
128 0x74, 0x69, 0x6f, 0x6e, 0x32, 0x30, 0x34, 0x20,-
129 0x4e, 0x6f, 0x20, 0x43, 0x6f, 0x6e, 0x74, 0x65,-
130 0x6e, 0x74, 0x33, 0x30, 0x31, 0x20, 0x4d, 0x6f,-
131 0x76, 0x65, 0x64, 0x20, 0x50, 0x65, 0x72, 0x6d,-
132 0x61, 0x6e, 0x65, 0x6e, 0x74, 0x6c, 0x79, 0x34,-
133 0x30, 0x30, 0x20, 0x42, 0x61, 0x64, 0x20, 0x52,-
134 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x34, 0x30,-
135 0x31, 0x20, 0x55, 0x6e, 0x61, 0x75, 0x74, 0x68,-
136 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x64, 0x34, 0x30,-
137 0x33, 0x20, 0x46, 0x6f, 0x72, 0x62, 0x69, 0x64,-
138 0x64, 0x65, 0x6e, 0x34, 0x30, 0x34, 0x20, 0x4e,-
139 0x6f, 0x74, 0x20, 0x46, 0x6f, 0x75, 0x6e, 0x64,-
140 0x35, 0x30, 0x30, 0x20, 0x49, 0x6e, 0x74, 0x65,-
141 0x72, 0x6e, 0x61, 0x6c, 0x20, 0x53, 0x65, 0x72,-
142 0x76, 0x65, 0x72, 0x20, 0x45, 0x72, 0x72, 0x6f,-
143 0x72, 0x35, 0x30, 0x31, 0x20, 0x4e, 0x6f, 0x74,-
144 0x20, 0x49, 0x6d, 0x70, 0x6c, 0x65, 0x6d, 0x65,-
145 0x6e, 0x74, 0x65, 0x64, 0x35, 0x30, 0x33, 0x20,-
146 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x20,-
147 0x55, 0x6e, 0x61, 0x76, 0x61, 0x69, 0x6c, 0x61,-
148 0x62, 0x6c, 0x65, 0x4a, 0x61, 0x6e, 0x20, 0x46,-
149 0x65, 0x62, 0x20, 0x4d, 0x61, 0x72, 0x20, 0x41,-
150 0x70, 0x72, 0x20, 0x4d, 0x61, 0x79, 0x20, 0x4a,-
151 0x75, 0x6e, 0x20, 0x4a, 0x75, 0x6c, 0x20, 0x41,-
152 0x75, 0x67, 0x20, 0x53, 0x65, 0x70, 0x74, 0x20,-
153 0x4f, 0x63, 0x74, 0x20, 0x4e, 0x6f, 0x76, 0x20,-
154 0x44, 0x65, 0x63, 0x20, 0x30, 0x30, 0x3a, 0x30,-
155 0x30, 0x3a, 0x30, 0x30, 0x20, 0x4d, 0x6f, 0x6e,-
156 0x2c, 0x20, 0x54, 0x75, 0x65, 0x2c, 0x20, 0x57,-
157 0x65, 0x64, 0x2c, 0x20, 0x54, 0x68, 0x75, 0x2c,-
158 0x20, 0x46, 0x72, 0x69, 0x2c, 0x20, 0x53, 0x61,-
159 0x74, 0x2c, 0x20, 0x53, 0x75, 0x6e, 0x2c, 0x20,-
160 0x47, 0x4d, 0x54, 0x63, 0x68, 0x75, 0x6e, 0x6b,-
161 0x65, 0x64, 0x2c, 0x74, 0x65, 0x78, 0x74, 0x2f,-
162 0x68, 0x74, 0x6d, 0x6c, 0x2c, 0x69, 0x6d, 0x61,-
163 0x67, 0x65, 0x2f, 0x70, 0x6e, 0x67, 0x2c, 0x69,-
164 0x6d, 0x61, 0x67, 0x65, 0x2f, 0x6a, 0x70, 0x67,-
165 0x2c, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x2f, 0x67,-
166 0x69, 0x66, 0x2c, 0x61, 0x70, 0x70, 0x6c, 0x69,-
167 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x78,-
168 0x6d, 0x6c, 0x2c, 0x61, 0x70, 0x70, 0x6c, 0x69,-
169 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x78,-
170 0x68, 0x74, 0x6d, 0x6c, 0x2b, 0x78, 0x6d, 0x6c,-
171 0x2c, 0x74, 0x65, 0x78, 0x74, 0x2f, 0x70, 0x6c,-
172 0x61, 0x69, 0x6e, 0x2c, 0x74, 0x65, 0x78, 0x74,-
173 0x2f, 0x6a, 0x61, 0x76, 0x61, 0x73, 0x63, 0x72,-
174 0x69, 0x70, 0x74, 0x2c, 0x70, 0x75, 0x62, 0x6c,-
175 0x69, 0x63, 0x70, 0x72, 0x69, 0x76, 0x61, 0x74,-
176 0x65, 0x6d, 0x61, 0x78, 0x2d, 0x61, 0x67, 0x65,-
177 0x3d, 0x67, 0x7a, 0x69, 0x70, 0x2c, 0x64, 0x65,-
178 0x66, 0x6c, 0x61, 0x74, 0x65, 0x2c, 0x73, 0x64,-
179 0x63, 0x68, 0x63, 0x68, 0x61, 0x72, 0x73, 0x65,-
180 0x74, 0x3d, 0x75, 0x74, 0x66, 0x2d, 0x38, 0x63,-
181 0x68, 0x61, 0x72, 0x73, 0x65, 0x74, 0x3d, 0x69,-
182 0x73, 0x6f, 0x2d, 0x38, 0x38, 0x35, 0x39, 0x2d,-
183 0x31, 0x2c, 0x75, 0x74, 0x66, 0x2d, 0x2c, 0x2a,-
184 0x2c, 0x65, 0x6e, 0x71, 0x3d, 0x30, 0x2e-
185};-
186QSpdyProtocolHandler::QSpdyProtocolHandler(QHttpNetworkConnectionChannel *channel)-
187 : QObject(0), QAbstractProtocolHandler(channel),-
188 m_nextStreamID(-1),-
189 m_maxConcurrentStreams(100),-
190 m_initialWindowSize(0),-
191 m_waitingForCompleteStream(false)-
192{-
193 m_inflateStream.zalloc = 0;-
194 m_inflateStream.zfree = 0;-
195 m_inflateStream.opaque = 0;-
196 int zlibRet = inflateInit_((&m_inflateStream), "1.2.8", (int)sizeof(z_stream));-
197 ((!(zlibRet == 0)) ? qt_assert("zlibRet == Z_OK",__FILE__,261267) : qt_noop());-
198-
199 m_deflateStream.zalloc = 0;-
200 m_deflateStream.zfree = 0;-
201 m_deflateStream.opaque = 0;-
202-
203-
204-
205 zlibRet = deflateInit_((&m_deflateStream), (0), "1.2.8", (int)sizeof(z_stream));-
206 ((!(zlibRet == 0)) ? qt_assert("zlibRet == Z_OK",__FILE__,270276) : qt_noop());-
207 (void)zlibRet;;-
208}-
209-
210QSpdyProtocolHandler::~QSpdyProtocolHandler()-
211{-
212 deflateEnd(&m_deflateStream);-
213 deflateEnd(&m_inflateStream);-
214}-
215-
216bool QSpdyProtocolHandler::sendRequest()-
217{-
218 ((!(!m_reply)) ? qt_assert("!m_reply",__FILE__,282288) : qt_noop());-
219-
220 int maxPossibleRequests = m_maxConcurrentStreams - m_inFlightStreams.count();-
221 ((!(maxPossibleRequests >= 0)) ? qt_assert("maxPossibleRequests >= 0",__FILE__,285291) : qt_noop());-
222 if (maxPossibleRequests == 0)-
223 return true;-
224-
225 m_channel->state = QHttpNetworkConnectionChannel::WritingState;-
226-
227 int requestsToSend = qMin(m_channel->spdyRequestsToSend.size(), maxPossibleRequests);-
228-
229 QMultiMap<int, HttpMessagePair>::iterator it = m_channel->spdyRequestsToSend.begin();-
230-
231 for (int a = 0; a < requestsToSend; ++a) {-
232 HttpMessagePair currentPair = *it;-
233 QHttpNetworkRequest currentRequest = currentPair.first;-
234 QHttpNetworkReply *currentReply = currentPair.second;-
235-
236 currentReply->setSpdyWasUsed(true);-
237 qint32 streamID = generateNextStreamID();-
238 currentReply->setProperty("SPDYStreamID", streamID);-
239-
240 currentReply->setRequest(currentRequest);-
241 currentReply->d_func()->connection = m_connection;-
242 currentReply->d_func()->connectionChannel = m_channel;-
243 m_inFlightStreams.insert(streamID, currentPair);-
244 connect(currentReply, qFlagLocation("2""destroyed(QObject*)" "\0" __FILE__ ":" "308""314"), this, qFlagLocation("1""_q_replyDestroyed(QObject*)" "\0" __FILE__ ":" "308""314"));-
245-
246 sendSYN_STREAM(currentPair, streamID, 0);-
247 m_channel->spdyRequestsToSend.erase(it++);-
248 }-
249 m_channel->state = QHttpNetworkConnectionChannel::IdleState;-
250 return true;-
251}-
252-
253void QSpdyProtocolHandler::_q_replyDestroyed(QObject* reply)-
254{-
255 qint32 streamID = reply->property("SPDYStreamID").toInt();-
256 if (m_inFlightStreams.remove(streamID))-
257 sendRST_STREAM(streamID, RST_STREAM_CANCEL);-
258}-
259-
260void QSpdyProtocolHandler::_q_receiveReply()-
261{-
262 ((!(m_socket)) ? qt_assert("m_socket",__FILE__,326332) : qt_noop());-
263-
264-
265-
266-
267 if (!qobject_cast<QHttpNetworkConnection*>(m_connection)) {-
268 return;-
269 }-
270-
271 if (bytesAvailable() < 8)-
272 return;-
273-
274 char frameHeadersRaw[8];-
275 if (!readNextChunk(8, frameHeadersRaw))-
276 return;-
277-
278 const QByteArray frameHeaders(frameHeadersRaw, 8);-
279 if (frameHeadersRaw[0] & 0x80) {-
280 handleControlFrame(frameHeaders);-
281 } else {-
282 handleDataFrame(frameHeaders);-
283 }-
284-
285-
286 if (m_socket->bytesAvailable() > 0)-
287 QMetaObject::invokeMethod(m_channel, "_q_receiveReply", Qt::QueuedConnection);-
288}-
289-
290void QSpdyProtocolHandler::_q_readyRead()-
291{-
292 _q_receiveReply();-
293}-
294-
295static qint16 twoBytesToInt(const char *bytes)-
296{-
297 return
executed 1738 times by 1 test: return qFromBigEndian<qint16>(bytes);
Executed by:
  • tst_Spdy
qFromBigEndian<qint16>(reinterpret_cast<const uchar *>(bytes)););
executed 1738 times by 1 test: return qFromBigEndian<qint16>(bytes);
Executed by:
  • tst_Spdy
1738
298}-
299-
300static qint32 threeBytesToInt(const char *bytes)-
301{-
302 return
executed 1379 times by 1 test: return qFromBigEndian<qint32>(bytes) >> 8;
Executed by:
  • tst_Spdy
qFromBigEndian<qint32>(reinterpret_cast<const uchar *>(bytes))) >> 8;
executed 1379 times by 1 test: return qFromBigEndian<qint32>(bytes) >> 8;
Executed by:
  • tst_Spdy
1379
303}-
304-
305static qint32 fourBytesToInt(const char *bytes)-
306{-
307 return
executed 3612 times by 1 test: return qFromBigEndian<qint32>(bytes);
Executed by:
  • tst_Spdy
qFromBigEndian<qint32>(reinterpret_cast<const uchar *>(bytes)););
executed 3612 times by 1 test: return qFromBigEndian<qint32>(bytes);
Executed by:
  • tst_Spdy
3612
308}-
309-
310static void appendIntToThreeBytes(char *output, qint32 number)-
311{-
312 qToBigEndian<qint16>(number, reinterpret_cast<uchar *>(output + 1)););-
313 qToBigEndian<qint8>(number >> 16, reinterpret_cast<uchar *>(output)););-
314}
executed 121 times by 1 test: end of block
Executed by:
  • tst_Spdy
121
315-
316static void appendIntToFourBytes(char *output, qint32 number)-
317{-
318 qToBigEndian<qint32>(number, reinterpret_cast<uchar *>(output)););-
319}
executed 28 times by 1 test: end of block
Executed by:
  • tst_Spdy
28
320-
321static QByteArray intToFourBytes(qint32 number)-
322{-
323 ucharchar data[4];-
324 qToBigEndian<qint32>(number, data);-
325 QByteArray ret(reinterpret_cast<char *>(data),, 4);-
326 return
executed 2822 times by 1 test: return ret;
Executed by:
  • tst_Spdy
ret;
executed 2822 times by 1 test: return ret;
Executed by:
  • tst_Spdy
2822
327}-
328-
329static QByteArray intToThreeBytes(qint32 number)-
330{-
331 ucharchar data[4];-
332 qToBigEndian<qint32>(number << 8, data);-
333 QByteArray ret(reinterpret_cast<char *>(data),, 3);-
334 return
executed 755 times by 1 test: return ret;
Executed by:
  • tst_Spdy
ret;
executed 755 times by 1 test: return ret;
Executed by:
  • tst_Spdy
755
335}-
336-
337static qint32 getStreamID(const char *bytes)-
338{-
339-
340-
341 return fourBytesToInt(bytes) & 0x3fffffff;-
342}-
343-
344static QByteArray headerField(const QByteArray &name, const QByteArray &value)-
345{-
346 QByteArray ret;-
347 ret.reserve(name.count() + value.count() + 8);-
348 ret.append(intToFourBytes(name.count()));-
349 ret.append(name);-
350 ret.append(intToFourBytes(value.count()));-
351 ret.append(value);-
352 return ret;-
353}-
354-
355bool QSpdyProtocolHandler::uncompressHeader(const QByteArray &input, QByteArray *output)-
356{-
357 const size_t chunkSize = 1024;-
358 char outputRaw[chunkSize];-
359-
360 m_inflateStream.next_in = const_cast<Bytef *>(reinterpret_cast<const Bytef *>(input.constData()));-
361 m_inflateStream.avail_in = input.count();-
362 m_inflateStream.total_in = input.count();-
363 int zlibRet;-
364-
365 do {-
366 m_inflateStream.next_out = reinterpret_cast<Bytef *>(outputRaw);-
367 m_inflateStream.avail_out = chunkSize;-
368 zlibRet = inflate(&m_inflateStream, 2);-
369 if (zlibRet == 2) {-
370 zlibRet = inflateSetDictionary(&m_inflateStream,-
371 reinterpret_cast<const Bytef*>(spdyDictionary),-
372 1423);-
373 ((!(zlibRet == 0)) ? qt_assert("zlibRet == Z_OK",__FILE__,437443) : qt_noop());-
374 continue;-
375 }-
376 switch (zlibRet) {-
377 case (-5): {-
378 if (m_inflateStream.avail_in == 0) {-
379 int outputSize = chunkSize - m_inflateStream.avail_out;-
380 output->append(outputRaw, outputSize);-
381 m_inflateStream.avail_out = chunkSize;-
382 }-
383 break;-
384 }-
385 case 0: {-
386 int outputSize = chunkSize - m_inflateStream.avail_out;-
387 output->append(outputRaw, outputSize);-
388 break;-
389 }-
390 default: {-
391 QMessageLogger(__FILE__, 455461, __PRETTY_FUNCTION__).warning() << "got unexpected zlib return value:" << zlibRet;-
392 return false;-
393 }-
394 }-
395 } while (m_inflateStream.avail_in > 0 && zlibRet != 1);-
396-
397 ((!(m_inflateStream.avail_in == 0)) ? qt_assert("m_inflateStream.avail_in == 0",__FILE__,461467) : qt_noop());-
398 return true;-
399}-
400-
401QByteArray QSpdyProtocolHandler::composeHeader(const QHttpNetworkRequest &request)-
402{-
403 QByteArray uncompressedHeader;-
404 uncompressedHeader.reserve(300);-
405-
406-
407-
408-
409 QListQVector<QPair<QByteArray, QByteArray> > additionalHeaders;-
410 for (int a = 0; a < request.header().count()
a < request.header().count()Description
TRUEevaluated 552 times by 1 test
Evaluated by:
  • tst_Spdy
FALSEevaluated 107 times by 1 test
Evaluated by:
  • tst_Spdy
; ++a) {
107-552
411 QByteArray key = request.header().at(a).first;-
412 if (key == "Connection"
key == "Connection"Description
TRUEevaluated 107 times by 1 test
Evaluated by:
  • tst_Spdy
FALSEevaluated 445 times by 1 test
Evaluated by:
  • tst_Spdy
|| key == "Host"
key == "Host"Description
TRUEevaluated 107 times by 1 test
Evaluated by:
  • tst_Spdy
FALSEevaluated 338 times by 1 test
Evaluated by:
  • tst_Spdy
|| key == "Keep-Alive"
key == "Keep-Alive"Description
TRUEnever evaluated
FALSEevaluated 338 times by 1 test
Evaluated by:
  • tst_Spdy
0-445
413 || key == "Proxy-Connection"
key == "Proxy-Connection"Description
TRUEnever evaluated
FALSEevaluated 338 times by 1 test
Evaluated by:
  • tst_Spdy
|| key == "Transfer-Encoding"
key == "Transfer-Encoding"Description
TRUEnever evaluated
FALSEevaluated 338 times by 1 test
Evaluated by:
  • tst_Spdy
)
0-338
414 continue;
executed 214 times by 1 test: continue;
Executed by:
  • tst_Spdy
214
415 additionalHeaders.append(request.header().at(a));-
416 }
executed 338 times by 1 test: end of block
Executed by:
  • tst_Spdy
338
417-
418 qint32 numberOfHeaderPairs = 5 + additionalHeaders.count();-
419 uncompressedHeader.append(intToFourBytes(numberOfHeaderPairs));-
420-
421-
422-
423 uncompressedHeader.append(headerField(":method", request.methodName()));-
424-
425 bool useProxy = m_connection->d_func()->networkProxy.type() != QNetworkProxy::NoProxy;-
426 uncompressedHeader.append(headerField(":path", request.uri(useProxy)));-
427-
428-
429-
430 uncompressedHeader.append(headerField(":version", "HTTP/1.1"));-
431-
432 uncompressedHeader.append(headerField(":host", request.url().authority(QUrl::FullyEncoded | QUrl::RemoveUserInfo).toLatin1()));-
433-
434 uncompressedHeader.append(headerField(":scheme", request.url().scheme().toLatin1()));-
435-
436-
437-
438-
439 for (int a = 0; a < additionalHeaders.count()
a < additionalHeaders.count()Description
TRUEevaluated 338 times by 1 test
Evaluated by:
  • tst_Spdy
FALSEevaluated 107 times by 1 test
Evaluated by:
  • tst_Spdy
; ++a) {
107-338
440 uncompressedHeader.append(headerField(additionalHeaders.at(a).first.toLower(),-
441 additionalHeaders.at(a).second));-
442 }
executed 338 times by 1 test: end of block
Executed by:
  • tst_Spdy
338
443-
444 m_deflateStream.total_in = uncompressedHeader.count();-
445 m_deflateStream.avail_in = uncompressedHeader.count();-
446 m_deflateStream.next_in = reinterpret_cast<unsigned char *>(uncompressedHeader.data());-
447 int outputBytes = uncompressedHeader.count() + 30;-
448 m_deflateStream.avail_out = outputBytes;-
449 unsigned char *out = new unsigned char[outputBytes];-
450 m_deflateStream.next_out = out;-
451 int availOutBefore = m_deflateStream.avail_out;-
452 int zlibRet = deflate(&m_deflateStream, 2);-
453 int compressedHeaderSize = availOutBefore - m_deflateStream.avail_out;-
454 ((!(zlibRet == 0)) ? qt_assert("zlibRet == Z_OK",__FILE__,518524) : qt_noop());-
455 (void)zlibRet;;-
456 ((!(m_deflateStream.avail_in == 0)) ? qt_assert("m_deflateStream.avail_in == 0",__FILE__,520526) : qt_noop());-
457 QByteArray compressedHeader(reinterpret_cast<char *>(out), compressedHeaderSize);-
458 delete[] out;-
459-
460 return
executed 107 times by 1 test: return compressedHeader;
Executed by:
  • tst_Spdy
compressedHeader;
executed 107 times by 1 test: return compressedHeader;
Executed by:
  • tst_Spdy
107
461}-
462-
463quint64 QSpdyProtocolHandler::bytesAvailable() const-
464{-
465 ((!(m_socket)) ? qt_assert("m_socket",__FILE__,529535) : qt_noop());-
466 return m_spdyBuffer.byteAmount() + m_socket->bytesAvailable();-
467}-
468-
469bool QSpdyProtocolHandler::readNextChunk(qint64 length, char *sink)-
470{-
471 qint64 expectedReadBytes = length;-
472 qint64 requiredBytesFromBuffer = 0;-
473-
474 if (m_waitingForCompleteStream) {-
475 requiredBytesFromBuffer = qMin(length, m_spdyBuffer.byteAmount());-
476-
477-
478-
479 qint64 bytesReadFromBuffer = m_spdyBuffer.read(sink, requiredBytesFromBuffer);-
480 ((!(bytesReadFromBuffer == requiredBytesFromBuffer)) ? qt_assert("bytesReadFromBuffer == requiredBytesFromBuffer",__FILE__,544550) : qt_noop());-
481 if (length <= bytesReadFromBuffer) {-
482 return true;-
483 }-
484 expectedReadBytes -= requiredBytesFromBuffer;-
485 }-
486 qint64 readBytes = m_socket->read(sink + requiredBytesFromBuffer, expectedReadBytes);-
487-
488 if (readBytes < expectedReadBytes) {-
489 m_waitingForCompleteStream = true;-
490-
491 QByteArray temp(sink, requiredBytesFromBuffer + readBytes);-
492 m_spdyBuffer.append(temp);-
493 return false;-
494 } else {-
495 return true;-
496 }-
497}-
498-
499void QSpdyProtocolHandler::sendControlFrame(FrameType type,-
500 ControlFrameFlags flags,-
501 const char *data,-
502 quint32 length)-
503{-
504-
505 char header[8];-
506 header[0] = 0x80u;-
507 header[1] = 0x03;-
508 header[2] = 0;-
509 switch (type) {-
510 case FrameType_CREDENTIAL: {-
511 QMessageLogger(__FILE__, 575581, __PRETTY_FUNCTION__).warning("sending SPDY CREDENTIAL frame is not yet implemented");-
512 return;-
513 }-
514 default:-
515 header[3] = type;-
516 }-
517-
518-
519 header[4] = 0;-
520 if (flags & ControlFrame_FLAG_FIN || length == 0) {-
521 ((!(type == FrameType_SYN_STREAM || type == FrameType_SYN_REPLY || type == FrameType_HEADERS || length == 0)) ? qt_assert("type == FrameType_SYN_STREAM || type == FrameType_SYN_REPLY || type == FrameType_HEADERS || length == 0",-
522 __FILE__-
523 ,-
524 586592-
525 ) : qt_noop())-
526 ;-
527 header[4] |= ControlFrame_FLAG_FIN;-
528 }-
529 if (flags & ControlFrame_FLAG_UNIDIRECTIONAL) {-
530 ((!(type == FrameType_SYN_STREAM)) ? qt_assert("type == FrameType_SYN_STREAM",__FILE__,590596) : qt_noop());-
531 header[4] |= ControlFrame_FLAG_UNIDIRECTIONAL;-
532 }-
533-
534-
535 appendIntToThreeBytes(header + 5, length);-
536-
537 qint64 written = m_socket->write(header, 8);-
538 ((!(written == 8)) ? qt_assert("written == 8",__FILE__,598604) : qt_noop());-
539 written = m_socket->write(data, length);-
540 ((!(written == length)) ? qt_assert("written == length",__FILE__,600606) : qt_noop());-
541 (void)written;;-
542}-
543-
544void QSpdyProtocolHandler::sendSYN_STREAM(const HttpMessagePair messagePair&messagePair,-
545 qint32 streamID, qint32 associatedToStreamID)-
546{-
547 QHttpNetworkRequest request = messagePair.first;-
548 QHttpNetworkReply *reply = messagePair.second;-
549-
550 ControlFrameFlags flags = 0;-
551-
552 if (!request.uploadByteDevice()
!request.uploadByteDevice()Description
TRUEevaluated 92 times by 1 test
Evaluated by:
  • tst_Spdy
FALSEevaluated 15 times by 1 test
Evaluated by:
  • tst_Spdy
) {
15-92
553-
554 flags |= ControlFrame_FLAG_FIN;-
555 reply->d_func()->state = QHttpNetworkReplyPrivate::SPDYHalfClosed;-
556 }
executed 92 times by 1 test: end of block
Executed by:
  • tst_Spdy
else {
92
557 reply->d_func()->state = QHttpNetworkReplyPrivate::SPDYUploading;-
558-
559-
560-
561 request.uploadByteDevice()->setProperty("SPDYStreamID", streamID);-
562-
563 QObject::connect(request.uploadByteDevice(), qFlagLocation("2""readyRead()" "\0" __FILE__ ":" "623""629"), this,-
564 qFlagLocation("1""_q_uploadDataReadyRead()" "\0" __FILE__ ":" "624""630"), Qt::QueuedConnection);-
565 }
executed 15 times by 1 test: end of block
Executed by:
  • tst_Spdy
15
566-
567 QByteArray namesAndValues = composeHeader(request);-
568 quint32 length = namesAndValues.count() + 10;-
569-
570-
571 QByteArray wireData;-
572 wireData.reserve(length);-
573 wireData.append(intToFourBytes(streamID));-
574 wireData.append(intToFourBytes(associatedToStreamID));-
575-
576-
577 char prioAndSlot[2];-
578 switch (request.priority()) {-
579 case
never executed: case QHttpNetworkRequest::HighPriority:
QHttpNetworkRequest::HighPriority:
never executed: case QHttpNetworkRequest::HighPriority:
0
580 prioAndSlot[0] = 0x00;-
581 break;
never executed: break;
0
582 case
executed 107 times by 1 test: case QHttpNetworkRequest::NormalPriority:
Executed by:
  • tst_Spdy
QHttpNetworkRequest::NormalPriority:
executed 107 times by 1 test: case QHttpNetworkRequest::NormalPriority:
Executed by:
  • tst_Spdy
107
583 prioAndSlot[0] = 0x80u;-
584 break;
executed 107 times by 1 test: break;
Executed by:
  • tst_Spdy
107
585 case
never executed: case QHttpNetworkRequest::LowPriority:
QHttpNetworkRequest::LowPriority:
never executed: case QHttpNetworkRequest::LowPriority:
0
586 prioAndSlot[0] = 0xe0u;-
587 break;
never executed: break;
0
588 }-
589 prioAndSlot[1] = 0x00;-
590 wireData.append(prioAndSlot, 2);-
591-
592 wireData.append(namesAndValues);-
593-
594 sendControlFrame(FrameType_SYN_STREAM, flags, wireData.constData(), length);-
595-
596 if (reply->d_func()->state == QHttpNetworkReplyPrivate::SPDYUploading
reply->d_func(...:SPDYUploadingDescription
TRUEevaluated 15 times by 1 test
Evaluated by:
  • tst_Spdy
FALSEevaluated 92 times by 1 test
Evaluated by:
  • tst_Spdy
)
15-92
597 uploadData(streamID);
executed 15 times by 1 test: uploadData(streamID);
Executed by:
  • tst_Spdy
15
598}
executed 107 times by 1 test: end of block
Executed by:
  • tst_Spdy
107
599-
600void QSpdyProtocolHandler::sendRST_STREAM(qint32 streamID, RST_STREAM_STATUS_CODE statusCode)-
601{-
602 char wireData[8];-
603 appendIntToFourBytes(wireData, streamID);-
604 appendIntToFourBytes(wireData + 4, statusCode);-
605 sendControlFrame(FrameType_RST_STREAM, 0, wireData, 8);-
606}-
607-
608void QSpdyProtocolHandler::sendPING(quint32 pingID)-
609{-
610 char rawData[4];-
611 appendIntToFourBytes(rawData, pingID);-
612 sendControlFrame(FrameType_PING, 0, rawData, 4);-
613}-
614-
615bool QSpdyProtocolHandler::uploadData(qint32 streamID)-
616{-
617-
618 if (!m_inFlightStreams.contains(streamID)) {-
619 sendRST_STREAM(streamID, RST_STREAM_INVALID_STREAM);-
620 return false;-
621 }-
622-
623 HttpMessagePair messagePair = m_inFlightStreams.value(streamID);-
624 QHttpNetworkRequest request = messagePair.first;-
625 QHttpNetworkReply *reply = messagePair.second;-
626 ((!(reply)) ? qt_assert("reply",__FILE__,686692) : qt_noop());-
627 QHttpNetworkReplyPrivate *replyPrivate = reply->d_func();-
628 ((!(replyPrivate)) ? qt_assert("replyPrivate",__FILE__,688694) : qt_noop());-
629-
630 if (reply->d_func()->state == QHttpNetworkReplyPrivate::SPDYHalfClosed || reply->d_func()->state == QHttpNetworkReplyPrivate::SPDYClosed) {-
631 QMessageLogger(__FILE__, 691697, __PRETTY_FUNCTION__).warning("Trying to upload to closed stream");-
632 return false;-
633 }-
634-
635 qint32 dataLeftInWindow = replyPrivate->windowSizeUpload-
636 - replyPrivate->currentlyUploadedDataInWindow;-
637-
638 while (dataLeftInWindow > 0 && !request.uploadByteDevice()->atEnd()) {-
639-
640-
641 qint64 currentReadSize = 0;-
642 const char *readPointer = request.uploadByteDevice()->readPointer(dataLeftInWindow,-
643 currentReadSize);-
644-
645 if (currentReadSize == -1) {-
646-
647 m_connection->d_func()->emitReplyError(m_socket, reply,-
648 QNetworkReply::UnknownNetworkError);-
649 return false;-
650 } else if (readPointer == 0 || currentReadSize == 0) {-
651-
652 break;-
653 } else {-
654 DataFrameFlags flags = 0;-
655-
656 qint64 currentWriteSize = sendDataFrame(streamID, flags, currentReadSize, readPointer);-
657 if (currentWriteSize == -1 || currentWriteSize != currentReadSize) {-
658-
659 m_connection->d_func()->emitReplyError(m_socket, reply,-
660 QNetworkReply::UnknownNetworkError);-
661 return false;-
662 } else {-
663 replyPrivate->currentlyUploadedDataInWindow += currentWriteSize;-
664 replyPrivate->totallyUploadedData += currentWriteSize;-
665 dataLeftInWindow = replyPrivate->windowSizeUpload-
666 - replyPrivate->currentlyUploadedDataInWindow;-
667 request.uploadByteDevice()->advanceReadPointer(currentWriteSize);-
668-
669 reply->dataSendProgress(replyPrivate->totallyUploadedData,-
670 request.contentLength());-
671 }-
672 }-
673 }-
674 if (replyPrivate->totallyUploadedData == request.contentLength()) {-
675 DataFrameFlags finFlag = DataFrame_FLAG_FIN;-
676 qint64 writeSize = sendDataFrame(streamID, finFlag, 0, 0);-
677 ((!(writeSize == 0)) ? qt_assert("writeSize == 0",__FILE__,737743) : qt_noop());-
678 (void)writeSize;;-
679 replyPrivate->state = QHttpNetworkReplyPrivate::SPDYHalfClosed;-
680 if (reply->request().uploadByteDevice())-
681 reply->request().uploadByteDevice()->disconnect(this);-
682-
683-
684-
685 }-
686 return true;-
687}-
688-
689void QSpdyProtocolHandler::_q_uploadDataReadyRead()-
690{-
691 QNonContiguousByteDevice *device = qobject_cast<QNonContiguousByteDevice *>(sender());-
692 ((!(device)) ? qt_assert("device",__FILE__,752758) : qt_noop());-
693 qint32 streamID = device->property("SPDYStreamID").toInt();-
694 ((!(streamID > 0)) ? qt_assert("streamID > 0",__FILE__,754760) : qt_noop());-
695 uploadData(streamID);-
696}-
697-
698void QSpdyProtocolHandler::sendWINDOW_UPDATE(qint32 streamID, quint32 deltaWindowSize)-
699{-
700 char windowUpdateData[8];-
701 appendIntToFourBytes(windowUpdateData, streamID);-
702 appendIntToFourBytes(windowUpdateData + 4, deltaWindowSize);-
703-
704 sendControlFrame(FrameType_WINDOW_UPDATE, 0, windowUpdateData, 8);-
705}-
706-
707qint64 QSpdyProtocolHandler::sendDataFrame(qint32 streamID, DataFrameFlags flags,-
708 quint32 length, const char *data)-
709{-
710 QByteArray wireData;-
711 wireData.reserve(8);-
712-
713 wireData.append(intToFourBytes(streamID));-
714 wireData.append(flags);-
715 wireData.append(intToThreeBytes(length));-
716-
717 ((!(m_socket)) ? qt_assert("m_socket",__FILE__,777783) : qt_noop());-
718 m_socket->write(wireData);-
719-
720 if (data) {-
721 qint64 ret = m_socket->write(data, length);-
722 return ret;-
723 } else {-
724 return 0;-
725 }-
726}-
727-
728void QSpdyProtocolHandler::handleControlFrame(const QByteArray &frameHeaders)-
729{-
730 ((!(frameHeaders.count() >= 8)) ? qt_assert("frameHeaders.count() >= 8",__FILE__,790796) : qt_noop());-
731 qint16 version = twoBytesToInt(frameHeaders.constData());-
732 version &= 0x3fff;-
733 ((!(version == 3)) ? qt_assert("version == 3",__FILE__,793799) : qt_noop());-
734-
735 qint16 type = twoBytesToInt(frameHeaders.constData() + 2);-
736-
737 char flags = frameHeaders.at(4);-
738 qint32 length = threeBytesToInt(frameHeaders.constData() + 5);-
739 ((!(length > 0)) ? qt_assert("length > 0",__FILE__,799805) : qt_noop());-
740-
741 QByteArray frameData;-
742 frameData.resize(length);-
743 if (!readNextChunk(length, frameData.data())) {-
744-
745 m_spdyBuffer.prepend(frameHeaders);-
746 return;-
747 } else {-
748 m_spdyBuffer.clear();-
749 m_waitingForCompleteStream = false;-
750 }-
751-
752 switch (type) {-
753 case FrameType_SYN_STREAM: {-
754 handleSYN_STREAM(flags, length, frameData);-
755 break;-
756 }-
757 case FrameType_SYN_REPLY: {-
758 handleSYN_REPLY(flags, length, frameData);-
759 break;-
760 }-
761 case FrameType_RST_STREAM: {-
762 handleRST_STREAM(flags, length, frameData);-
763 break;-
764 }-
765 case FrameType_SETTINGS: {-
766 handleSETTINGS(flags, length, frameData);-
767 break;-
768 }-
769 case FrameType_PING: {-
770 handlePING(flags, length, frameData);-
771 break;-
772 }-
773 case FrameType_GOAWAY: {-
774 handleGOAWAY(flags, length, frameData);-
775 break;-
776 }-
777 case FrameType_HEADERS: {-
778 handleHEADERS(flags, length, frameData);-
779 break;-
780 }-
781 case FrameType_WINDOW_UPDATE: {-
782 handleWINDOW_UPDATE(flags, length, frameData);-
783 break;-
784 }-
785 default:-
786 QMessageLogger(__FILE__, 846852, __PRETTY_FUNCTION__).warning() << "cannot handle frame of type" << type;-
787 }-
788}-
789-
790void QSpdyProtocolHandler::handleSYN_STREAM(char , quint32 ,-
791 const QByteArray &frameData)-
792{-
793-
794-
795-
796 qint32 streamID = getStreamID(frameData.constData());-
797-
798 sendRST_STREAM(streamID, RST_STREAM_REFUSED_STREAM);-
799}-
800-
801void QSpdyProtocolHandler::handleSYN_REPLY(char flags, quint32 , const QByteArray &frameData)-
802{-
803 parseHttpHeaders(flags, frameData);-
804}-
805-
806void QSpdyProtocolHandler::parseHttpHeaders(char flags, const QByteArray &frameData)-
807{-
808 qint32 streamID = getStreamID(frameData.constData());-
809 if (!const auto it = m_inFlightStreams.containsconstFind(streamID)));-
810 if (it == m_inFlightStreams.cend()
it == m_inFlightStreams.cend()Description
TRUEnever evaluated
FALSEevaluated 107 times by 1 test
Evaluated by:
  • tst_Spdy
)
{
0-107
811 sendRST_STREAM(streamID, RST_STREAM_INVALID_STREAM);-
812 return;
never executed: return;
0
813 }-
814-
815 flags &= 0x3f;-
816 bool flag_fin = flags & 0x01;-
817-
818 QByteArray headerValuePairs = frameData.mid(4);-
819-
820 HttpMessagePair pair = m_inFlightStreamsit.value(streamID);();-
821 QHttpNetworkReply *httpReply = pair.second;-
822 ((!(httpReply != 0)) ? qt_assert("httpReply != 0",__FILE__,881888) : qt_noop());-
823-
824 if (httpReply->d_func()->state == QHttpNetworkReplyPrivate::SPDYClosed
httpReply->d_f...te::SPDYClosedDescription
TRUEnever evaluated
FALSEevaluated 107 times by 1 test
Evaluated by:
  • tst_Spdy
) {
0-107
825 sendRST_STREAM(streamID, RST_STREAM_STREAM_ALREADY_CLOSED);-
826 return;
never executed: return;
0
827 }-
828-
829 QByteArray uncompressedHeader;-
830 if (!uncompressHeader(headerValuePairs, &uncompressedHeader)
!uncompressHea...pressedHeader)Description
TRUEnever evaluated
FALSEevaluated 107 times by 1 test
Evaluated by:
  • tst_Spdy
) {
0-107
831 QMessageLogger(__FILE__, 890897, __PRETTY_FUNCTION__).warning("error reading header from SYN_REPLY message");-
832 return;
never executed: return;
0
833 }-
834-
835 qint32 headerCount = fourBytesToInt(uncompressedHeader.constData());-
836 if (headerCount * 8 > uncompressedHeader.size()
headerCount * ...dHeader.size()Description
TRUEnever evaluated
FALSEevaluated 107 times by 1 test
Evaluated by:
  • tst_Spdy
) {
0-107
837 QMessageLogger(__FILE__, 896903, __PRETTY_FUNCTION__).warning("error parsing header from SYN_REPLY message");-
838 sendRST_STREAM(streamID, RST_STREAM_PROTOCOL_ERROR);-
839 return;
never executed: return;
0
840 }-
841 qint32 readPointer = 4;-
842 for (qint32 a = 0; a < headerCount
a < headerCountDescription
TRUEevaluated 685 times by 1 test
Evaluated by:
  • tst_Spdy
FALSEevaluated 107 times by 1 test
Evaluated by:
  • tst_Spdy
; ++a) {
107-685
843 qint32 count = fourBytesToInt(uncompressedHeader.constData() + readPointer);-
844 readPointer += 4;-
845 QByteArray name = uncompressedHeader.mid(readPointer, count);-
846 readPointer += count;-
847 if (readPointer > uncompressedHeader.size()
readPointer > ...dHeader.size()Description
TRUEnever evaluated
FALSEevaluated 685 times by 1 test
Evaluated by:
  • tst_Spdy
) {
0-685
848 QMessageLogger(__FILE__, 907914, __PRETTY_FUNCTION__).warning("error parsing header from SYN_REPLY message");-
849 sendRST_STREAM(streamID, RST_STREAM_PROTOCOL_ERROR);-
850 return;
never executed: return;
0
851 }-
852 count = fourBytesToInt(uncompressedHeader.constData() + readPointer);-
853 readPointer += 4;-
854 QByteArray value = uncompressedHeader.mid(readPointer, count);-
855 readPointer += count;-
856 if (readPointer > uncompressedHeader.size()
readPointer > ...dHeader.size()Description
TRUEnever evaluated
FALSEevaluated 685 times by 1 test
Evaluated by:
  • tst_Spdy
) {
0-685
857 QMessageLogger(__FILE__, 916923, __PRETTY_FUNCTION__).warning("error parsing header from SYN_REPLY message");-
858 sendRST_STREAM(streamID, RST_STREAM_PROTOCOL_ERROR);-
859 return;
never executed: return;
0
860 }-
861 if (name == ":status"
name == ":status"Description
TRUEevaluated 107 times by 1 test
Evaluated by:
  • tst_Spdy
FALSEevaluated 578 times by 1 test
Evaluated by:
  • tst_Spdy
) {
107-578
862 httpReply->setStatusCode(value.left(3).toInt());-
863 httpReply->d_func()->reasonPhrase = QString::fromLatin1(value.mid(4));-
864 }
executed 107 times by 1 test: end of block
Executed by:
  • tst_Spdy
else if (name == ":version"
name == ":version"Description
TRUEevaluated 107 times by 1 test
Evaluated by:
  • tst_Spdy
FALSEevaluated 471 times by 1 test
Evaluated by:
  • tst_Spdy
) {
107-471
865 int majorVersion = value.at(5) - 48;-
866 int minorVersion = value.at(7) - 48;-
867 httpReply->d_func()->majorVersion = majorVersion;-
868 httpReply->d_func()->minorVersion = minorVersion;-
869 }
executed 107 times by 1 test: end of block
Executed by:
  • tst_Spdy
else if (name == "content-length"
name == "content-length"Description
TRUEevaluated 22 times by 1 test
Evaluated by:
  • tst_Spdy
FALSEevaluated 449 times by 1 test
Evaluated by:
  • tst_Spdy
) {
22-449
870 httpReply->setContentLength(value.toLongLong());-
871 }
executed 22 times by 1 test: end of block
Executed by:
  • tst_Spdy
else {
22
if (value.contains('\0')){
872 QList<QByteArray> values =value.splitreplace('\0');-
QByteArray binder(", ");
if (name == "set-cookie" )
binder =? "\n" ;
value.clear();
for (QForeachContainer<typename QtPrivate::remove_reference<decltype(values)>::type> _container_((values)); _container_.control && _container_.i != _container_.e; ++_container_.i: ", _container_.control ^= 1) for (const QByteArray& ivalue = *_container_.i; _container_.control; _container_.control = 0) {
if (value.isEmpty())
value = ivalue;
else
value += binder + ivalue;
}
}");
873 httpReply->setHeaderField(name, value);-
874 }
executed 449 times by 1 test: end of block
Executed by:
  • tst_Spdy
449
875 }-
876 httpReply->headerChanged();-
877-
878 if (flag_fin
flag_finDescription
TRUEnever evaluated
FALSEevaluated 107 times by 1 test
Evaluated by:
  • tst_Spdy
) {
0-107
879 if (httpReply->d_func()->state != QHttpNetworkReplyPrivate::SPDYHalfClosed
httpReply->d_f...SPDYHalfClosedDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
880 sendDataFrame(streamID, DataFrame_FLAG_FIN, 0, 0);
never executed: sendDataFrame(streamID, DataFrame_FLAG_FIN, 0, 0);
0
881 replyFinished(httpReply, streamID);-
882 }
never executed: end of block
0
883}
executed 107 times by 1 test: end of block
Executed by:
  • tst_Spdy
107
884-
885void QSpdyProtocolHandler::handleRST_STREAM(char , quint32 length,-
886 const QByteArray &frameData)-
887{-
888-
889-
890 ((!(length == 8)) ? qt_assert("length == 8",__FILE__,961956) : qt_noop());-
891 (void)length;;-
892 qint32 streamID = getStreamID(frameData.constData());-
893 QHttpNetworkReply *httpReply = m_inFlightStreams.value(streamID).second;-
894-
895 qint32 statusCodeInt = fourBytesToInt(frameData.constData() + 4);-
896 RST_STREAM_STATUS_CODE statusCode = static_cast<RST_STREAM_STATUS_CODE>(statusCodeInt);-
897 QNetworkReply::NetworkError errorCode;-
898 QByteArray errorMessage;-
899-
900 switch (statusCode) {-
901 case RST_STREAM_PROTOCOL_ERROR:-
902 errorCode = QNetworkReply::ProtocolFailure;-
903 errorMessage = "SPDY protocol error";-
904 break;-
905 case RST_STREAM_INVALID_STREAM:-
906 errorCode = QNetworkReply::ProtocolFailure;-
907 errorMessage = "SPDY stream is not active";-
908 break;-
909 case RST_STREAM_REFUSED_STREAM:-
910 errorCode = QNetworkReply::ProtocolFailure;-
911 errorMessage = "SPDY stream was refused";-
912 break;-
913 case RST_STREAM_UNSUPPORTED_VERSION:-
914 errorCode = QNetworkReply::ProtocolUnknownError;-
915 errorMessage = "SPDY version is unknown to the server";-
916 break;-
917 case RST_STREAM_CANCEL:-
918 errorCode = QNetworkReply::ProtocolFailure;-
919 errorMessage = "SPDY stream is no longer needed";-
920 break;-
921 case RST_STREAM_INTERNAL_ERROR:-
922 errorCode = QNetworkReply::InternalServerError;-
923 errorMessage = "Internal server error";-
924 break;-
925 case RST_STREAM_FLOW_CONTROL_ERROR:-
926 errorCode = QNetworkReply::ProtocolFailure;-
927 errorMessage = "peer violated the flow control protocol";-
928 break;-
929 case RST_STREAM_STREAM_IN_USE:-
930 errorCode = QNetworkReply::ProtocolFailure;-
931 errorMessage = "server received a SYN_REPLY for an already open stream";-
932 break;-
933 case RST_STREAM_STREAM_ALREADY_CLOSED:-
934 errorCode = QNetworkReply::ProtocolFailure;-
935 errorMessage = "server received data or a SYN_REPLY for an already half-closed stream";-
936 break;-
937 case RST_STREAM_INVALID_CREDENTIALS:-
938 errorCode = QNetworkReply::ContentAccessDenied;-
939 errorMessage = "server received invalid credentials";-
940 break;-
941 case RST_STREAM_FRAME_TOO_LARGE:-
942 errorCode = QNetworkReply::ProtocolFailure;-
943 errorMessage = "server cannot process the frame because it is too large";-
944 break;-
945 default:-
946 QMessageLogger(__FILE__, 10171012, __PRETTY_FUNCTION__).warning("could not understand servers RST_STREAM status code");-
947 errorCode = QNetworkReply::ProtocolFailure;-
948 errorMessage = "got SPDY RST_STREAM message with unknown error code";-
949 }-
950 if (httpReply)-
951 replyFinishedWithError(httpReply, streamID, errorCode, errorMessage.constData());-
952}-
953-
954void QSpdyProtocolHandler::handleSETTINGS(char flags, quint32 , const QByteArray &frameData)-
955{-
956 ((!(frameData.count() > 0)) ? qt_assert("frameData.count() > 0",__FILE__,10271022) : qt_noop());-
957-
958 SETTINGS_Flags settingsFlags = static_cast<SETTINGS_Flags>(flags);-
959 if (settingsFlags & FLAG_SETTINGS_CLEAR_SETTINGS) {-
960-
961-
962 }-
963-
964 qint32 numberOfEntries = fourBytesToInt(frameData.constData());-
965 ((!(numberOfEntries > 0)) ? qt_assert("numberOfEntries > 0",__FILE__,10361031) : qt_noop());-
966 for (int a = 0, frameDataIndex = 4; a < numberOfEntries; ++a, frameDataIndex += 8) {-
967 SETTINGS_ID_Flag idFlag = static_cast<SETTINGS_ID_Flag>(frameData[frameDataIndex]);-
968 if (idFlag & FLAG_SETTINGS_PERSIST_VALUE) {-
969-
970-
971 }-
972-
973 quint32 uniqueID = static_cast<SETTINGS_ID>(-
974 threeBytesToInt(frameData.constData() + frameDataIndex + 1));-
975 quint32 value = fourBytesToInt(frameData.constData() + frameDataIndex + 4);-
976 switch (uniqueID) {-
977 case SETTINGS_UPLOAD_BANDWIDTH: {-
978-
979 break;-
980 }-
981 case SETTINGS_DOWNLOAD_BANDWIDTH: {-
982-
983 break;-
984 }-
985 case SETTINGS_ROUND_TRIP_TIME: {-
986-
987 break;-
988 }-
989 case SETTINGS_MAX_CONCURRENT_STREAMS: {-
990 m_maxConcurrentStreams = value;-
991 break;-
992 }-
993 case SETTINGS_CURRENT_CWND: {-
994-
995 break;-
996 }-
997 case SETTINGS_DOWNLOAD_RETRANS_RATE: {-
998-
999 break;-
1000 }-
1001 case SETTINGS_INITIAL_WINDOW_SIZE: {-
1002 m_initialWindowSize = value;-
1003 break;-
1004 }-
1005 case SETTINGS_CLIENT_CERTIFICATE_VECTOR_SIZE: {-
1006-
1007 break;-
1008 }-
1009 default:-
1010 QMessageLogger(__FILE__, 10811076, __PRETTY_FUNCTION__).warning() << "found unknown settings value" << value;-
1011 }-
1012 }-
1013}-
1014-
1015void QSpdyProtocolHandler::handlePING(char , quint32 length, const QByteArray &frameData)-
1016{-
1017-
1018-
1019 ((!(length == 4)) ? qt_assert("length == 4",__FILE__,10901085) : qt_noop());-
1020 (void)length;;-
1021 quint32 pingID = fourBytesToInt(frameData.constData());-
1022-
1023-
1024 if ((pingID & 1) == 0)-
1025 sendPING(pingID);-
1026}-
1027-
1028void QSpdyProtocolHandler::handleGOAWAY(char , quint32 ,-
1029 const QByteArray &frameData)-
1030{-
1031-
1032-
1033 qint32 statusCode = static_cast<GOAWAY_STATUS>(fourBytesToInt(frameData.constData() + 4));-
1034 QNetworkReply::NetworkError errorCode;-
1035 switch (statusCode) {-
1036 case GOAWAY_OK: {-
1037 errorCode = QNetworkReply::NoError;-
1038 break;-
1039 }-
1040 case GOAWAY_PROTOCOL_ERROR: {-
1041 errorCode = QNetworkReply::ProtocolFailure;-
1042 break;-
1043 }-
1044 case GOAWAY_INTERNAL_ERROR: {-
1045 errorCode = QNetworkReply::InternalServerError;-
1046 break;-
1047 }-
1048 default:-
1049 QMessageLogger(__FILE__, 11201115, __PRETTY_FUNCTION__).warning() << "unexpected status code" << statusCode;-
1050 errorCode = QNetworkReply::ProtocolUnknownError;-
1051 }-
1052-
1053 qint32 lastGoodStreamID = getStreamID(frameData.constData());-
1054-
1055-
1056 ((!(m_connection)) ? qt_assert("m_connection",__FILE__,11271122) : qt_noop());-
1057 for (qint32 currentStreamID = lastGoodStreamID + 2; currentStreamID <= m_nextStreamID;-
1058 ++currentStreamID) {-
1059 QHttpNetworkReply *reply = m_inFlightStreams.value(currentStreamID).second;-
1060 ((!(reply)) ? qt_assert("reply",__FILE__,11311126) : qt_noop());-
1061 m_connection->d_func()->emitReplyError(m_socket, reply, errorCode);-
1062 }-
1063-
1064}-
1065-
1066void QSpdyProtocolHandler::handleHEADERS(char flags, quint32 ,-
1067 const QByteArray &frameData)-
1068{-
1069 parseHttpHeaders(flags, frameData);-
1070}-
1071-
1072void QSpdyProtocolHandler::handleWINDOW_UPDATE(char , quint32 ,-
1073 const QByteArray &frameData)-
1074{-
1075 qint32 streamID = getStreamID(frameData.constData());-
1076 qint32 deltaWindowSize = fourBytesToInt(frameData.constData() + 4);-
1077-
1078 if (!const auto it = m_inFlightStreams.containsconstFind(streamID)));-
1079 if (it == m_inFlightStreams.cend()
it == m_inFlightStreams.cend()Description
TRUEnever evaluated
FALSEevaluated 756 times by 1 test
Evaluated by:
  • tst_Spdy
)
{
0-756
1080 sendRST_STREAM(streamID, RST_STREAM_INVALID_STREAM);-
1081 return;
never executed: return;
0
1082 }-
1083-
1084 QHttpNetworkReply *reply = m_inFlightStreamsit.value(streamID).().second;-
1085 ((!(reply)) ? qt_assert("reply",__FILE__,11551151) : qt_noop());-
1086 QHttpNetworkReplyPrivate *replyPrivate = reply->d_func();-
1087 ((!(replyPrivate)) ? qt_assert("replyPrivate",__FILE__,11571153) : qt_noop());-
1088-
1089-
1090 if (replyPrivate->state == QHttpNetworkReplyPrivate::SPDYHalfClosed
replyPrivate->...SPDYHalfClosedDescription
TRUEevaluated 36 times by 1 test
Evaluated by:
  • tst_Spdy
FALSEevaluated 720 times by 1 test
Evaluated by:
  • tst_Spdy
|| replyPrivate->state == QHttpNetworkReplyPrivate::SPDYClosed
replyPrivate->...te::SPDYClosedDescription
TRUEnever evaluated
FALSEevaluated 720 times by 1 test
Evaluated by:
  • tst_Spdy
)
0-720
1091 return;
executed 36 times by 1 test: return;
Executed by:
  • tst_Spdy
36
1092-
1093 replyPrivate->currentlyUploadedDataInWindow = replyPrivate->windowSizeUpload - deltaWindowSize;-
1094 uploadData(streamID);-
1095}
executed 720 times by 1 test: end of block
Executed by:
  • tst_Spdy
720
1096-
1097-
1098void QSpdyProtocolHandler::handleDataFrame(const QByteArray &frameHeaders)-
1099{-
1100 ((!(frameHeaders.count() >= 8)) ? qt_assert("frameHeaders.count() >= 8",__FILE__,11701166) : qt_noop());-
1101-
1102 qint32 streamID = getStreamID(frameHeaders.constData());-
1103 if (!const auto it = m_inFlightStreams.containsconstFind(streamID)));-
1104 if (it == m_inFlightStreams.cend()
it == m_inFlightStreams.cend()Description
TRUEnever evaluated
FALSEevaluated 504 times by 1 test
Evaluated by:
  • tst_Spdy
)
{
0-504
1105 sendRST_STREAM(streamID, RST_STREAM_INVALID_STREAM);-
1106 return;
never executed: return;
0
1107 }-
1108-
1109 unsigned char flags = static_cast<unsigned char>(frameHeaders.at(4));-
1110 flags &= 0x3f;-
1111 bool flag_fin = flags & 0x01;-
1112 bool flag_compress = flags & 0x02;-
1113 qint32 length = threeBytesToInt(frameHeaders.constData() + 5);-
1114-
1115 QByteArray data;-
1116 data.resize(length);-
1117 if (!readNextChunk(length, data.data())
!readNextChunk..., data.data())Description
TRUEevaluated 156 times by 1 test
Evaluated by:
  • tst_Spdy
FALSEevaluated 348 times by 1 test
Evaluated by:
  • tst_Spdy
) {
156-348
1118-
1119 m_spdyBuffer.prepend(frameHeaders);-
1120 return;
executed 156 times by 1 test: return;
Executed by:
  • tst_Spdy
156
1121 } else {-
1122 m_spdyBuffer.clear();-
1123 m_waitingForCompleteStream = false;-
1124 }
executed 348 times by 1 test: end of block
Executed by:
  • tst_Spdy
348
1125-
1126 HttpMessagePair pair = m_inFlightStreamsit.value(streamID);();-
1127 QHttpNetworkRequest httpRequest = pair.first;-
1128 QHttpNetworkReply *httpReply = pair.second;-
1129 ((!(httpReply != 0)) ? qt_assert("httpReply != 0",__FILE__,11981195) : qt_noop());-
1130-
1131 QHttpNetworkReplyPrivate *replyPrivate = httpReply->d_func();-
1132-
1133 if (replyPrivate->state == QHttpNetworkReplyPrivate::SPDYClosed
replyPrivate->...te::SPDYClosedDescription
TRUEnever evaluated
FALSEevaluated 348 times by 1 test
Evaluated by:
  • tst_Spdy
) {
0-348
1134 sendRST_STREAM(streamID, RST_STREAM_STREAM_ALREADY_CLOSED);-
1135 return;
never executed: return;
0
1136 }-
1137-
1138-
1139 replyPrivate->currentlyReceivedDataInWindow += length;-
1140 qint32 dataLeftInWindow = replyPrivate->windowSizeDownload - replyPrivate->currentlyReceivedDataInWindow;-
1141-
1142 if (replyPrivate->currentlyReceivedDataInWindow > 0
replyPrivate->...taInWindow > 0Description
TRUEevaluated 348 times by 1 test
Evaluated by:
  • tst_Spdy
FALSEnever evaluated
0-348
1143 && dataLeftInWindow < replyPrivate->windowSizeDownload / 2
dataLeftInWind...zeDownload / 2Description
TRUEevaluated 14 times by 1 test
Evaluated by:
  • tst_Spdy
FALSEevaluated 334 times by 1 test
Evaluated by:
  • tst_Spdy
) {
14-334
1144-
1145-
1146-
1147-
1148 if (replyPrivate->windowSizeDownload >= m_socket->readBufferSize()
replyPrivate->...adBufferSize()Description
TRUEevaluated 14 times by 1 test
Evaluated by:
  • tst_Spdy
FALSEnever evaluated
) {
0-14
1149 replyPrivate->windowSizeDownload = m_socket->readBufferSize();-
1150 }
executed 14 times by 1 test: end of block
Executed by:
  • tst_Spdy
else {
14
1151 replyPrivate->windowSizeDownload *= 1.5;-
1152 }
never executed: end of block
0
1153 QMetaObject::invokeMethod(this, "sendWINDOW_UPDATE", Qt::QueuedConnection,-
1154 QArgument<qint32 >("qint32", streamID),-
1155 QArgument<quint32 >("quint32", replyPrivate->windowSizeDownload));-
1156-
1157-
1158-
1159-
1160-
1161 replyPrivate->currentlyReceivedDataInWindow = 0;-
1162 }
executed 14 times by 1 test: end of block
Executed by:
  • tst_Spdy
14
1163-
1164 httpReply->d_func()->compressedData.append(data);-
1165-
1166-
1167 replyPrivate->totalProgress += length;-
1168-
1169 if (httpRequest.d->autoDecompress
httpRequest.d->autoDecompressDescription
TRUEevaluated 348 times by 1 test
Evaluated by:
  • tst_Spdy
FALSEnever evaluated
&& httpReply->d_func()->isCompressed()
httpReply->d_f...isCompressed()Description
TRUEnever evaluated
FALSEevaluated 348 times by 1 test
Evaluated by:
  • tst_Spdy
) {
0-348
1170 QByteDataBuffer inDataBuffer;-
1171 inDataBuffer.append(data);-
1172 qint64 compressedCount = httpReply->d_func()->uncompressBodyData(&inDataBuffer,-
1173 &replyPrivate->responseData);-
1174 ((!(compressedCount >= 0)) ? qt_assert("compressedCount >= 0",__FILE__,12431240) : qt_noop());-
1175 (void)compressedCount;;-
1176 }
never executed: end of block
else {
0
1177 replyPrivate->responseData.append(data);-
1178 }
executed 348 times by 1 test: end of block
Executed by:
  • tst_Spdy
348
1179-
1180 if (replyPrivate->shouldEmitSignals()
replyPrivate->...dEmitSignals()Description
TRUEevaluated 348 times by 1 test
Evaluated by:
  • tst_Spdy
FALSEnever evaluated
) {
0-348
1181 httpReply->readyRead();-
1182 httpReply->dataReadProgress(replyPrivate->totalProgress, replyPrivate->bodyLength);-
1183 }
executed 348 times by 1 test: end of block
Executed by:
  • tst_Spdy
348
1184-
1185 if (flag_compress
flag_compressDescription
TRUEnever evaluated
FALSEevaluated 348 times by 1 test
Evaluated by:
  • tst_Spdy
) {
0-348
1186 QMessageLogger(__FILE__, 12551252, __PRETTY_FUNCTION__).warning("SPDY level compression is not supported");-
1187 }
never executed: end of block
0
1188-
1189 if (flag_fin
flag_finDescription
TRUEevaluated 107 times by 1 test
Evaluated by:
  • tst_Spdy
FALSEevaluated 241 times by 1 test
Evaluated by:
  • tst_Spdy
) {
107-241
1190 if (httpReply->d_func()->state != QHttpNetworkReplyPrivate::SPDYHalfClosed
httpReply->d_f...SPDYHalfClosedDescription
TRUEnever evaluated
FALSEevaluated 107 times by 1 test
Evaluated by:
  • tst_Spdy
)
0-107
1191 sendDataFrame(streamID, DataFrame_FLAG_FIN, 0, 0);
never executed: sendDataFrame(streamID, DataFrame_FLAG_FIN, 0, 0);
0
1192 replyFinished(httpReply, streamID);-
1193 }
executed 107 times by 1 test: end of block
Executed by:
  • tst_Spdy
107
1194}
executed 348 times by 1 test: end of block
Executed by:
  • tst_Spdy
348
1195-
1196void QSpdyProtocolHandler::replyFinished(QHttpNetworkReply *httpReply, qint32 streamID)-
1197{-
1198 httpReply->d_func()->state = QHttpNetworkReplyPrivate::SPDYClosed;-
1199 httpReply->disconnect(this);-
1200 if (httpReply->request().uploadByteDevice())-
1201 httpReply->request().uploadByteDevice()->disconnect(this);-
1202 int streamsRemoved = m_inFlightStreams.remove(streamID);-
1203 ((!(streamsRemoved == 1)) ? qt_assert("streamsRemoved == 1",__FILE__,12721269) : qt_noop());-
1204 (void)streamsRemoved;;-
1205 httpReply->finished();-
1206}-
1207-
1208void QSpdyProtocolHandler::replyFinishedWithError(QHttpNetworkReply *httpReply, qint32 streamID,-
1209 QNetworkReply::NetworkError errorCode, const char *errorMessage)-
1210{-
1211 ((!(httpReply)) ? qt_assert("httpReply",__FILE__,12801277) : qt_noop());-
1212 httpReply->d_func()->state = QHttpNetworkReplyPrivate::SPDYClosed;-
1213 httpReply->disconnect(this);-
1214 if (httpReply->request().uploadByteDevice())-
1215 httpReply->request().uploadByteDevice()->disconnect(this);-
1216 int streamsRemoved = m_inFlightStreams.remove(streamID);-
1217 ((!(streamsRemoved == 1)) ? qt_assert("streamsRemoved == 1",__FILE__,12861283) : qt_noop());-
1218 (void)streamsRemoved;;-
1219 httpReply->finishedWithError(errorCode, QSpdyProtocolHandler::tr(errorMessage));-
1220}-
1221-
1222qint32 QSpdyProtocolHandler::generateNextStreamID()-
1223{-
1224-
1225 m_nextStreamID += 2;-
1226 return m_nextStreamID;-
1227}-
1228-
1229-
Switch to Source codePreprocessed file

Generated by Squish Coco Non-Commercial 4.3.0-BETA-master-30-08-2018-4cb69e9