| Absolute File Name: | /home/qt/qt5_coco/qt5/qtbase/src/network/access/qspdyprotocolhandler.cpp |
| Switch to Source code | Preprocessed file |
| Line | Source | Count | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | - | |||||||||||||||||||
| 2 | - | |||||||||||||||||||
| 3 | - | |||||||||||||||||||
| 4 | - | |||||||||||||||||||
| 5 | - | |||||||||||||||||||
| 6 | static 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 | }; | - | ||||||||||||||||||
| 186 | QSpdyProtocolHandler::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 blockExecuted by:
| 6 | ||||||||||||||||||
| 209 | - | |||||||||||||||||||
| 210 | QSpdyProtocolHandler::~QSpdyProtocolHandler() | - | ||||||||||||||||||
| 211 | { | - | ||||||||||||||||||
| 212 | deflateEnd(&m_deflateStream); | - | ||||||||||||||||||
| 213 | deflateEnd(&m_inflateStream); | - | ||||||||||||||||||
| 214 | } executed 6 times by 2 tests: end of blockExecuted by:
| 6 | ||||||||||||||||||
| 215 | - | |||||||||||||||||||
| 216 | bool 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
| 0-107 | ||||||||||||||||||
| 223 | return never executed: true;return 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
| 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 blockExecuted by:
| 107 | ||||||||||||||||||
| 249 | m_channel->state = QHttpNetworkConnectionChannel::IdleState; | - | ||||||||||||||||||
| 250 | return executed 107 times by 1 test: true;return true;Executed by:
executed 107 times by 1 test: return true;Executed by:
| 107 | ||||||||||||||||||
| 251 | } | - | ||||||||||||||||||
| 252 | - | |||||||||||||||||||
| 253 | void QSpdyProtocolHandler::_q_replyDestroyed(QObject* reply) | - | ||||||||||||||||||
| 254 | { | - | ||||||||||||||||||
| 255 | qint32 streamID = reply->property("SPDYStreamID").toInt(); | - | ||||||||||||||||||
| 256 | if (m_inFlightStreams.remove(streamID)
| 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 | - | |||||||||||||||||||
| 260 | void 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)
| 0-1373 | ||||||||||||||||||
| 268 | return; never executed: return; | 0 | ||||||||||||||||||
| 269 | } | - | ||||||||||||||||||
| 270 | - | |||||||||||||||||||
| 271 | if (bytesAvailable() < 8
| 0-1373 | ||||||||||||||||||
| 272 | return; never executed: return; | 0 | ||||||||||||||||||
| 273 | - | |||||||||||||||||||
| 274 | char frameHeadersRaw[8]; | - | ||||||||||||||||||
| 275 | if (!readNextChunk(8, frameHeadersRaw)
| 0-1373 | ||||||||||||||||||
| 276 | return; never executed: return; | 0 | ||||||||||||||||||
| 277 | - | |||||||||||||||||||
| 278 | const QByteArray frameHeaders(frameHeadersRaw, 8); | - | ||||||||||||||||||
| 279 | if (frameHeadersRaw[0] & 0x80
| 504-869 | ||||||||||||||||||
| 280 | handleControlFrame(frameHeaders); | - | ||||||||||||||||||
| 281 | } executed 869 times by 1 test: else {end of blockExecuted by:
| 869 | ||||||||||||||||||
| 282 | handleDataFrame(frameHeaders); | - | ||||||||||||||||||
| 283 | } executed 504 times by 1 test: end of blockExecuted by:
| 504 | ||||||||||||||||||
| 284 | - | |||||||||||||||||||
| 285 | - | |||||||||||||||||||
| 286 | if (m_socket->bytesAvailable() > 0
| 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 blockExecuted by:
| 1373 | ||||||||||||||||||
| 289 | - | |||||||||||||||||||
| 290 | void QSpdyProtocolHandler::_q_readyRead() | - | ||||||||||||||||||
| 291 | { | - | ||||||||||||||||||
| 292 | _q_receiveReply(); | - | ||||||||||||||||||
| 293 | } executed 1373 times by 1 test: end of blockExecuted by:
| 1373 | ||||||||||||||||||
| 294 | - | |||||||||||||||||||
| 295 | static qint16 twoBytesToInt(const char *bytes) | - | ||||||||||||||||||
| 296 | { | - | ||||||||||||||||||
| 297 | return executed 1738 times by 1 test: qFromBigEndian<qint16>(bytes);return qFromBigEndian<qint16>(bytes);Executed by:
executed 1738 times by 1 test: return qFromBigEndian<qint16>(bytes);Executed by:
| 1738 | ||||||||||||||||||
| 298 | } | - | ||||||||||||||||||
| 299 | - | |||||||||||||||||||
| 300 | static qint32 threeBytesToInt(const char *bytes) | - | ||||||||||||||||||
| 301 | { | - | ||||||||||||||||||
| 302 | return executed 1379 times by 1 test: qFromBigEndian<qint32>(bytes) >> 8;return qFromBigEndian<qint32>(bytes) >> 8;Executed by:
executed 1379 times by 1 test: return qFromBigEndian<qint32>(bytes) >> 8;Executed by:
| 1379 | ||||||||||||||||||
| 303 | } | - | ||||||||||||||||||
| 304 | - | |||||||||||||||||||
| 305 | static qint32 fourBytesToInt(const char *bytes) | - | ||||||||||||||||||
| 306 | { | - | ||||||||||||||||||
| 307 | return executed 3612 times by 1 test: qFromBigEndian<qint32>(bytes);return qFromBigEndian<qint32>(bytes);Executed by:
executed 3612 times by 1 test: return qFromBigEndian<qint32>(bytes);Executed by:
| 3612 | ||||||||||||||||||
| 308 | } | - | ||||||||||||||||||
| 309 | - | |||||||||||||||||||
| 310 | static 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 blockExecuted by:
| 121 | ||||||||||||||||||
| 315 | - | |||||||||||||||||||
| 316 | static void appendIntToFourBytes(char *output, qint32 number) | - | ||||||||||||||||||
| 317 | { | - | ||||||||||||||||||
| 318 | qToBigEndian<qint32>(number, output); | - | ||||||||||||||||||
| 319 | } executed 28 times by 1 test: end of blockExecuted by:
| 28 | ||||||||||||||||||
| 320 | - | |||||||||||||||||||
| 321 | static 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: ret;return ret;Executed by:
executed 2822 times by 1 test: return ret;Executed by:
| 2822 | ||||||||||||||||||
| 327 | } | - | ||||||||||||||||||
| 328 | - | |||||||||||||||||||
| 329 | static 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: ret;return ret;Executed by:
executed 755 times by 1 test: return ret;Executed by:
| 755 | ||||||||||||||||||
| 335 | } | - | ||||||||||||||||||
| 336 | - | |||||||||||||||||||
| 337 | static qint32 getStreamID(const char *bytes) | - | ||||||||||||||||||
| 338 | { | - | ||||||||||||||||||
| 339 | - | |||||||||||||||||||
| 340 | - | |||||||||||||||||||
| 341 | return executed 1367 times by 1 test: fourBytesToInt(bytes) & 0x3fffffff;return fourBytesToInt(bytes) & 0x3fffffff;Executed by:
executed 1367 times by 1 test: return fourBytesToInt(bytes) & 0x3fffffff;Executed by:
| 1367 | ||||||||||||||||||
| 342 | } | - | ||||||||||||||||||
| 343 | - | |||||||||||||||||||
| 344 | static 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: ret;return ret;Executed by:
executed 873 times by 1 test: return ret;Executed by:
| 873 | ||||||||||||||||||
| 353 | } | - | ||||||||||||||||||
| 354 | - | |||||||||||||||||||
| 355 | bool 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
| 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:
| 6 | ||||||||||||||||||
| 375 | } | - | ||||||||||||||||||
| 376 | switch (zlibRet) { | - | ||||||||||||||||||
| 377 | case never executed: (-5):case (-5):never executed: {case (-5): | 0 | ||||||||||||||||||
| 378 | if (m_inflateStream.avail_in == 0
| 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: 0:case 0:Executed by:
executed 107 times by 1 test: {case 0:Executed by:
| 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:
| 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: false;return false;never executed: return false; | 0 | ||||||||||||||||||
| 393 | } | - | ||||||||||||||||||
| 394 | } | - | ||||||||||||||||||
| 395 | } while (m_inflateStream.avail_in > 0
| 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: true;return true;Executed by:
executed 107 times by 1 test: return true;Executed by:
| 107 | ||||||||||||||||||
| 399 | } | - | ||||||||||||||||||
| 400 | - | |||||||||||||||||||
| 401 | QByteArray 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()
| 107-552 | ||||||||||||||||||
| 411 | QByteArray key = request.header().at(a).first; | - | ||||||||||||||||||
| 412 | if (key == "Connection"
| 0-445 | ||||||||||||||||||
| 413 | || key == "Proxy-Connection"
| 0-338 | ||||||||||||||||||
| 414 | continue; executed 214 times by 1 test: continue;Executed by:
| 214 | ||||||||||||||||||
| 415 | additionalHeaders.append(request.header().at(a)); | - | ||||||||||||||||||
| 416 | } executed 338 times by 1 test: end of blockExecuted by:
| 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()
| 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 blockExecuted by:
| 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: compressedHeader;return compressedHeader;Executed by:
executed 107 times by 1 test: return compressedHeader;Executed by:
| 107 | ||||||||||||||||||
| 461 | } | - | ||||||||||||||||||
| 462 | - | |||||||||||||||||||
| 463 | quint64 QSpdyProtocolHandler::bytesAvailable() const | - | ||||||||||||||||||
| 464 | { | - | ||||||||||||||||||
| 465 | ((!(m_socket)) ? qt_assert("m_socket",__FILE__,535) : qt_noop()); | - | ||||||||||||||||||
| 466 | return executed 1373 times by 1 test: m_spdyBuffer.byteAmount() + m_socket->bytesAvailable();return m_spdyBuffer.byteAmount() + m_socket->bytesAvailable();Executed by:
executed 1373 times by 1 test: return m_spdyBuffer.byteAmount() + m_socket->bytesAvailable();Executed by:
| 1373 | ||||||||||||||||||
| 467 | } | - | ||||||||||||||||||
| 468 | - | |||||||||||||||||||
| 469 | bool QSpdyProtocolHandler::readNextChunk(qint64 length, char *sink) | - | ||||||||||||||||||
| 470 | { | - | ||||||||||||||||||
| 471 | qint64 expectedReadBytes = length; | - | ||||||||||||||||||
| 472 | qint64 requiredBytesFromBuffer = 0; | - | ||||||||||||||||||
| 473 | - | |||||||||||||||||||
| 474 | if (m_waitingForCompleteStream
| 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
| 156 | ||||||||||||||||||
| 482 | return executed 156 times by 1 test: true;return true;Executed by:
executed 156 times by 1 test: return true;Executed by:
| 156 | ||||||||||||||||||
| 483 | } | - | ||||||||||||||||||
| 484 | expectedReadBytes -= requiredBytesFromBuffer; | - | ||||||||||||||||||
| 485 | } executed 156 times by 1 test: end of blockExecuted by:
| 156 | ||||||||||||||||||
| 486 | qint64 readBytes = m_socket->read(sink + requiredBytesFromBuffer, expectedReadBytes); | - | ||||||||||||||||||
| 487 | - | |||||||||||||||||||
| 488 | if (readBytes < expectedReadBytes
| 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: false;return false;Executed by:
executed 156 times by 1 test: return false;Executed by:
| 156 | ||||||||||||||||||
| 494 | } else { | - | ||||||||||||||||||
| 495 | return executed 2434 times by 1 test: true;return true;Executed by:
executed 2434 times by 1 test: return true;Executed by:
| 2434 | ||||||||||||||||||
| 496 | } | - | ||||||||||||||||||
| 497 | } | - | ||||||||||||||||||
| 498 | - | |||||||||||||||||||
| 499 | void 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: FrameType_CREDENTIAL:case 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:
executed 121 times by 1 test: default:Executed by:
| 121 | ||||||||||||||||||
| 515 | header[3] = type; | - | ||||||||||||||||||
| 516 | } executed 121 times by 1 test: end of blockExecuted by:
| 121 | ||||||||||||||||||
| 517 | - | |||||||||||||||||||
| 518 | - | |||||||||||||||||||
| 519 | header[4] = 0; | - | ||||||||||||||||||
| 520 | if (flags & ControlFrame_FLAG_FIN || length == 0
| 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 blockExecuted by:
| 92 | ||||||||||||||||||
| 529 | if (flags & ControlFrame_FLAG_UNIDIRECTIONAL
| 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 blockExecuted by:
| 121 | ||||||||||||||||||
| 543 | - | |||||||||||||||||||
| 544 | void 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()
| 15-92 | ||||||||||||||||||
| 553 | - | |||||||||||||||||||
| 554 | flags |= ControlFrame_FLAG_FIN; | - | ||||||||||||||||||
| 555 | reply->d_func()->state = QHttpNetworkReplyPrivate::SPDYHalfClosed; | - | ||||||||||||||||||
| 556 | } executed 92 times by 1 test: else {end of blockExecuted by:
| 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 blockExecuted by:
| 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: QHttpNetworkRequest::HighPriority:case 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: QHttpNetworkRequest::NormalPriority:case QHttpNetworkRequest::NormalPriority:Executed by:
executed 107 times by 1 test: case QHttpNetworkRequest::NormalPriority:Executed by:
| 107 | ||||||||||||||||||
| 583 | prioAndSlot[0] = 0x80u; | - | ||||||||||||||||||
| 584 | break; executed 107 times by 1 test: break;Executed by:
| 107 | ||||||||||||||||||
| 585 | case never executed: QHttpNetworkRequest::LowPriority:case 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
| 15-92 | ||||||||||||||||||
| 597 | uploadData(streamID); executed 15 times by 1 test: uploadData(streamID);Executed by:
| 15 | ||||||||||||||||||
| 598 | } executed 107 times by 1 test: end of blockExecuted by:
| 107 | ||||||||||||||||||
| 599 | - | |||||||||||||||||||
| 600 | void 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 | - | |||||||||||||||||||
| 608 | void 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 | - | |||||||||||||||||||
| 615 | bool QSpdyProtocolHandler::uploadData(qint32 streamID) | - | ||||||||||||||||||
| 616 | { | - | ||||||||||||||||||
| 617 | - | |||||||||||||||||||
| 618 | if (!m_inFlightStreams.contains(streamID)
| 0-1475 | ||||||||||||||||||
| 619 | sendRST_STREAM(streamID, RST_STREAM_INVALID_STREAM); | - | ||||||||||||||||||
| 620 | return never executed: false;return 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
| 0-1475 | ||||||||||||||||||
| 631 | QMessageLogger(__FILE__, 697, __PRETTY_FUNCTION__).warning("Trying to upload to closed stream"); | - | ||||||||||||||||||
| 632 | return never executed: false;return false;never executed: return false; | 0 | ||||||||||||||||||
| 633 | } | - | ||||||||||||||||||
| 634 | - | |||||||||||||||||||
| 635 | qint32 dataLeftInWindow = replyPrivate->windowSizeUpload | - | ||||||||||||||||||
| 636 | - replyPrivate->currentlyUploadedDataInWindow; | - | ||||||||||||||||||
| 637 | - | |||||||||||||||||||
| 638 | while (dataLeftInWindow > 0
| 1-1496 | ||||||||||||||||||
| 639 | - | |||||||||||||||||||
| 640 | - | |||||||||||||||||||
| 641 | qint64 currentReadSize = 0; | - | ||||||||||||||||||
| 642 | const char *readPointer = request.uploadByteDevice()->readPointer(dataLeftInWindow, | - | ||||||||||||||||||
| 643 | currentReadSize); | - | ||||||||||||||||||
| 644 | - | |||||||||||||||||||
| 645 | if (currentReadSize == -1
| 0-1495 | ||||||||||||||||||
| 646 | - | |||||||||||||||||||
| 647 | m_connection->d_func()->emitReplyError(m_socket, reply, | - | ||||||||||||||||||
| 648 | QNetworkReply::UnknownNetworkError); | - | ||||||||||||||||||
| 649 | return never executed: false;return false;never executed: return false; | 0 | ||||||||||||||||||
| 650 | } else if (readPointer == 0
| 0-755 | ||||||||||||||||||
| 651 | - | |||||||||||||||||||
| 652 | break; executed 755 times by 1 test: break;Executed by:
| 755 | ||||||||||||||||||
| 653 | } else { | - | ||||||||||||||||||
| 654 | DataFrameFlags flags = 0; | - | ||||||||||||||||||
| 655 | - | |||||||||||||||||||
| 656 | qint64 currentWriteSize = sendDataFrame(streamID, flags, currentReadSize, readPointer); | - | ||||||||||||||||||
| 657 | if (currentWriteSize == -1
| 0-740 | ||||||||||||||||||
| 658 | - | |||||||||||||||||||
| 659 | m_connection->d_func()->emitReplyError(m_socket, reply, | - | ||||||||||||||||||
| 660 | QNetworkReply::UnknownNetworkError); | - | ||||||||||||||||||
| 661 | return never executed: false;return 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 blockExecuted by:
| 740 | ||||||||||||||||||
| 672 | } | - | ||||||||||||||||||
| 673 | } | - | ||||||||||||||||||
| 674 | if (replyPrivate->totallyUploadedData == request.contentLength()
| 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()
| 0-15 | ||||||||||||||||||
| 681 | reply->request().uploadByteDevice()->disconnect(this); executed 15 times by 1 test: reply->request().uploadByteDevice()->disconnect(this);Executed by:
| 15 | ||||||||||||||||||
| 682 | - | |||||||||||||||||||
| 683 | - | |||||||||||||||||||
| 684 | - | |||||||||||||||||||
| 685 | } executed 15 times by 1 test: end of blockExecuted by:
| 15 | ||||||||||||||||||
| 686 | return executed 1475 times by 1 test: true;return true;Executed by:
executed 1475 times by 1 test: return true;Executed by:
| 1475 | ||||||||||||||||||
| 687 | } | - | ||||||||||||||||||
| 688 | - | |||||||||||||||||||
| 689 | void 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 blockExecuted by:
| 740 | ||||||||||||||||||
| 697 | - | |||||||||||||||||||
| 698 | void 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 blockExecuted by:
| 14 | ||||||||||||||||||
| 706 | - | |||||||||||||||||||
| 707 | qint64 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
| 15-740 | ||||||||||||||||||
| 721 | qint64 ret = m_socket->write(data, length); | - | ||||||||||||||||||
| 722 | return executed 740 times by 1 test: ret;return ret;Executed by:
executed 740 times by 1 test: return ret;Executed by:
| 740 | ||||||||||||||||||
| 723 | } else { | - | ||||||||||||||||||
| 724 | return executed 15 times by 1 test: 0;return 0;Executed by:
executed 15 times by 1 test: return 0;Executed by:
| 15 | ||||||||||||||||||
| 725 | } | - | ||||||||||||||||||
| 726 | } | - | ||||||||||||||||||
| 727 | - | |||||||||||||||||||
| 728 | void 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())
| 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 blockExecuted by:
| 869 | ||||||||||||||||||
| 751 | - | |||||||||||||||||||
| 752 | switch (type) { | - | ||||||||||||||||||
| 753 | case never executed: FrameType_SYN_STREAM:case 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: FrameType_SYN_REPLY:case FrameType_SYN_REPLY:Executed by:
executed 107 times by 1 test: {case FrameType_SYN_REPLY:Executed by:
| 107 | ||||||||||||||||||
| 758 | handleSYN_REPLY(flags, length, frameData); | - | ||||||||||||||||||
| 759 | break; executed 107 times by 1 test: break;Executed by:
| 107 | ||||||||||||||||||
| 760 | } | - | ||||||||||||||||||
| 761 | case never executed: FrameType_RST_STREAM:case 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: FrameType_SETTINGS:case FrameType_SETTINGS:Executed by:
executed 6 times by 1 test: {case FrameType_SETTINGS:Executed by:
| 6 | ||||||||||||||||||
| 766 | handleSETTINGS(flags, length, frameData); | - | ||||||||||||||||||
| 767 | break; executed 6 times by 1 test: break;Executed by:
| 6 | ||||||||||||||||||
| 768 | } | - | ||||||||||||||||||
| 769 | case never executed: FrameType_PING:case FrameType_PING:never executed: {case FrameType_PING: | 0 | ||||||||||||||||||
| 770 | handlePING(flags, length, frameData); | - | ||||||||||||||||||
| 771 | break; never executed: break; | 0 | ||||||||||||||||||
| 772 | } | - | ||||||||||||||||||
| 773 | case never executed: FrameType_GOAWAY:case FrameType_GOAWAY:never executed: {case FrameType_GOAWAY: | 0 | ||||||||||||||||||
| 774 | handleGOAWAY(flags, length, frameData); | - | ||||||||||||||||||
| 775 | break; never executed: break; | 0 | ||||||||||||||||||
| 776 | } | - | ||||||||||||||||||
| 777 | case never executed: FrameType_HEADERS:case 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: FrameType_WINDOW_UPDATE:case FrameType_WINDOW_UPDATE:Executed by:
executed 756 times by 1 test: {case FrameType_WINDOW_UPDATE:Executed by:
| 756 | ||||||||||||||||||
| 782 | handleWINDOW_UPDATE(flags, length, frameData); | - | ||||||||||||||||||
| 783 | break; executed 756 times by 1 test: break;Executed by:
| 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 | - | |||||||||||||||||||
| 790 | void 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 | - | |||||||||||||||||||
| 801 | void QSpdyProtocolHandler::handleSYN_REPLY(char flags, quint32 , const QByteArray &frameData) | - | ||||||||||||||||||
| 802 | { | - | ||||||||||||||||||
| 803 | parseHttpHeaders(flags, frameData); | - | ||||||||||||||||||
| 804 | } executed 107 times by 1 test: end of blockExecuted by:
| 107 | ||||||||||||||||||
| 805 | - | |||||||||||||||||||
| 806 | void 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()
| 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
| 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)
| 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()
| 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
| 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()
| 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()
| 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"
| 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: else if (name == ":version"end of blockExecuted by:
| 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: else if (name == "content-length"end of blockExecuted by:
| 22-449 | ||||||||||||||||||
| 870 | httpReply->setContentLength(value.toLongLong()); | - | ||||||||||||||||||
| 871 | } executed 22 times by 1 test: else {end of blockExecuted by:
| 22 | ||||||||||||||||||
| 872 | value.replace('\0', name == "set-cookie" ? "\n" : ", "); | - | ||||||||||||||||||
| 873 | httpReply->setHeaderField(name, value); | - | ||||||||||||||||||
| 874 | } executed 449 times by 1 test: end of blockExecuted by:
| 449 | ||||||||||||||||||
| 875 | } | - | ||||||||||||||||||
| 876 | httpReply->headerChanged(); | - | ||||||||||||||||||
| 877 | - | |||||||||||||||||||
| 878 | if (flag_fin
| 0-107 | ||||||||||||||||||
| 879 | if (httpReply->d_func()->state != QHttpNetworkReplyPrivate::SPDYHalfClosed
| 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 blockExecuted by:
| 107 | ||||||||||||||||||
| 884 | - | |||||||||||||||||||
| 885 | void 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: RST_STREAM_PROTOCOL_ERROR:case 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: RST_STREAM_INVALID_STREAM:case 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: RST_STREAM_REFUSED_STREAM:case 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: RST_STREAM_UNSUPPORTED_VERSION:case 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: RST_STREAM_CANCEL:case 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: RST_STREAM_INTERNAL_ERROR:case 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: RST_STREAM_FLOW_CONTROL_ERROR:case 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: RST_STREAM_STREAM_IN_USE:case 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: RST_STREAM_STREAM_ALREADY_CLOSED:case 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: RST_STREAM_INVALID_CREDENTIALS:case 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: RST_STREAM_FRAME_TOO_LARGE:case 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
| 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 | - | |||||||||||||||||||
| 954 | void 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
| 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
| 6 | ||||||||||||||||||
| 967 | SETTINGS_ID_Flag idFlag = static_cast<SETTINGS_ID_Flag>(frameData[frameDataIndex]); | - | ||||||||||||||||||
| 968 | if (idFlag & FLAG_SETTINGS_PERSIST_VALUE
| 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: SETTINGS_UPLOAD_BANDWIDTH:case SETTINGS_UPLOAD_BANDWIDTH:never executed: {case SETTINGS_UPLOAD_BANDWIDTH: | 0 | ||||||||||||||||||
| 978 | - | |||||||||||||||||||
| 979 | break; never executed: break; | 0 | ||||||||||||||||||
| 980 | } | - | ||||||||||||||||||
| 981 | case never executed: SETTINGS_DOWNLOAD_BANDWIDTH:case SETTINGS_DOWNLOAD_BANDWIDTH:never executed: {case SETTINGS_DOWNLOAD_BANDWIDTH: | 0 | ||||||||||||||||||
| 982 | - | |||||||||||||||||||
| 983 | break; never executed: break; | 0 | ||||||||||||||||||
| 984 | } | - | ||||||||||||||||||
| 985 | case never executed: SETTINGS_ROUND_TRIP_TIME:case 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: SETTINGS_MAX_CONCURRENT_STREAMS:case SETTINGS_MAX_CONCURRENT_STREAMS:Executed by:
executed 6 times by 1 test: {case SETTINGS_MAX_CONCURRENT_STREAMS:Executed by:
| 6 | ||||||||||||||||||
| 990 | m_maxConcurrentStreams = value; | - | ||||||||||||||||||
| 991 | break; executed 6 times by 1 test: break;Executed by:
| 6 | ||||||||||||||||||
| 992 | } | - | ||||||||||||||||||
| 993 | case never executed: SETTINGS_CURRENT_CWND:case SETTINGS_CURRENT_CWND:never executed: {case SETTINGS_CURRENT_CWND: | 0 | ||||||||||||||||||
| 994 | - | |||||||||||||||||||
| 995 | break; never executed: break; | 0 | ||||||||||||||||||
| 996 | } | - | ||||||||||||||||||
| 997 | case never executed: SETTINGS_DOWNLOAD_RETRANS_RATE:case SETTINGS_DOWNLOAD_RETRANS_RATE:never executed: {case SETTINGS_DOWNLOAD_RETRANS_RATE: | 0 | ||||||||||||||||||
| 998 | - | |||||||||||||||||||
| 999 | break; never executed: break; | 0 | ||||||||||||||||||
| 1000 | } | - | ||||||||||||||||||
| 1001 | case never executed: SETTINGS_INITIAL_WINDOW_SIZE:case 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: SETTINGS_CLIENT_CERTIFICATE_VECTOR_SIZE:case 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 blockExecuted by:
| 6 | ||||||||||||||||||
| 1014 | - | |||||||||||||||||||
| 1015 | void 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 ((
| 0 | ||||||||||||||||||
| 1025 | sendPING(pingID); never executed: sendPING(pingID); | 0 | ||||||||||||||||||
| 1026 | } never executed: end of block | 0 | ||||||||||||||||||
| 1027 | - | |||||||||||||||||||
| 1028 | void 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: GOAWAY_OK:case GOAWAY_OK:never executed: {case GOAWAY_OK: | 0 | ||||||||||||||||||
| 1037 | errorCode = QNetworkReply::NoError; | - | ||||||||||||||||||
| 1038 | break; never executed: break; | 0 | ||||||||||||||||||
| 1039 | } | - | ||||||||||||||||||
| 1040 | case never executed: GOAWAY_PROTOCOL_ERROR:case 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: GOAWAY_INTERNAL_ERROR:case 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
| 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 | - | |||||||||||||||||||
| 1066 | void QSpdyProtocolHandler::handleHEADERS(char flags, quint32 , | - | ||||||||||||||||||
| 1067 | const QByteArray &frameData) | - | ||||||||||||||||||
| 1068 | { | - | ||||||||||||||||||
| 1069 | parseHttpHeaders(flags, frameData); | - | ||||||||||||||||||
| 1070 | } never executed: end of block | 0 | ||||||||||||||||||
| 1071 | - | |||||||||||||||||||
| 1072 | void 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()
| 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
| 0-720 | ||||||||||||||||||
| 1091 | return; executed 36 times by 1 test: return;Executed by:
| 36 | ||||||||||||||||||
| 1092 | - | |||||||||||||||||||
| 1093 | replyPrivate->currentlyUploadedDataInWindow = replyPrivate->windowSizeUpload - deltaWindowSize; | - | ||||||||||||||||||
| 1094 | uploadData(streamID); | - | ||||||||||||||||||
| 1095 | } executed 720 times by 1 test: end of blockExecuted by:
| 720 | ||||||||||||||||||
| 1096 | - | |||||||||||||||||||
| 1097 | - | |||||||||||||||||||
| 1098 | void 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()
| 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())
| 156-348 | ||||||||||||||||||
| 1118 | - | |||||||||||||||||||
| 1119 | m_spdyBuffer.prepend(frameHeaders); | - | ||||||||||||||||||
| 1120 | return; executed 156 times by 1 test: return;Executed by:
| 156 | ||||||||||||||||||
| 1121 | } else { | - | ||||||||||||||||||
| 1122 | m_spdyBuffer.clear(); | - | ||||||||||||||||||
| 1123 | m_waitingForCompleteStream = false; | - | ||||||||||||||||||
| 1124 | } executed 348 times by 1 test: end of blockExecuted by:
| 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
| 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
| 0-348 | ||||||||||||||||||
| 1143 | && dataLeftInWindow < replyPrivate->windowSizeDownload / 2
| 14-334 | ||||||||||||||||||
| 1144 | - | |||||||||||||||||||
| 1145 | - | |||||||||||||||||||
| 1146 | - | |||||||||||||||||||
| 1147 | - | |||||||||||||||||||
| 1148 | if (replyPrivate->windowSizeDownload >= m_socket->readBufferSize()
| 0-14 | ||||||||||||||||||
| 1149 | replyPrivate->windowSizeDownload = m_socket->readBufferSize(); | - | ||||||||||||||||||
| 1150 | } executed 14 times by 1 test: else {end of blockExecuted by:
| 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 blockExecuted by:
| 14 | ||||||||||||||||||
| 1163 | - | |||||||||||||||||||
| 1164 | httpReply->d_func()->compressedData.append(data); | - | ||||||||||||||||||
| 1165 | - | |||||||||||||||||||
| 1166 | - | |||||||||||||||||||
| 1167 | replyPrivate->totalProgress += length; | - | ||||||||||||||||||
| 1168 | - | |||||||||||||||||||
| 1169 | if (httpRequest.d->autoDecompress
| 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: else {end of block | 0 | ||||||||||||||||||
| 1177 | replyPrivate->responseData.append(data); | - | ||||||||||||||||||
| 1178 | } executed 348 times by 1 test: end of blockExecuted by:
| 348 | ||||||||||||||||||
| 1179 | - | |||||||||||||||||||
| 1180 | if (replyPrivate->shouldEmitSignals()
| 0-348 | ||||||||||||||||||
| 1181 | httpReply->readyRead(); | - | ||||||||||||||||||
| 1182 | httpReply->dataReadProgress(replyPrivate->totalProgress, replyPrivate->bodyLength); | - | ||||||||||||||||||
| 1183 | } executed 348 times by 1 test: end of blockExecuted by:
| 348 | ||||||||||||||||||
| 1184 | - | |||||||||||||||||||
| 1185 | if (flag_compress
| 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
| 107-241 | ||||||||||||||||||
| 1190 | if (httpReply->d_func()->state != QHttpNetworkReplyPrivate::SPDYHalfClosed
| 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 blockExecuted by:
| 107 | ||||||||||||||||||
| 1194 | } executed 348 times by 1 test: end of blockExecuted by:
| 348 | ||||||||||||||||||
| 1195 | - | |||||||||||||||||||
| 1196 | void QSpdyProtocolHandler::replyFinished(QHttpNetworkReply *httpReply, qint32 streamID) | - | ||||||||||||||||||
| 1197 | { | - | ||||||||||||||||||
| 1198 | httpReply->d_func()->state = QHttpNetworkReplyPrivate::SPDYClosed; | - | ||||||||||||||||||
| 1199 | httpReply->disconnect(this); | - | ||||||||||||||||||
| 1200 | if (httpReply->request().uploadByteDevice()
| 15-92 | ||||||||||||||||||
| 1201 | httpReply->request().uploadByteDevice()->disconnect(this); executed 15 times by 1 test: httpReply->request().uploadByteDevice()->disconnect(this);Executed by:
| 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 blockExecuted by:
| 107 | ||||||||||||||||||
| 1207 | - | |||||||||||||||||||
| 1208 | void 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()
| 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 | - | |||||||||||||||||||
| 1222 | qint32 QSpdyProtocolHandler::generateNextStreamID() | - | ||||||||||||||||||
| 1223 | { | - | ||||||||||||||||||
| 1224 | - | |||||||||||||||||||
| 1225 | m_nextStreamID += 2; | - | ||||||||||||||||||
| 1226 | return executed 107 times by 1 test: m_nextStreamID;return m_nextStreamID;Executed by:
executed 107 times by 1 test: return m_nextStreamID;Executed by:
| 107 | ||||||||||||||||||
| 1227 | } | - | ||||||||||||||||||
| 1228 | - | |||||||||||||||||||
| 1229 | - | |||||||||||||||||||
| Switch to Source code | Preprocessed file |