Live Http headers是Firefox下Http頭信息捕獲利器,常用于安全測試。但不幸的是Replay功能無法在最近版本的Firefox瀏覽器(35.0.1)中工作,我決定在插件的官方版本更新之前做一個臨時的修復。
我發現在HTTP Headers包含If-Modified-Since能夠讓replay功能重新工作。
If-Modified-Since是標準的HTTP請求頭標簽,在發送HTTP請求時,把瀏覽器端緩存頁面的最后修改時間一起發到服務器去,服務器會把這個時間與服務器上實際文件的最后修改時間進行比較。
If-Modified-Since用于記錄頁面最后修改時間的HTTP頭信息,是由客戶端往服務器發送的頭,與之相似的是Last-Modified,不同的是Last-Modified是由服務器往客戶端發送的 HTTP 頭。
如果時間一致,那么返回HTTP狀態碼304(不返回文件內容),客戶端接到之后,就直接把本地緩存文件顯示到瀏覽器中。
如果時間不一致,就返回HTTP狀態碼200和新的文件內容,客戶端接到之后,會丟棄舊文件,把新文件緩存起來,并顯示到瀏覽器中。
如果把
If-Modified-Since: *
添加到Live HTTP Headers中replay功能的默認HTTP頭中,就能使replay正常工作了。
修復方法:
在firfox地址欄輸入:about:support
進入配置文件夾。
我這里Live HTTP Headers插件的目錄在
.\extensions\{8f8fe09b-0bd3-4470-bc1b-8cad42b8203a}
然后再進入chrome目錄,找到livehttpheaders.jar
修改livehttpheaders.jar中的文件/content/LiveHTTPReplay.js
if(!livehttpheaders) var livehttpheaders={};if(!livehttpheaders.replay) livehttpheaders.replay={};livehttpheaders.replay.live = window.arguments[0];livehttpheaders.replay.init = function() {
var args = window.arguments;
document.getElementById(“livehttpheaders.replay.method”).value = args[1];
document.getElementById(“livehttpheaders.replay.url”).value = args[2];
document.getElementById(“livehttpheaders.replay.version”).value = args[3];
document.getElementById(“livehttpheaders.replay.headers”).value = args[4];
if (args[5] != null) {
document.getElementById(“livehttpheaders.replay.post”).value = livehttpheaders.replay.stringToEscape(args[5]);
document.getElementById(“livehttpheaders.replay.sendpost”).checked=”true”;
}
livehttpheaders.replay.updatePost();}
修改為:
if(!livehttpheaders) var livehttpheaders={};if(!livehttpheaders.replay) livehttpheaders.replay={};livehttpheaders.replay.live = window.arguments[0];livehttpheaders.replay.init = function() {
var args = window.arguments;
document.getElementById(“livehttpheaders.replay.method”).value = args[1];
document.getElementById(“livehttpheaders.replay.url”).value = args[2];
document.getElementById(“livehttpheaders.replay.version”).value = args[3];
document.getElementById(“livehttpheaders.replay.headers”).value = args[4] + “If-Modified-Since: *\n”;
if (args[5] != null) {
document.getElementById(“livehttpheaders.replay.post”).value = livehttpheaders.replay.stringToEscape(args[5]);
document.getElementById(“livehttpheaders.replay.sendpost”).checked=”true”;
}
livehttpheaders.replay.updatePost();}
修改完成以后重啟firfox,試試replay功能,你會發現它已經能夠正常工作了。
Notice:
修改之后把文件要打包成livehttpheaders.jar(不是livehttpheaders.zip)
送上已經修改好的
http://share.weiyun.com/3aa6305c265f8af77c9e0bd664e0775e (密碼:KdY5)
文章來源:FreeBuf黑客與極客(FreeBuf.COM)