This commit is contained in:
coderfengyun 2014-01-14 22:29:41 +08:00
parent 374b7084a7
commit 62dab4fa3d
3 changed files with 285 additions and 280 deletions

View File

@ -2,6 +2,7 @@ package org.bench4q.master.scriptrecord.httpcapture.generator;
import java.io.ByteArrayOutputStream;
import java.io.InputStream;
import org.apache.log4j.Logger;
import org.bench4q.master.exception.ExceptionLog;

View File

@ -65,7 +65,7 @@ public class ResponseHeader {
}
boolean isHtmlContent() {
return getContentType().toLowerCase().compareTo("text/html") == 0;
return getContentType().toLowerCase().contains("text/html");
}
boolean isGoodRequest() {

View File

@ -40,7 +40,8 @@ public class ResponseParser {
public ResponseParser(byte[] response) {
this.setResponse(response);
this.setResponseHeader(parseResponseHeader());
if (this.getResponseHeader().isValidResponseHeader()) {
if (this.getResponseHeader().isValidResponseHeader()
&& this.getResponseHeader().isHtmlContent()) {
this.parseResponseBody();
}
}
@ -150,6 +151,9 @@ public class ResponseParser {
this.getResponse().length
- this.getResponseHeader().getContentLength(),
this.getResponseHeader().getContentLength()));
if (contentBodyAfterDecoded == null) {
return;
}
Charset charset = null;
try {
charset = Charset.forName(this.getResponseHeader().getCharset());