(HttpHeader header, byte[] rawBody)
| 316 | } |
| 317 | |
| 318 | private byte[] getCookedBody(HttpHeader header, byte[] rawBody) throws Exception { |
| 319 | byte[] cookedBody = rawBody; |
| 320 | |
| 321 | { |
| 322 | |
| 323 | String headerName = "Transfer-Encoding"; |
| 324 | Optional<String> enc = header.getValue(headerName); |
| 325 | |
| 326 | if (enc.isPresent() && enc.get().equalsIgnoreCase("chunked")) { |
| 327 | |
| 328 | header.removeAll(headerName); |
| 329 | cookedBody = getChankedHttpBodyFussy(cookedBody); |
| 330 | if (cookedBody == null) |
| 331 | return null; |
| 332 | } |
| 333 | } |
| 334 | |
| 335 | { |
| 336 | |
| 337 | String headerName = "Content-Encoding"; |
| 338 | Optional<String> enc = header.getValue(headerName); |
| 339 | |
| 340 | if (enc.isPresent() && enc.get().equalsIgnoreCase("gzip")) { |
| 341 | |
| 342 | cookedBody = gunzip(cookedBody); |
| 343 | header.removeAll(headerName); |
| 344 | if (cookedBody == null) |
| 345 | return null; |
| 346 | } else if (enc.isPresent() && enc.get().equalsIgnoreCase("zstd")) { |
| 347 | |
| 348 | cookedBody = zstd_decompress(cookedBody); |
| 349 | header.removeAll(headerName); |
| 350 | if (cookedBody == null) |
| 351 | return null; |
| 352 | } else if (enc.isPresent() && enc.get().equalsIgnoreCase("br")) { |
| 353 | |
| 354 | cookedBody = br_decompress(cookedBody); |
| 355 | header.removeAll(headerName); |
| 356 | if (cookedBody == null) |
| 357 | return null; |
| 358 | } |
| 359 | } |
| 360 | |
| 361 | if (!this.flag_dont_touch_content_length) { |
| 362 | |
| 363 | header.removeAll("Content-Length"); |
| 364 | } |
| 365 | return cookedBody; |
| 366 | } |
| 367 | |
| 368 | public String getURL(int port, boolean use_ssl) { |
| 369 | if (version.equals("HTTP/2") || version.equals("HTTP/3")) { |
no test coverage detected