filter

package
v0.0.0-...-a706524 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 30, 2016 License: MIT Imports: 14 Imported by: 0

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

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 CreateRequest(c *gin.Context, method, reqUrl, remoteHost string) *http.Request

func DealCookie

func DealCookie(remoteHost, cookieData string, isRequest bool) string

处理Cookie中的域名信息, toHostName 表示这个cookie将要发送到的remoteHost isRequest=true表示这个是代理服务器转发客户端或者浏览器的请求。反之表示此时是 代理服务器转发服务端的应答

func DumpResponse

func DumpResponse(resp *http.Response)

func FilterCookie

func FilterCookie(cookies []*http.Cookie, reverse bool) []*http.Cookie

func FilterHeader

func FilterHeader(src, target http.Header, remoteHost string, isRequest bool) http.Header

过滤src的Header信息, reverse=true表示将远程Host替换成本地Host。 替换结果将直接放置于target中

func SmartRead

func SmartRead(resp *http.Response, replaceHost bool) (body []byte, unzipped bool, err error)

func SmartWrite

func SmartWrite(c *gin.Context, resp *http.Response, body []byte, unzipped bool)

resp是远程被代理的服务器返回的http应答。 body是我们处理过后的远程服务器应答Body数据。 unzipped 表示body数据是否经过解压,如果unzipped=true, 则表明解压过, 那么在反馈给客户端之前需要重新压缩。

func ZipReader

func ZipReader(encoding string, reader io.ReadCloser) (io.ReadCloser, error)

func ZipWriter

func ZipWriter(encoding string, writer io.Writer) io.Writer

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL