Commit b54e44c9 authored by wang's avatar wang

cronet

parent 6834237e
...@@ -8,6 +8,7 @@ import ( ...@@ -8,6 +8,7 @@ import (
"encoding/base64" "encoding/base64"
"encoding/binary" "encoding/binary"
"errors" "errors"
"fmt"
"github.com/andybalholm/brotli" "github.com/andybalholm/brotli"
"github.com/bogdanfinn/tls-client/profiles" "github.com/bogdanfinn/tls-client/profiles"
"github.com/sirupsen/logrus" "github.com/sirupsen/logrus"
...@@ -54,9 +55,10 @@ func (c *Client) Start() error { ...@@ -54,9 +55,10 @@ func (c *Client) Start() error {
for _, ck := range cks { for _, ck := range cks {
t := strings.Index(ck, "=") t := strings.Index(ck, "=")
if t != -1 { if t != -1 {
fmt.Println(ck[:t], ck[t+1:], zhuanyi(ck[t+1:]))
cookies = append(cookies, &http.Cookie{ cookies = append(cookies, &http.Cookie{
Name: ck[:t], Name: ck[:t],
Value: ck[t+1:], Value: zhuanyi(ck[t+1:]),
}) })
} }
...@@ -81,6 +83,7 @@ func (c *Client) Start() error { ...@@ -81,6 +83,7 @@ func (c *Client) Start() error {
req, err = http.NewRequest(http.MethodPost, c.Item.Url, strings.NewReader(c.Item.Data)) req, err = http.NewRequest(http.MethodPost, c.Item.Url, strings.NewReader(c.Item.Data))
} }
} }
req.Method = c.Item.Method
if err != nil { if err != nil {
logrus.Error("url初始化失败 ", err.Error()) logrus.Error("url初始化失败 ", err.Error())
return err return err
...@@ -99,6 +102,10 @@ func (c *Client) Start() error { ...@@ -99,6 +102,10 @@ func (c *Client) Start() error {
return nil return nil
} }
func zhuanyi(s string) string {
return strings.ReplaceAll(s, "\"", "\\\"")
}
func (c *Client) GetResponseHeaders() map[string]string { func (c *Client) GetResponseHeaders() map[string]string {
res := make(map[string]string) res := make(map[string]string)
for k, v := range c.Response.Header { for k, v := range c.Response.Header {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment