ClearRequestHeaders

清除之前使用 AddHeader 方法設定的所有標頭。

語法

ClearRequestHeaders

傳回值

未傳回資料。

範例

此指令碼將修改一些標頭,嘗試開機記錄檔分析程式上的跨網站指令碼攻擊:

Function Main

Dim HTTPObj As Object

Dim headers As Variant

ip = "www.gfi.com"

port = 80

cr = Chr(13) + Chr(10)

XSSTest = "<script>alert('全新 GFI LanGuard 具備「跨網站指令碼偵測」功能')</script>"

Set HTTPobj = HTTP.Connect (ip,port)

'要嘗試的標頭

headers = Array ( "Host", "User-Agent", "Accept", "X-Header1" , "X-Proxy", "Cookie" )

HTTPobj.GetURL("/")

HTTPobj.Authentication = 1

'可能要使用的每個標頭的迴圈

'插入 XSS 簽名。 每次皆傳送要求

For a = LBound(headers) To UBound(headers)

HTTPobj.ClearRequestHeaders

HTTPobj.AddHeader headers(a), XSSTest

'使用我們自訂的標頭傳送 GET 要求

HTTPResponse = HTTPobj.SendRequest ()

echo CStr(a) + " result: " + CStr(HTTPResponse)+cr

下一步

End Function