Commit 2a542a8
authored
Fix size 65536 HybiFrame (#24)
* fix size 65536 HybiFrame + nitpicks
off-by-1: previously, hybiframes with a 65536 bytes payload
would generate a 16 bit size header signaling 0 bytes (pack("n", 65536) => "\x00\x00"),
instead of using a 64bit size header.
nit: composer.json php version had not been updated since 8.0.2
nit: instead of is_int && in_array, we can use in_array's strict mode.
nit: $this->offset_mask and $this->offset_payload were
initialized-to-null in constructor and encode, then written internally in getPayloadOffset,
then written in encode() again.
nit: use pack('J') instead of manually constructing big_endian_u64 (undocumented funfact, J is not available in 32bit php: php/doc-en#4644 ,
that may be why the original code did not use J)
nit: use random_bytes instead of openssl_random_pseudo_bytes(),
the original code was written for php5 where random_bytes did not exist.
nit: getInitialLength() was calculating the result twice internally.
* StyleCI
* PR feedback
https://github.com/chrome-php/wrench/pull/24/files#r2070000317
and
https://github.com/chrome-php/wrench/pull/24/files#r20699992231 parent 10cd90c commit 2a542a8
1 file changed
Lines changed: 19 additions & 20 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
69 | 69 | | |
70 | 70 | | |
71 | 71 | | |
72 | | - | |
| 72 | + | |
73 | 73 | | |
74 | 74 | | |
75 | 75 | | |
76 | 76 | | |
77 | 77 | | |
78 | 78 | | |
79 | 79 | | |
80 | | - | |
81 | | - | |
82 | 80 | | |
83 | 81 | | |
84 | 82 | | |
| 83 | + | |
85 | 84 | | |
86 | 85 | | |
87 | | - | |
| 86 | + | |
88 | 87 | | |
89 | 88 | | |
90 | | - | |
| 89 | + | |
91 | 90 | | |
92 | 91 | | |
93 | 92 | | |
94 | | - | |
| 93 | + | |
| 94 | + | |
95 | 95 | | |
96 | | - | |
| 96 | + | |
97 | 97 | | |
98 | | - | |
| 98 | + | |
| 99 | + | |
99 | 100 | | |
100 | 101 | | |
101 | 102 | | |
102 | 103 | | |
103 | | - | |
| 104 | + | |
| 105 | + | |
104 | 106 | | |
105 | | - | |
106 | | - | |
107 | | - | |
108 | | - | |
| 107 | + | |
| 108 | + | |
109 | 109 | | |
| 110 | + | |
| 111 | + | |
110 | 112 | | |
111 | 113 | | |
112 | 114 | | |
113 | 115 | | |
114 | 116 | | |
| 117 | + | |
115 | 118 | | |
| 119 | + | |
116 | 120 | | |
117 | 121 | | |
| 122 | + | |
118 | 123 | | |
119 | 124 | | |
120 | 125 | | |
121 | | - | |
122 | | - | |
123 | | - | |
124 | 126 | | |
125 | 127 | | |
126 | 128 | | |
| |||
196 | 198 | | |
197 | 199 | | |
198 | 200 | | |
199 | | - | |
200 | 201 | | |
201 | 202 | | |
202 | 203 | | |
| |||
233 | 234 | | |
234 | 235 | | |
235 | 236 | | |
236 | | - | |
237 | 237 | | |
238 | 238 | | |
239 | 239 | | |
| |||
258 | 258 | | |
259 | 259 | | |
260 | 260 | | |
261 | | - | |
262 | 261 | | |
263 | 262 | | |
264 | 263 | | |
| |||
294 | 293 | | |
295 | 294 | | |
296 | 295 | | |
297 | | - | |
| 296 | + | |
298 | 297 | | |
299 | 298 | | |
300 | 299 | | |
| |||
0 commit comments