OpenCoverage

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__,267) : 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__,276) : qt_noop());-
207 (void)zlibRet;;-
208}
executed 6 times by 1 test: end of block
Executed by:
  • tst_Spdy
6
209-
210QSpdyProtocolHandler::~QSpdyProtocolHandler()-
211{-
212 deflateEnd(&m_deflateStream);-
213 deflateEnd(&m_inflateStream);-
214}
executed 6 times by 2 tests: end of block
Executed by:
  • tst_Spdy
  • tst_spdy - unknown status
6
215-
216bool QSpdyProtocolHandler::sendRequest()-
217{-
218 ((!(!m_reply)) ? qt_assert("!m_reply",__FILE__,288) : qt_noop());-
219-
220 int maxPossibleRequests = m_maxConcurrentStreams - m_inFlightStreams.count();-
221 ((!(maxPossibleRequests >= 0)) ? qt_assert("maxPossibleRequests >= 0",__FILE__,291) : qt_noop());-
222 if (maxPossibleRequests == 0
maxPossibleRequests == 0Description
TRUEnever evaluated
FALSEevaluated 107 times by 1 test
Evaluated by:
  • tst_Spdy
)
0-107
223 return
never executed: return true;
true;
never executed: return true;
0
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 < requestsToSendDescription
TRUEevaluated 107 times by 1 test
Evaluated by:
  • tst_Spdy
FALSEevaluated 107 times by 1 test
Evaluated by:
  • tst_Spdy
; ++a) {
107
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__ ":" "314"), this, qFlagLocation("1""_q_replyDestroyed(QObject*)" "\0" __FILE__ ":" "314"));-
245-
246 sendSYN_STREAM(currentPair, streamID, 0);-
247 m_channel->spdyRequestsToSend.erase(it++);-
248 }
executed 107 times by 1 test: end of block
Executed by:
  • tst_Spdy
107
249 m_channel->state = QHttpNetworkConnectionChannel::IdleState;-
250 return
executed 107 times by 1 test: return true;
Executed by:
  • tst_Spdy
true;
executed 107 times by 1 test: return true;
Executed by:
  • tst_Spdy
107
251}-
252-
253void QSpdyProtocolHandler::_q_replyDestroyed(QObject* reply)-
254{-
255 qint32 streamID = reply->property("SPDYStreamID").toInt();-
256 if (m_inFlightStreams.remove(streamID)
m_inFlightStre...move(streamID)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
257 sendRST_STREAM(streamID, RST_STREAM_CANCEL);
never executed: sendRST_STREAM(streamID, RST_STREAM_CANCEL);
0
258}
never executed: end of block
0
259-
260void QSpdyProtocolHandler::_q_receiveReply()-
261{-
262 ((!(m_socket)) ? qt_assert("m_socket",__FILE__,332) : qt_noop());-
263-
264-
265-
266-
267 if (!qobject_cast<QHttpNetworkConnection*>(m_connection)
!qobject_cast<...(m_connection)Description
TRUEnever evaluated
FALSEevaluated 1373 times by 1 test
Evaluated by:
  • tst_Spdy
) {
0-1373
268 return;
never executed: return;
0
269 }-
270-
271 if (bytesAvailable() < 8
bytesAvailable() < 8Description
TRUEnever evaluated
FALSEevaluated 1373 times by 1 test
Evaluated by:
  • tst_Spdy
)
0-1373
272 return;
never executed: return;
0
273-
274 char frameHeadersRaw[8];-
275 if (!readNextChunk(8, frameHeadersRaw)
!readNextChunk...ameHeadersRaw)Description
TRUEnever evaluated
FALSEevaluated 1373 times by 1 test
Evaluated by:
  • tst_Spdy
)
0-1373
276 return;
never executed: return;
0
277-
278 const QByteArray frameHeaders(frameHeadersRaw, 8);-
279 if (frameHeadersRaw[0] & 0x80
frameHeadersRaw[0] & 0x80Description
TRUEevaluated 869 times by 1 test
Evaluated by:
  • tst_Spdy
FALSEevaluated 504 times by 1 test
Evaluated by:
  • tst_Spdy
) {
504-869
280 handleControlFrame(frameHeaders);-
281 }
executed 869 times by 1 test: end of block
Executed by:
  • tst_Spdy
else {
869
282 handleDataFrame(frameHeaders);-
283 }
executed 504 times by 1 test: end of block
Executed by:
  • tst_Spdy
504
284-
285-
286 if (m_socket->bytesAvailable() > 0
m_socket->bytesAvailable() > 0Description
TRUEnever evaluated
FALSEevaluated 1373 times by 1 test
Evaluated by:
  • tst_Spdy
)
0-1373
287 QMetaObject::invokeMethod(m_channel, "_q_receiveReply", Qt::QueuedConnection);
never executed: QMetaObject::invokeMethod(m_channel, "_q_receiveReply", Qt::QueuedConnection);
0
288}
executed 1373 times by 1 test: end of block
Executed by:
  • tst_Spdy
1373
289-
290void QSpdyProtocolHandler::_q_readyRead()-
291{-
292 _q_receiveReply();-
293}
executed 1373 times by 1 test: end of block
Executed by:
  • tst_Spdy
1373
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>(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>(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>(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, output + 1);-
313 qToBigEndian<qint8>(number >> 16, 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, output);-
319}
executed 28 times by 1 test: end of block
Executed by:
  • tst_Spdy
28
320-
321static QByteArray intToFourBytes(qint32 number)-
322{-
323 char data[4];-
324 qToBigEndian<qint32>(number, data);-
325 QByteArray ret(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 char data[4];-
332 qToBigEndian<qint32>(number << 8, data);-
333 QByteArray ret(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
executed 1367 times by 1 test: return fourBytesToInt(bytes) & 0x3fffffff;
Executed by:
  • tst_Spdy
fourBytesToInt(bytes) & 0x3fffffff;
executed 1367 times by 1 test: return fourBytesToInt(bytes) & 0x3fffffff;
Executed by:
  • tst_Spdy
1367
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
executed 873 times by 1 test: return ret;
Executed by:
  • tst_Spdy
ret;
executed 873 times by 1 test: return ret;
Executed by:
  • tst_Spdy
873
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
zlibRet == 2Description
TRUEevaluated 6 times by 1 test
Evaluated by:
  • tst_Spdy
FALSEevaluated 107 times by 1 test
Evaluated by:
  • tst_Spdy
) {
6-107
370 zlibRet = inflateSetDictionary(&m_inflateStream,-
371 reinterpret_cast<const Bytef*>(spdyDictionary),-
372 1423);-
373 ((!(zlibRet == 0)) ? qt_assert("zlibRet == Z_OK",__FILE__,443) : qt_noop());-
374 continue;
executed 6 times by 1 test: continue;
Executed by:
  • tst_Spdy
6
375 }-
376 switch (zlibRet) {-
377 case
never executed: case (-5):
(-5):
never executed: case (-5):
{
0
378 if (m_inflateStream.avail_in == 0
m_inflateStream.avail_in == 0Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
379 int outputSize = chunkSize - m_inflateStream.avail_out;-
380 output->append(outputRaw, outputSize);-
381 m_inflateStream.avail_out = chunkSize;-
382 }
never executed: end of block
0
383 break;
never executed: break;
0
384 }-
385 case
executed 107 times by 1 test: case 0:
Executed by:
  • tst_Spdy
0:
executed 107 times by 1 test: case 0:
Executed by:
  • tst_Spdy
{
107
386 int outputSize = chunkSize - m_inflateStream.avail_out;-
387 output->append(outputRaw, outputSize);-
388 break;
executed 107 times by 1 test: break;
Executed by:
  • tst_Spdy
107
389 }-
390 default
never executed: default:
:
never executed: default:
{
0
391 QMessageLogger(__FILE__, 461, __PRETTY_FUNCTION__).warning() << "got unexpected zlib return value:" << zlibRet;-
392 return
never executed: return false;
false;
never executed: return false;
0
393 }-
394 }-
395 } while (m_inflateStream.avail_in > 0
m_inflateStream.avail_in > 0Description
TRUEevaluated 6 times by 1 test
Evaluated by:
  • tst_Spdy
FALSEevaluated 107 times by 1 test
Evaluated by:
  • tst_Spdy
&& zlibRet != 1
zlibRet != 1Description
TRUEevaluated 6 times by 1 test
Evaluated by:
  • tst_Spdy
FALSEnever evaluated
);
0-107
396-
397 ((!(m_inflateStream.avail_in == 0)) ? qt_assert("m_inflateStream.avail_in == 0",__FILE__,467) : qt_noop());-
398 return
executed 107 times by 1 test: return true;
Executed by:
  • tst_Spdy
true;
executed 107 times by 1 test: return true;
Executed by:
  • tst_Spdy
107
399}-
400-
401QByteArray QSpdyProtocolHandler::composeHeader(const QHttpNetworkRequest &request)-
402{-
403 QByteArray uncompressedHeader;-
404 uncompressedHeader.reserve(300);-
405-
406-
407-
408-
409 QVector<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__,524) : qt_noop());-
455 (void)zlibRet;;-
456 ((!(m_deflateStream.avail_in == 0)) ? qt_assert("m_deflateStream.avail_in == 0",__FILE__,526) : 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__,535) : qt_noop());-
466 return
executed 1373 times by 1 test: return m_spdyBuffer.byteAmount() + m_socket->bytesAvailable();
Executed by:
  • tst_Spdy
m_spdyBuffer.byteAmount() + m_socket->bytesAvailable();
executed 1373 times by 1 test: return m_spdyBuffer.byteAmount() + m_socket->bytesAvailable();
Executed by:
  • tst_Spdy
1373
467}-
468-
469bool QSpdyProtocolHandler::readNextChunk(qint64 length, char *sink)-
470{-
471 qint64 expectedReadBytes = length;-
472 qint64 requiredBytesFromBuffer = 0;-
473-
474 if (m_waitingForCompleteStream
m_waitingForCompleteStreamDescription
TRUEevaluated 312 times by 1 test
Evaluated by:
  • tst_Spdy
FALSEevaluated 2434 times by 1 test
Evaluated by:
  • tst_Spdy
) {
312-2434
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__,550) : qt_noop());-
481 if (length <= bytesReadFromBuffer
length <= bytesReadFromBufferDescription
TRUEevaluated 156 times by 1 test
Evaluated by:
  • tst_Spdy
FALSEevaluated 156 times by 1 test
Evaluated by:
  • tst_Spdy
) {
156
482 return
executed 156 times by 1 test: return true;
Executed by:
  • tst_Spdy
true;
executed 156 times by 1 test: return true;
Executed by:
  • tst_Spdy
156
483 }-
484 expectedReadBytes -= requiredBytesFromBuffer;-
485 }
executed 156 times by 1 test: end of block
Executed by:
  • tst_Spdy
156
486 qint64 readBytes = m_socket->read(sink + requiredBytesFromBuffer, expectedReadBytes);-
487-
488 if (readBytes < expectedReadBytes
readBytes < expectedReadBytesDescription
TRUEevaluated 156 times by 1 test
Evaluated by:
  • tst_Spdy
FALSEevaluated 2434 times by 1 test
Evaluated by:
  • tst_Spdy
) {
156-2434
489 m_waitingForCompleteStream = true;-
490-
491 QByteArray temp(sink, requiredBytesFromBuffer + readBytes);-
492 m_spdyBuffer.append(temp);-
493 return
executed 156 times by 1 test: return false;
Executed by:
  • tst_Spdy
false;
executed 156 times by 1 test: return false;
Executed by:
  • tst_Spdy
156
494 } else {-
495 return
executed 2434 times by 1 test: return true;
Executed by:
  • tst_Spdy
true;
executed 2434 times by 1 test: return true;
Executed by:
  • tst_Spdy
2434
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
never executed: case FrameType_CREDENTIAL:
FrameType_CREDENTIAL:
never executed: case FrameType_CREDENTIAL:
{
0
511 QMessageLogger(__FILE__, 581, __PRETTY_FUNCTION__).warning("sending SPDY CREDENTIAL frame is not yet implemented");-
512 return;
never executed: return;
0
513 }-
514 default
executed 121 times by 1 test: default:
Executed by:
  • tst_Spdy
:
executed 121 times by 1 test: default:
Executed by:
  • tst_Spdy
121
515 header[3] = type;-
516 }
executed 121 times by 1 test: end of block
Executed by:
  • tst_Spdy
121
517-
518-
519 header[4] = 0;-
520 if (flags & ControlFrame_FLAG_FIN || length == 0
length == 0Description
TRUEnever evaluated
FALSEevaluated 29 times by 1 test
Evaluated by:
  • tst_Spdy
) {
0-29
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 592-
525 ) : qt_noop())-
526 ;-
527 header[4] |= ControlFrame_FLAG_FIN;-
528 }
executed 92 times by 1 test: end of block
Executed by:
  • tst_Spdy
92
529 if (flags & ControlFrame_FLAG_UNIDIRECTIONAL
flags & Contro...UNIDIRECTIONALDescription
TRUEnever evaluated
FALSEevaluated 121 times by 1 test
Evaluated by:
  • tst_Spdy
) {
0-121
530 ((!(type == FrameType_SYN_STREAM)) ? qt_assert("type == FrameType_SYN_STREAM",__FILE__,596) : qt_noop());-
531 header[4] |= ControlFrame_FLAG_UNIDIRECTIONAL;-
532 }
never executed: end of block
0
533-
534-
535 appendIntToThreeBytes(header + 5, length);-
536-
537 qint64 written = m_socket->write(header, 8);-
538 ((!(written == 8)) ? qt_assert("written == 8",__FILE__,604) : qt_noop());-
539 written = m_socket->write(data, length);-
540 ((!(written == length)) ? qt_assert("written == length",__FILE__,606) : qt_noop());-
541 (void)written;;-
542}
executed 121 times by 1 test: end of block
Executed by:
  • tst_Spdy
121
543-
544void QSpdyProtocolHandler::sendSYN_STREAM(const HttpMessagePair &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__ ":" "629"), this,-
564 qFlagLocation("1""_q_uploadDataReadyRead()" "\0" __FILE__ ":" "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}
never executed: end of block
0
607-
608void QSpdyProtocolHandler::sendPING(quint32 pingID)-
609{-
610 char rawData[4];-
611 appendIntToFourBytes(rawData, pingID);-
612 sendControlFrame(FrameType_PING, 0, rawData, 4);-
613}
never executed: end of block
0
614-
615bool QSpdyProtocolHandler::uploadData(qint32 streamID)-
616{-
617-
618 if (!m_inFlightStreams.contains(streamID)
!m_inFlightStr...ains(streamID)Description
TRUEnever evaluated
FALSEevaluated 1475 times by 1 test
Evaluated by:
  • tst_Spdy
) {
0-1475
619 sendRST_STREAM(streamID, RST_STREAM_INVALID_STREAM);-
620 return
never executed: return false;
false;
never executed: return false;
0
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__,692) : qt_noop());-
627 QHttpNetworkReplyPrivate *replyPrivate = reply->d_func();-
628 ((!(replyPrivate)) ? qt_assert("replyPrivate",__FILE__,694) : qt_noop());-
629-
630 if (reply->d_func()->state == QHttpNetworkReplyPrivate::SPDYHalfClosed
reply->d_func(...SPDYHalfClosedDescription
TRUEnever evaluated
FALSEevaluated 1475 times by 1 test
Evaluated by:
  • tst_Spdy
|| reply->d_func()->state == QHttpNetworkReplyPrivate::SPDYClosed
reply->d_func(...te::SPDYClosedDescription
TRUEnever evaluated
FALSEevaluated 1475 times by 1 test
Evaluated by:
  • tst_Spdy
) {
0-1475
631 QMessageLogger(__FILE__, 697, __PRETTY_FUNCTION__).warning("Trying to upload to closed stream");-
632 return
never executed: return false;
false;
never executed: return false;
0
633 }-
634-
635 qint32 dataLeftInWindow = replyPrivate->windowSizeUpload-
636 - replyPrivate->currentlyUploadedDataInWindow;-
637-
638 while (dataLeftInWindow > 0
dataLeftInWindow > 0Description
TRUEevaluated 1496 times by 1 test
Evaluated by:
  • tst_Spdy
FALSEevaluated 719 times by 1 test
Evaluated by:
  • tst_Spdy
&& !request.uploadByteDevice()->atEnd()
!request.uploa...ice()->atEnd()Description
TRUEevaluated 1495 times by 1 test
Evaluated by:
  • tst_Spdy
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_Spdy
) {
1-1496
639-
640-
641 qint64 currentReadSize = 0;-
642 const char *readPointer = request.uploadByteDevice()->readPointer(dataLeftInWindow,-
643 currentReadSize);-
644-
645 if (currentReadSize == -1
currentReadSize == -1Description
TRUEnever evaluated
FALSEevaluated 1495 times by 1 test
Evaluated by:
  • tst_Spdy
) {
0-1495
646-
647 m_connection->d_func()->emitReplyError(m_socket, reply,-
648 QNetworkReply::UnknownNetworkError);-
649 return
never executed: return false;
false;
never executed: return false;
0
650 } else if (readPointer == 0
readPointer == 0Description
TRUEevaluated 755 times by 1 test
Evaluated by:
  • tst_Spdy
FALSEevaluated 740 times by 1 test
Evaluated by:
  • tst_Spdy
|| currentReadSize == 0
currentReadSize == 0Description
TRUEnever evaluated
FALSEevaluated 740 times by 1 test
Evaluated by:
  • tst_Spdy
) {
0-755
651-
652 break;
executed 755 times by 1 test: break;
Executed by:
  • tst_Spdy
755
653 } else {-
654 DataFrameFlags flags = 0;-
655-
656 qint64 currentWriteSize = sendDataFrame(streamID, flags, currentReadSize, readPointer);-
657 if (currentWriteSize == -1
currentWriteSize == -1Description
TRUEnever evaluated
FALSEevaluated 740 times by 1 test
Evaluated by:
  • tst_Spdy
|| currentWriteSize != currentReadSize
currentWriteSi...urrentReadSizeDescription
TRUEnever evaluated
FALSEevaluated 740 times by 1 test
Evaluated by:
  • tst_Spdy
) {
0-740
658-
659 m_connection->d_func()->emitReplyError(m_socket, reply,-
660 QNetworkReply::UnknownNetworkError);-
661 return
never executed: return false;
false;
never executed: return false;
0
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 }
executed 740 times by 1 test: end of block
Executed by:
  • tst_Spdy
740
672 }-
673 }-
674 if (replyPrivate->totallyUploadedData == request.contentLength()
replyPrivate->...ontentLength()Description
TRUEevaluated 15 times by 1 test
Evaluated by:
  • tst_Spdy
FALSEevaluated 1460 times by 1 test
Evaluated by:
  • tst_Spdy
) {
15-1460
675 DataFrameFlags finFlag = DataFrame_FLAG_FIN;-
676 qint64 writeSize = sendDataFrame(streamID, finFlag, 0, 0);-
677 ((!(writeSize == 0)) ? qt_assert("writeSize == 0",__FILE__,743) : qt_noop());-
678 (void)writeSize;;-
679 replyPrivate->state = QHttpNetworkReplyPrivate::SPDYHalfClosed;-
680 if (reply->request().uploadByteDevice()
reply->request...adByteDevice()Description
TRUEevaluated 15 times by 1 test
Evaluated by:
  • tst_Spdy
FALSEnever evaluated
)
0-15
681 reply->request().uploadByteDevice()->disconnect(this);
executed 15 times by 1 test: reply->request().uploadByteDevice()->disconnect(this);
Executed by:
  • tst_Spdy
15
682-
683-
684-
685 }
executed 15 times by 1 test: end of block
Executed by:
  • tst_Spdy
15
686 return
executed 1475 times by 1 test: return true;
Executed by:
  • tst_Spdy
true;
executed 1475 times by 1 test: return true;
Executed by:
  • tst_Spdy
1475
687}-
688-
689void QSpdyProtocolHandler::_q_uploadDataReadyRead()-
690{-
691 QNonContiguousByteDevice *device = qobject_cast<QNonContiguousByteDevice *>(sender());-
692 ((!(device)) ? qt_assert("device",__FILE__,758) : qt_noop());-
693 qint32 streamID = device->property("SPDYStreamID").toInt();-
694 ((!(streamID > 0)) ? qt_assert("streamID > 0",__FILE__,760) : qt_noop());-
695 uploadData(streamID);-
696}
executed 740 times by 1 test: end of block
Executed by:
  • tst_Spdy
740
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}
executed 14 times by 1 test: end of block
Executed by:
  • tst_Spdy
14
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__,783) : qt_noop());-
718 m_socket->write(wireData);-
719-
720 if (data
dataDescription
TRUEevaluated 740 times by 1 test
Evaluated by:
  • tst_Spdy
FALSEevaluated 15 times by 1 test
Evaluated by:
  • tst_Spdy
) {
15-740
721 qint64 ret = m_socket->write(data, length);-
722 return
executed 740 times by 1 test: return ret;
Executed by:
  • tst_Spdy
ret;
executed 740 times by 1 test: return ret;
Executed by:
  • tst_Spdy
740
723 } else {-
724 return
executed 15 times by 1 test: return 0;
Executed by:
  • tst_Spdy
0;
executed 15 times by 1 test: return 0;
Executed by:
  • tst_Spdy
15
725 }-
726}-
727-
728void QSpdyProtocolHandler::handleControlFrame(const QByteArray &frameHeaders)-
729{-
730 ((!(frameHeaders.count() >= 8)) ? qt_assert("frameHeaders.count() >= 8",__FILE__,796) : qt_noop());-
731 qint16 version = twoBytesToInt(frameHeaders.constData());-
732 version &= 0x3fff;-
733 ((!(version == 3)) ? qt_assert("version == 3",__FILE__,799) : 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__,805) : qt_noop());-
740-
741 QByteArray frameData;-
742 frameData.resize(length);-
743 if (!readNextChunk(length, frameData.data())
!readNextChunk...meData.data())Description
TRUEnever evaluated
FALSEevaluated 869 times by 1 test
Evaluated by:
  • tst_Spdy
) {
0-869
744-
745 m_spdyBuffer.prepend(frameHeaders);-
746 return;
never executed: return;
0
747 } else {-
748 m_spdyBuffer.clear();-
749 m_waitingForCompleteStream = false;-
750 }
executed 869 times by 1 test: end of block
Executed by:
  • tst_Spdy
869
751-
752 switch (type) {-
753 case
never executed: case FrameType_SYN_STREAM:
FrameType_SYN_STREAM:
never executed: case FrameType_SYN_STREAM:
{
0
754 handleSYN_STREAM(flags, length, frameData);-
755 break;
never executed: break;
0
756 }-
757 case
executed 107 times by 1 test: case FrameType_SYN_REPLY:
Executed by:
  • tst_Spdy
FrameType_SYN_REPLY:
executed 107 times by 1 test: case FrameType_SYN_REPLY:
Executed by:
  • tst_Spdy
{
107
758 handleSYN_REPLY(flags, length, frameData);-
759 break;
executed 107 times by 1 test: break;
Executed by:
  • tst_Spdy
107
760 }-
761 case
never executed: case FrameType_RST_STREAM:
FrameType_RST_STREAM:
never executed: case FrameType_RST_STREAM:
{
0
762 handleRST_STREAM(flags, length, frameData);-
763 break;
never executed: break;
0
764 }-
765 case
executed 6 times by 1 test: case FrameType_SETTINGS:
Executed by:
  • tst_Spdy
FrameType_SETTINGS:
executed 6 times by 1 test: case FrameType_SETTINGS:
Executed by:
  • tst_Spdy
{
6
766 handleSETTINGS(flags, length, frameData);-
767 break;
executed 6 times by 1 test: break;
Executed by:
  • tst_Spdy
6
768 }-
769 case
never executed: case FrameType_PING:
FrameType_PING:
never executed: case FrameType_PING:
{
0
770 handlePING(flags, length, frameData);-
771 break;
never executed: break;
0
772 }-
773 case
never executed: case FrameType_GOAWAY:
FrameType_GOAWAY:
never executed: case FrameType_GOAWAY:
{
0
774 handleGOAWAY(flags, length, frameData);-
775 break;
never executed: break;
0
776 }-
777 case
never executed: case FrameType_HEADERS:
FrameType_HEADERS:
never executed: case FrameType_HEADERS:
{
0
778 handleHEADERS(flags, length, frameData);-
779 break;
never executed: break;
0
780 }-
781 case
executed 756 times by 1 test: case FrameType_WINDOW_UPDATE:
Executed by:
  • tst_Spdy
FrameType_WINDOW_UPDATE:
executed 756 times by 1 test: case FrameType_WINDOW_UPDATE:
Executed by:
  • tst_Spdy
{
756
782 handleWINDOW_UPDATE(flags, length, frameData);-
783 break;
executed 756 times by 1 test: break;
Executed by:
  • tst_Spdy
756
784 }-
785 default
never executed: default:
:
never executed: default:
0
786 QMessageLogger(__FILE__, 852, __PRETTY_FUNCTION__).warning() << "cannot handle frame of type" << type;-
787 }
never executed: end of block
0
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}
never executed: end of block
0
800-
801void QSpdyProtocolHandler::handleSYN_REPLY(char flags, quint32 , const QByteArray &frameData)-
802{-
803 parseHttpHeaders(flags, frameData);-
804}
executed 107 times by 1 test: end of block
Executed by:
  • tst_Spdy
107
805-
806void QSpdyProtocolHandler::parseHttpHeaders(char flags, const QByteArray &frameData)-
807{-
808 qint32 streamID = getStreamID(frameData.constData());-
809 const auto it = m_inFlightStreams.constFind(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 = it.value();-
821 QHttpNetworkReply *httpReply = pair.second;-
822 ((!(httpReply != 0)) ? qt_assert("httpReply != 0",__FILE__,888) : 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__, 897, __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__, 903, __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__, 914, __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__, 923, __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
872 value.replace('\0', name == "set-cookie" ? "\n" : ", ");-
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__,956) : 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
never executed: case RST_STREAM_PROTOCOL_ERROR:
RST_STREAM_PROTOCOL_ERROR:
never executed: case RST_STREAM_PROTOCOL_ERROR:
0
902 errorCode = QNetworkReply::ProtocolFailure;-
903 errorMessage = "SPDY protocol error";-
904 break;
never executed: break;
0
905 case
never executed: case RST_STREAM_INVALID_STREAM:
RST_STREAM_INVALID_STREAM:
never executed: case RST_STREAM_INVALID_STREAM:
0
906 errorCode = QNetworkReply::ProtocolFailure;-
907 errorMessage = "SPDY stream is not active";-
908 break;
never executed: break;
0
909 case
never executed: case RST_STREAM_REFUSED_STREAM:
RST_STREAM_REFUSED_STREAM:
never executed: case RST_STREAM_REFUSED_STREAM:
0
910 errorCode = QNetworkReply::ProtocolFailure;-
911 errorMessage = "SPDY stream was refused";-
912 break;
never executed: break;
0
913 case
never executed: case RST_STREAM_UNSUPPORTED_VERSION:
RST_STREAM_UNSUPPORTED_VERSION:
never executed: case RST_STREAM_UNSUPPORTED_VERSION:
0
914 errorCode = QNetworkReply::ProtocolUnknownError;-
915 errorMessage = "SPDY version is unknown to the server";-
916 break;
never executed: break;
0
917 case
never executed: case RST_STREAM_CANCEL:
RST_STREAM_CANCEL:
never executed: case RST_STREAM_CANCEL:
0
918 errorCode = QNetworkReply::ProtocolFailure;-
919 errorMessage = "SPDY stream is no longer needed";-
920 break;
never executed: break;
0
921 case
never executed: case RST_STREAM_INTERNAL_ERROR:
RST_STREAM_INTERNAL_ERROR:
never executed: case RST_STREAM_INTERNAL_ERROR:
0
922 errorCode = QNetworkReply::InternalServerError;-
923 errorMessage = "Internal server error";-
924 break;
never executed: break;
0
925 case
never executed: case RST_STREAM_FLOW_CONTROL_ERROR:
RST_STREAM_FLOW_CONTROL_ERROR:
never executed: case RST_STREAM_FLOW_CONTROL_ERROR:
0
926 errorCode = QNetworkReply::ProtocolFailure;-
927 errorMessage = "peer violated the flow control protocol";-
928 break;
never executed: break;
0
929 case
never executed: case RST_STREAM_STREAM_IN_USE:
RST_STREAM_STREAM_IN_USE:
never executed: case RST_STREAM_STREAM_IN_USE:
0
930 errorCode = QNetworkReply::ProtocolFailure;-
931 errorMessage = "server received a SYN_REPLY for an already open stream";-
932 break;
never executed: break;
0
933 case
never executed: case RST_STREAM_STREAM_ALREADY_CLOSED:
RST_STREAM_STREAM_ALREADY_CLOSED:
never executed: case RST_STREAM_STREAM_ALREADY_CLOSED:
0
934 errorCode = QNetworkReply::ProtocolFailure;-
935 errorMessage = "server received data or a SYN_REPLY for an already half-closed stream";-
936 break;
never executed: break;
0
937 case
never executed: case RST_STREAM_INVALID_CREDENTIALS:
RST_STREAM_INVALID_CREDENTIALS:
never executed: case RST_STREAM_INVALID_CREDENTIALS:
0
938 errorCode = QNetworkReply::ContentAccessDenied;-
939 errorMessage = "server received invalid credentials";-
940 break;
never executed: break;
0
941 case
never executed: case RST_STREAM_FRAME_TOO_LARGE:
RST_STREAM_FRAME_TOO_LARGE:
never executed: case RST_STREAM_FRAME_TOO_LARGE:
0
942 errorCode = QNetworkReply::ProtocolFailure;-
943 errorMessage = "server cannot process the frame because it is too large";-
944 break;
never executed: break;
0
945 default
never executed: default:
:
never executed: default:
0
946 QMessageLogger(__FILE__, 1012, __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 }
never executed: end of block
0
950 if (httpReply
httpReplyDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
951 replyFinishedWithError(httpReply, streamID, errorCode, errorMessage.constData());
never executed: replyFinishedWithError(httpReply, streamID, errorCode, errorMessage.constData());
0
952}
never executed: end of block
0
953-
954void QSpdyProtocolHandler::handleSETTINGS(char flags, quint32 , const QByteArray &frameData)-
955{-
956 ((!(frameData.count() > 0)) ? qt_assert("frameData.count() > 0",__FILE__,1022) : qt_noop());-
957-
958 SETTINGS_Flags settingsFlags = static_cast<SETTINGS_Flags>(flags);-
959 if (settingsFlags & FLAG_SETTINGS_CLEAR_SETTINGS
settingsFlags ...CLEAR_SETTINGSDescription
TRUEnever evaluated
FALSEevaluated 6 times by 1 test
Evaluated by:
  • tst_Spdy
) {
0-6
960-
961-
962 }
never executed: end of block
0
963-
964 qint32 numberOfEntries = fourBytesToInt(frameData.constData());-
965 ((!(numberOfEntries > 0)) ? qt_assert("numberOfEntries > 0",__FILE__,1031) : qt_noop());-
966 for (int a = 0, frameDataIndex = 4; a < numberOfEntries
a < numberOfEntriesDescription
TRUEevaluated 6 times by 1 test
Evaluated by:
  • tst_Spdy
FALSEevaluated 6 times by 1 test
Evaluated by:
  • tst_Spdy
; ++a, frameDataIndex += 8) {
6
967 SETTINGS_ID_Flag idFlag = static_cast<SETTINGS_ID_Flag>(frameData[frameDataIndex]);-
968 if (idFlag & FLAG_SETTINGS_PERSIST_VALUE
idFlag & FLAG_..._PERSIST_VALUEDescription
TRUEnever evaluated
FALSEevaluated 6 times by 1 test
Evaluated by:
  • tst_Spdy
) {
0-6
969-
970-
971 }
never executed: end of block
0
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
never executed: case SETTINGS_UPLOAD_BANDWIDTH:
SETTINGS_UPLOAD_BANDWIDTH:
never executed: case SETTINGS_UPLOAD_BANDWIDTH:
{
0
978-
979 break;
never executed: break;
0
980 }-
981 case
never executed: case SETTINGS_DOWNLOAD_BANDWIDTH:
SETTINGS_DOWNLOAD_BANDWIDTH:
never executed: case SETTINGS_DOWNLOAD_BANDWIDTH:
{
0
982-
983 break;
never executed: break;
0
984 }-
985 case
never executed: case SETTINGS_ROUND_TRIP_TIME:
SETTINGS_ROUND_TRIP_TIME:
never executed: case SETTINGS_ROUND_TRIP_TIME:
{
0
986-
987 break;
never executed: break;
0
988 }-
989 case
executed 6 times by 1 test: case SETTINGS_MAX_CONCURRENT_STREAMS:
Executed by:
  • tst_Spdy
SETTINGS_MAX_CONCURRENT_STREAMS:
executed 6 times by 1 test: case SETTINGS_MAX_CONCURRENT_STREAMS:
Executed by:
  • tst_Spdy
{
6
990 m_maxConcurrentStreams = value;-
991 break;
executed 6 times by 1 test: break;
Executed by:
  • tst_Spdy
6
992 }-
993 case
never executed: case SETTINGS_CURRENT_CWND:
SETTINGS_CURRENT_CWND:
never executed: case SETTINGS_CURRENT_CWND:
{
0
994-
995 break;
never executed: break;
0
996 }-
997 case
never executed: case SETTINGS_DOWNLOAD_RETRANS_RATE:
SETTINGS_DOWNLOAD_RETRANS_RATE:
never executed: case SETTINGS_DOWNLOAD_RETRANS_RATE:
{
0
998-
999 break;
never executed: break;
0
1000 }-
1001 case
never executed: case SETTINGS_INITIAL_WINDOW_SIZE:
SETTINGS_INITIAL_WINDOW_SIZE:
never executed: case SETTINGS_INITIAL_WINDOW_SIZE:
{
0
1002 m_initialWindowSize = value;-
1003 break;
never executed: break;
0
1004 }-
1005 case
never executed: case SETTINGS_CLIENT_CERTIFICATE_VECTOR_SIZE:
SETTINGS_CLIENT_CERTIFICATE_VECTOR_SIZE:
never executed: case SETTINGS_CLIENT_CERTIFICATE_VECTOR_SIZE:
{
0
1006-
1007 break;
never executed: break;
0
1008 }-
1009 default
never executed: default:
:
never executed: default:
0
1010 QMessageLogger(__FILE__, 1076, __PRETTY_FUNCTION__).warning() << "found unknown settings value" << value;-
1011 }
never executed: end of block
0
1012 }-
1013}
executed 6 times by 1 test: end of block
Executed by:
  • tst_Spdy
6
1014-
1015void QSpdyProtocolHandler::handlePING(char , quint32 length, const QByteArray &frameData)-
1016{-
1017-
1018-
1019 ((!(length == 4)) ? qt_assert("length == 4",__FILE__,1085) : qt_noop());-
1020 (void)length;;-
1021 quint32 pingID = fourBytesToInt(frameData.constData());-
1022-
1023-
1024 if ((
(pingID & 1) == 0Description
TRUEnever evaluated
FALSEnever evaluated
pingID & 1) == 0
(pingID & 1) == 0Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1025 sendPING(pingID);
never executed: sendPING(pingID);
0
1026}
never executed: end of block
0
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
never executed: case GOAWAY_OK:
GOAWAY_OK:
never executed: case GOAWAY_OK:
{
0
1037 errorCode = QNetworkReply::NoError;-
1038 break;
never executed: break;
0
1039 }-
1040 case
never executed: case GOAWAY_PROTOCOL_ERROR:
GOAWAY_PROTOCOL_ERROR:
never executed: case GOAWAY_PROTOCOL_ERROR:
{
0
1041 errorCode = QNetworkReply::ProtocolFailure;-
1042 break;
never executed: break;
0
1043 }-
1044 case
never executed: case GOAWAY_INTERNAL_ERROR:
GOAWAY_INTERNAL_ERROR:
never executed: case GOAWAY_INTERNAL_ERROR:
{
0
1045 errorCode = QNetworkReply::InternalServerError;-
1046 break;
never executed: break;
0
1047 }-
1048 default
never executed: default:
:
never executed: default:
0
1049 QMessageLogger(__FILE__, 1115, __PRETTY_FUNCTION__).warning() << "unexpected status code" << statusCode;-
1050 errorCode = QNetworkReply::ProtocolUnknownError;-
1051 }
never executed: end of block
0
1052-
1053 qint32 lastGoodStreamID = getStreamID(frameData.constData());-
1054-
1055-
1056 ((!(m_connection)) ? qt_assert("m_connection",__FILE__,1122) : qt_noop());-
1057 for (qint32 currentStreamID = lastGoodStreamID + 2; currentStreamID <= m_nextStreamID
currentStreamI...m_nextStreamIDDescription
TRUEnever evaluated
FALSEnever evaluated
;
0
1058 ++currentStreamID) {-
1059 QHttpNetworkReply *reply = m_inFlightStreams.value(currentStreamID).second;-
1060 ((!(reply)) ? qt_assert("reply",__FILE__,1126) : qt_noop());-
1061 m_connection->d_func()->emitReplyError(m_socket, reply, errorCode);-
1062 }
never executed: end of block
0
1063-
1064}
never executed: end of block
0
1065-
1066void QSpdyProtocolHandler::handleHEADERS(char flags, quint32 ,-
1067 const QByteArray &frameData)-
1068{-
1069 parseHttpHeaders(flags, frameData);-
1070}
never executed: end of block
0
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 const auto it = m_inFlightStreams.constFind(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 = it.value().second;-
1085 ((!(reply)) ? qt_assert("reply",__FILE__,1151) : qt_noop());-
1086 QHttpNetworkReplyPrivate *replyPrivate = reply->d_func();-
1087 ((!(replyPrivate)) ? qt_assert("replyPrivate",__FILE__,1153) : 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__,1166) : qt_noop());-
1101-
1102 qint32 streamID = getStreamID(frameHeaders.constData());-
1103 const auto it = m_inFlightStreams.constFind(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 = it.value();-
1127 QHttpNetworkRequest httpRequest = pair.first;-
1128 QHttpNetworkReply *httpReply = pair.second;-
1129 ((!(httpReply != 0)) ? qt_assert("httpReply != 0",__FILE__,1195) : 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__,1240) : 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__, 1252, __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()
httpReply->req...adByteDevice()Description
TRUEevaluated 15 times by 1 test
Evaluated by:
  • tst_Spdy
FALSEevaluated 92 times by 1 test
Evaluated by:
  • tst_Spdy
)
15-92
1201 httpReply->request().uploadByteDevice()->disconnect(this);
executed 15 times by 1 test: httpReply->request().uploadByteDevice()->disconnect(this);
Executed by:
  • tst_Spdy
15
1202 int streamsRemoved = m_inFlightStreams.remove(streamID);-
1203 ((!(streamsRemoved == 1)) ? qt_assert("streamsRemoved == 1",__FILE__,1269) : qt_noop());-
1204 (void)streamsRemoved;;-
1205 httpReply->finished();-
1206}
executed 107 times by 1 test: end of block
Executed by:
  • tst_Spdy
107
1207-
1208void QSpdyProtocolHandler::replyFinishedWithError(QHttpNetworkReply *httpReply, qint32 streamID,-
1209 QNetworkReply::NetworkError errorCode, const char *errorMessage)-
1210{-
1211 ((!(httpReply)) ? qt_assert("httpReply",__FILE__,1277) : qt_noop());-
1212 httpReply->d_func()->state = QHttpNetworkReplyPrivate::SPDYClosed;-
1213 httpReply->disconnect(this);-
1214 if (httpReply->request().uploadByteDevice()
httpReply->req...adByteDevice()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1215 httpReply->request().uploadByteDevice()->disconnect(this);
never executed: httpReply->request().uploadByteDevice()->disconnect(this);
0
1216 int streamsRemoved = m_inFlightStreams.remove(streamID);-
1217 ((!(streamsRemoved == 1)) ? qt_assert("streamsRemoved == 1",__FILE__,1283) : qt_noop());-
1218 (void)streamsRemoved;;-
1219 httpReply->finishedWithError(errorCode, QSpdyProtocolHandler::tr(errorMessage));-
1220}
never executed: end of block
0
1221-
1222qint32 QSpdyProtocolHandler::generateNextStreamID()-
1223{-
1224-
1225 m_nextStreamID += 2;-
1226 return
executed 107 times by 1 test: return m_nextStreamID;
Executed by:
  • tst_Spdy
m_nextStreamID;
executed 107 times by 1 test: return m_nextStreamID;
Executed by:
  • tst_Spdy
107
1227}-
1228-
1229-
Switch to Source codePreprocessed file

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