修复gcurl上的bug, 并且调整requests为最新版本.

This commit is contained in:
huangsimin 2020-04-17 13:15:23 +08:00
parent 056877030f
commit 61d86bebc7
6 changed files with 18 additions and 6 deletions

2
go.mod
View File

@ -4,7 +4,7 @@ go 1.14
require (
github.com/474420502/focus v0.8.1
github.com/474420502/gurl v0.0.2
github.com/474420502/gcurl v0.0.4
github.com/474420502/requests v1.5.0
github.com/Pallinder/go-randomdata v1.1.0
github.com/lestrrat-go/libxml2 v0.0.0-20200215080510-6483566f52cb

4
go.sum
View File

@ -4,6 +4,10 @@ cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSR
cloud.google.com/go v0.41.0/go.mod h1:OauMR7DV8fzvZIl2qg6rkaIhD/vmgk4iwEw/h6ercmg=
github.com/474420502/focus v0.8.1 h1:PZwCgzcnxwx7ZZCWc/XKLVaZPH9e4YX9cP4ckyT2HDA=
github.com/474420502/focus v0.8.1/go.mod h1:jrDXvK1CnUJ3PCR3ZJVYinbS2Yz5kM8OoAbCLe6AF7Y=
github.com/474420502/gcurl v0.0.3 h1:gbvJ9JiiiaCkLispDZ9tlJPFo8K4e7t4JTFze3UlHHc=
github.com/474420502/gcurl v0.0.3/go.mod h1:qtCzAZZbVRIsBt0lNUh2I0qDniU9T3E21aSsVUYo7Hc=
github.com/474420502/gcurl v0.0.4 h1:eR1BNXvQ4T245dotWpjDzAMWch+FTTfScqzsdq93JK0=
github.com/474420502/gcurl v0.0.4/go.mod h1:qtCzAZZbVRIsBt0lNUh2I0qDniU9T3E21aSsVUYo7Hc=
github.com/474420502/gurl v0.0.2 h1:j1XJSd41M8v1M9glkIVFTR00j87DEt4JoeITELP8Pfk=
github.com/474420502/gurl v0.0.2/go.mod h1:gM500QucE2upVvM4eRIVAhP6gLbcCVEemJdzS1Qbf5E=
github.com/474420502/requests v1.4.0 h1:dnufhTVTo/N1SdWVqBKm4xKDRb0N4P7D7Zg1FJFO29I=

View File

@ -33,7 +33,7 @@ func (web *WebPost) Execute(cxt *TaskContext) {
if err != nil {
panic(err)
}
cxt.SetShare("test", resp.Content())
cxt.SetShare("test", string(resp.Content()))
}
func TestCasePostForm(t *testing.T) {

View File

@ -1,7 +1,7 @@
package hunter
import (
gcurl "github.com/474420502/gurl"
gcurl "github.com/474420502/gcurl"
)
// PreCurlUrl Task的 curl bash 预处理组件

View File

@ -14,11 +14,19 @@ func (web *WebGurl) Execute(cxt *TaskContext) {
if err != nil {
panic(err)
}
cxt.SetShare("test", resp.Content())
cxt.SetShare("test", string(resp.Content()))
}
func TestCurlCom(t *testing.T) {
curlBash := "curl 'http://httpbin.org/' -H 'Connection: keep-alive' -H 'Cache-Control: max-age=0' -H 'Upgrade-Insecure-Requests: 1' -H 'User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.130 Safari/537.36' -H 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9' -H 'Accept-Encoding: gzip, deflate' -H 'Accept-Language: zh-CN,zh;q=0.9' --compressed --insecure"
curlBash := `curl
'http://httpbin.org/'
-H 'Connection: keep-alive'
-H 'Cache-Control: max-age=0'
-H 'Upgrade-Insecure-Requests: 1'
-H 'User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.130 Safari/537.36'
-H 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9'
-H 'Accept-Encoding: gzip, deflate' -H 'Accept-Language: zh-CN,zh;q=0.9'
--compressed --insecure`
hunter := NewHunter(&WebGurl{PreCurlUrl(curlBash)}) // first params PreCurlUrl
hunter.Execute()

View File

@ -14,7 +14,7 @@ func (web *WebPreUrl) Execute(cxt *TaskContext) {
if err != nil {
panic(err)
}
cxt.SetShare("test", resp.Content())
cxt.SetShare("test", string(resp.Content()))
}
func TestCasePreUrl(t *testing.T) {