* Improved the detection of chunked encoding
* Fixed broken chunk length parser
This commit is contained in:
parent
01b0beab50
commit
44498e067f
@ -91,7 +91,16 @@ public class DefaultHttpMessage implements HttpMessage {
|
||||
|
||||
public boolean isChunked() {
|
||||
List<String> chunked = headers.get(HttpHeaders.Names.TRANSFER_ENCODING);
|
||||
return chunked != null && chunked.size() > 0 && chunked.get(0).equalsIgnoreCase(HttpHeaders.Values.CHUNKED);
|
||||
if (chunked == null || chunked.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
for (String v: chunked) {
|
||||
if (v.equalsIgnoreCase(HttpHeaders.Values.CHUNKED)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public void clearHeaders() {
|
||||
|
@ -224,7 +224,7 @@ public abstract class HttpMessageDecoder extends ReplayingDecoder<HttpMessageDec
|
||||
private int getChunkSize(String hex) {
|
||||
int delimPos = hex.indexOf(';');
|
||||
if (delimPos >= 0) {
|
||||
hex = hex.substring(delimPos).trim();
|
||||
hex = hex.substring(0, delimPos).trim();
|
||||
}
|
||||
return Integer.parseInt(hex, 16);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user