|
@@ -120,18 +120,21 @@ func (s *Script) LoadScript(code, script_file string, newstate bool) string {
|
|
json.Unmarshal([]byte(cookie), &mycookie)
|
|
json.Unmarshal([]byte(cookie), &mycookie)
|
|
var ret string
|
|
var ret string
|
|
var retcookie []*http.Cookie
|
|
var retcookie []*http.Cookie
|
|
|
|
+ var headers = map[string]interface{}{}
|
|
if param == nil {
|
|
if param == nil {
|
|
ptext := map[string]interface{}{"text": S.ToString(-3)}
|
|
ptext := map[string]interface{}{"text": S.ToString(-3)}
|
|
- ret, retcookie = DownloadAdv(s.Downloader, url, method, ptext, util.GetTable(head), mycookie, charset, s.Userproxy, ishttps, s.SCode, s.Timeout)
|
|
|
|
|
|
+ ret, retcookie, headers = DownloadAdv(s.Downloader, url, method, ptext, util.GetTable(head), mycookie, charset, s.Userproxy, ishttps, s.SCode, s.Timeout)
|
|
} else {
|
|
} else {
|
|
- ret, retcookie = DownloadAdv(s.Downloader, url, method, util.GetTable(param), util.GetTable(head), mycookie, charset, s.Userproxy, ishttps, s.SCode, s.Timeout)
|
|
|
|
|
|
+ ret, retcookie, headers = DownloadAdv(s.Downloader, url, method, util.GetTable(param), util.GetTable(head), mycookie, charset, s.Userproxy, ishttps, s.SCode, s.Timeout)
|
|
}
|
|
}
|
|
S.Push(lua.LString(ret))
|
|
S.Push(lua.LString(ret))
|
|
scookie, _ := json.Marshal(retcookie)
|
|
scookie, _ := json.Marshal(retcookie)
|
|
S.Push(lua.LString(scookie))
|
|
S.Push(lua.LString(scookie))
|
|
|
|
+ hTable := util.MapToLuaTable(S, headers)
|
|
|
|
+ S.Push(hTable)
|
|
atomic.AddInt32(&s.ToDayRequestNum, 1)
|
|
atomic.AddInt32(&s.ToDayRequestNum, 1)
|
|
atomic.AddInt32(&s.TotalRequestNum, 1)
|
|
atomic.AddInt32(&s.TotalRequestNum, 1)
|
|
- return 2
|
|
|
|
|
|
+ return 3
|
|
}))
|
|
}))
|
|
//保存验证错误日志
|
|
//保存验证错误日志
|
|
s.L.SetGlobal("saveErrLog", s.L.NewFunction(func(S *lua.LState) int {
|
|
s.L.SetGlobal("saveErrLog", s.L.NewFunction(func(S *lua.LState) int {
|