Documentation ¶
Overview ¶
Author: ZHU HAIHUA Date: 8/23/16
Author: ZHU HAIHUA Date: 8/28/16
Author: ZHU HAIHUA Date: 8/23/16
Author: ZHU HAIHUA Date: 8/15/16
Index ¶
- Variables
- func CreateRequest(c *gin.Context, method, reqUrl, remoteHost string) *http.Request
- func DealCookie(remoteHost, cookieData string, isRequest bool) string
- func DumpResponse(resp *http.Response)
- func FilterCookie(cookies []*http.Cookie, reverse bool) []*http.Cookie
- func FilterHeader(src, target http.Header, remoteHost string, isRequest bool) http.Header
- func SmartRead(resp *http.Response, replaceHost bool) (body []byte, unzipped bool, err error)
- func SmartWrite(c *gin.Context, resp *http.Response, body []byte, unzipped bool)
- func ZipReader(encoding string, reader io.ReadCloser) (io.ReadCloser, error)
- func ZipWriter(encoding string, writer io.Writer) io.Writer
Constants ¶
This section is empty.
Variables ¶
View Source
var TEXT_CONTENT []string = []string{"text/plain", "text/html", "text/xml", "text/javascript", "text/json",
"application/json", "application/xml", "application/javascript", "text/css"}
Functions ¶
func CreateRequest ¶
func DealCookie ¶
处理Cookie中的域名信息, toHostName 表示这个cookie将要发送到的remoteHost isRequest=true表示这个是代理服务器转发客户端或者浏览器的请求。反之表示此时是 代理服务器转发服务端的应答
func DumpResponse ¶
func FilterHeader ¶
过滤src的Header信息, reverse=true表示将远程Host替换成本地Host。 替换结果将直接放置于target中
func SmartWrite ¶
resp是远程被代理的服务器返回的http应答。 body是我们处理过后的远程服务器应答Body数据。 unzipped 表示body数据是否经过解压,如果unzipped=true, 则表明解压过, 那么在反馈给客户端之前需要重新压缩。
func ZipReader ¶
func ZipReader(encoding string, reader io.ReadCloser) (io.ReadCloser, error)
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.