remove the bug about acceptLanguage

This commit is contained in:
coderfengyun 2014-01-16 10:07:10 +08:00
parent 93ba61b78e
commit 793e795ebe
5 changed files with 13 additions and 238 deletions

View File

@ -1,230 +1 @@
<html>
<head>
<meta charset="utf-8">
<title>Bench4Q</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description"
content="Bench4Q, a new method for QOS benchmarking.">
<meta name="author" content="Kai Ren">
<!-- The styles -->
<link id="bs-css" href="css/bootstrap-cerulean.css" rel="stylesheet">
<link href="css/bootstrap-responsive.css" rel="stylesheet">
<link href="css/charisma-app.css" rel="stylesheet">
<link href="css/jquery-ui-1.8.21.custom.css" rel="stylesheet">
<link href='css/colorbox.css' rel='stylesheet'>
<link href='css/noty_theme_default.css' rel='stylesheet'>
<link href='css/opa-icons.css' rel='stylesheet'>
<link rel="shortcut icon" href="img/bench4q.png">
<link href="bench4q-css/bench4q.css" rel="stylesheet">
</head>
<body>
<div class="navbar">
<div class="navbar-inner" id="nav-primary">
<div class="container-fluid">
<a class="btn btn-navbar" data-toggle="collapse"
data-target=".top-nav.nav-collapse,.sidebar-nav.nav-collapse">
<span class="icon-bar"></span> <span class="icon-bar"></span> <span
class="icon-bar"></span>
</a> <a class="brand" href="index.jsp"> <img alt="Charisma Logo"
src="img/bench4q.png" /> <span>Bench4Q</span></a>
<!-- theme selector starts -->
<div class="btn-group pull-right theme-container">
<a class="btn dropdown-toggle" data-toggle="dropdown" href="#">
<i class="icon-tint"></i><span class="hidden-phone"> 更换主题 / 皮肤</span> <span class="caret"></span>
</a>
<ul class="dropdown-menu" id="themes">
<li><a data-value="classic" href="#"><i
class="icon-blank"></i> 经典样式</a></li>
<li><a data-value="cerulean" href="#"><i
class="icon-blank"></i> 天蓝色</a></li>
<li><a data-value="cyborg" href="#"><i class="icon-blank"></i>
电子</a></li>
<li><a data-value="redy" href="#"><i class="icon-blank"></i>
Redy</a></li>
<li><a data-value="journal" href="#"><i
class="icon-blank"></i> 日志</a></li>
<li><a data-value="simplex" href="#"><i
class="icon-blank"></i> Simplex</a></li>
<li><a data-value="slate" href="#"><i class="icon-blank"></i>
Slate</a></li>
<li><a data-value="spacelab" href="#"><i
class="icon-blank"></i> Spacelab</a></li>
<li><a data-value="united" href="#"><i class="icon-blank"></i>
United</a></li>
</ul>
</div>
<!-- theme selector ends -->
<!-- user dropdown starts -->
<div class="btn-group pull-right">
<a class="btn dropdown-toggle" data-toggle="dropdown" href="#">
<i class="icon-user"></i><span class="hidden-phone"> admin</span>
<span class="caret"></span>
</a>
<ul class="dropdown-menu">
<li><a href="#">形象</a></li>
<li class="divider"></li>
<li><a href="login.html">注销</a></li>
</ul>
</div>
<!-- user dropdown ends -->
<div class="top-nav nav-collapse">
<ul class="nav">
<li><a href="#">访问站点</a></li>
<li>
<form class="navbar-search pull-left">
<input placeholder="Search" class="search-query sp an2"
name="query" type="text">
</form>
</li>
</ul>
</div>
<!--/.nav-collapse -->
</div>
</div>
</div>
<!-- topbar ends -->
<div class="container-fluid">
<div class="row-fluid">
<div id="content" class="span10 center ">
<!-- content starts -->
<div class="sortable row-fluid ui-sortable">
<a data-rel="tooltip" class="well span3 top-block" href="test.jsp"
data-original-title=新建测试计划> <span
class="icon32 icon-red icon-plus"></span>
<div>
新建测试计划
</div>
</a> <a data-rel="tooltip" class="well span3 top-block"
href="script.jsp"
data-original-title=???scriptmanagerment???>
<span class="icon32 icon-color icon-edit"></span>
<div>
脚本管理
</div>
</a> <a data-rel="tooltip" class="well span3 top-block"
href="testPlanTask.jsp"
data-original-title=测试任务> <span
class="icon32 icon-green icon-envelope-closed"></span>
<div>
测试任务
</div>
</a> </a> <a data-rel="tooltip" class="well span3 top-block"
href="testplans.jsp"
data-original-title=测试历史记录> <span
class="icon32 icon-blue icon-star-on"></span>
<div>
测试历史记录
</div>
</a>
</div>
<div class="row-fluid sortable">
<div class="box span12">
<div class="box-header well" data-original-title>
<h2>Scripts</h2>
<div class="box-icon">
<a href="#" class="btn btn-setting btn-round"><i
class="icon-cog"></i></a> <a href="#"
class="btn btn-minimize btn-round"><i
class="icon-chevron-up"></i></a> <a href="#"
class="btn btn-close btn-round"><i class="icon-remove"></i></a>
</div>
</div>
<div class="box-content">
<table class="table table-condensed" id="scriptTab">
<thead>
<tr>
<th>脚本名称</th>
<th>ID</th>
<th>创建日期</th>
<th>操作</th>
</tr>
</thead>
</table>
</div>
</div>
<!-- content ends -->
</div>
<div class="row-fluid sortable">
<div class="box span12">
<div class="box-header well" data-original-title>
<h2>Latest Tests</h2>
<div class="box-icon">
<a href="#" class="btn btn-setting btn-round"><i
class="icon-cog"></i></a> <a href="#"
class="btn btn-minimize btn-round"><i
class="icon-chevron-up"></i></a> <a href="#"
class="btn btn-close btn-round"><i class="icon-remove"></i></a>
</div>
</div>
<div class="box-content">
<table class="table table-condensed " id="testPlanTab">
<thead>
<tr>
<th>测试计划运行ID</th>
<th>ID</th>
<th>创建日期</th>
<th>status</th>
<th>操作</th>
</tr>
</thead>
</table>
</div>
</div>
<!-- content ends -->
</div>
<!--/#content.span10-->
</div>
<!--/fluid-row-->
</div>
<hr>
<footer>
<p class="pull-left">&copy; Bench4Q 2013</p>
<p class="pull-right">
技术支持
: Bench4Q
</p>
</footer>
</div>
<!-- external javascript ========== -->
<script src="js/jquery-1.8.2.min.js"></script>
<script src="js/jquery-ui-1.8.21.custom.min.js"></script>
<script src='js/jquery.dataTables.min.js'></script>
<script src="js/jquery.i18n.properties-1.0.9.js"></script>
<script src="js/bootstrap-dropdown.js"></script>
<script src="js/jquery.cookie.js"></script>
<script src="js/theme.js"></script>
<script src="script/base.js"></script>
<script src="script/scriptTable.js"></script>
<script src="script/bench4q.table.js"></script>
<script src="script/loadTestPlans.js"></script>
<script src="script/home.js"></script>
</body>
</html
<html><body style="background-color:transparent"></body></html

View File

@ -127,18 +127,16 @@ public class HttpRequestHeader {
} else if (Token.equalsIgnoreCase("ACCEPT:")) {
// line=<Accept: <Type>/<Form>
// examp: Accept image/jpeg
accept += " " + getRemainder(tz);
accept += getRemainder(tz);
} else if (Token
.equalsIgnoreCase(HeaderValue.REQUEST_ACCEPT_LANGUAGE + ":")) {
acceptLanguage += " " + getRemainder(tz);
acceptLanguage += getRemainder(tz);
} else if (Token.equalsIgnoreCase("REFERER:")) {
// line =<Referer: <URL>>
referer = getRemainder(tz);
} else if (Token.equalsIgnoreCase("PRAGMA:")) {
// Pragma: <no-cache>
Token = getToken(tz);
if (Token.equalsIgnoreCase("NO-CACHE"))
pragmaNoCache = true;
else
@ -227,8 +225,8 @@ public class HttpRequestHeader {
else
Request += "Accept: */" + "* \r\n";
if (0 < acceptLanguage.length()) {
Request += HeaderValue.REQUEST_ACCEPT_LANGUAGE + acceptLanguage
+ CR;
Request += HeaderValue.REQUEST_ACCEPT_LANGUAGE + ": "
+ acceptLanguage + CR;
}
if (0 < contentType.length())
Request += "Content-Type: " + contentType + CR;

View File

@ -45,6 +45,7 @@ public class RequestHandler implements Runnable {
log.error("truncated request from browser: "
+ ExceptionLog.getStackTrace(e).toString()
+ this.header.url);
System.out.println(this.header.url);
throw new Utils.SilentException();
}
if (!this.header.url.startsWith("http"))

View File

@ -339,7 +339,7 @@ public abstract class AbstractCodeGenerator implements IScriptGenerator,
if (responseHeader.isValidResponseHeader()) {
if (responseHeader.isGoodRequest()
&& responseHeader.isHtmlContentType()
&& responseParser.getResponseBody().contains("<html")) {
&& hasHtmlTag(responseParser)) {
dealWithHtmlResponse(header, responseParser);
doParseRequest(header, requestBody);
System.out.println("enter doParseHtml");
@ -359,6 +359,11 @@ public abstract class AbstractCodeGenerator implements IScriptGenerator,
doParseRequest(header, requestBody);
}
private boolean hasHtmlTag(ResponseParser responseParser) {
return responseParser.getResponseBody() == null ? false
: responseParser.getResponseBody().contains("<html");
}
private void dealWithHtmlResponse(HttpRequestHeader header,
ResponseParser responseParser) throws UserException {
if (!isFirstHtmlResponse()) {

View File

@ -16,7 +16,7 @@ import org.bench4q.share.models.master.ScriptModel;
import org.junit.Test;
public class RecordScriptControllerTest extends TestBase {
private static final int RECORD_TIME = 60000;
private static final int RECORD_TIME = 6000000;
private final String SCRIPT_URL = TestBase.BASE_URL + "/RecordScript";
public OperateScriptServerResponseModel startRecord() throws IOException,