mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
Handle gzip decompression failure (encountered during jquery test suite work) without panic.
This commit is contained in:
parent
7ee605db11
commit
786e24bde0
1 changed files with 10 additions and 2 deletions
|
@ -331,8 +331,16 @@ reason: \"certificate verify failed\" }]";
|
|||
match encoding_str {
|
||||
Some(encoding) => {
|
||||
if encoding == "gzip" {
|
||||
let mut response_decoding = GzDecoder::new(response).unwrap();
|
||||
send_data(&mut response_decoding, start_chan, metadata, classifier);
|
||||
let result = GzDecoder::new(response);
|
||||
match result {
|
||||
Ok(mut response_decoding) => {
|
||||
send_data(&mut response_decoding, start_chan, metadata, classifier);
|
||||
}
|
||||
Err(err) => {
|
||||
send_error(metadata.final_url, err.to_string(), start_chan);
|
||||
return;
|
||||
}
|
||||
}
|
||||
} else if encoding == "deflate" {
|
||||
let mut response_decoding = DeflateDecoder::new(response);
|
||||
send_data(&mut response_decoding, start_chan, metadata, classifier);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue