package main
import (
"bytes"
"fmt"
"io/ioutil"
"net/http"
"net/http/cookiejar"
"net/url"
"crypto/tls"
"time"
)
var cookies []*http.Cookie
var client = &http.Client{}
func init() {
//跳过证书验证
tr := &http.Transport{
TLSClientConfig: &tls.Config{InsecureSkipVerify: true},
}
client = &http.Client{Timeout: 30 * time.Second, Transport: tr}
}
func main() {
// 用户客户端程序登录后,携带cookie,js-ajax跨域返回数据
http.HandleFunc("/getData", getData)
// 用户客户端程序登录后,携带cookie,重新定向URL页面
http.HandleFunc("/login", doLogin)
http.ListenAndServeTLS(":9966", "cert.pem", "key.pem", nil)
}
func do