Documentation
¶
Index ¶
- Variables
- func PragmaCacheControl(header http.Header)
- func ValidBody(body string) bool
- func ValidHeader(header string) bool
- func ValidMethod(method string) bool
- func ValidPath(path string) bool
- func ValidQuery(query string) bool
- type Body
- type Request
- type RequestDecoder
- type RequestEncode
- type RequestProcess
- type Response
- func (r *Response) AddCookie(name, value string)
- func (r *Response) AddCookieEntity(cookie *http.Cookie)
- func (r *Response) AddHeader(name, value string)
- func (r *Response) Body() *Body
- func (r *Response) Cookies() []*http.Cookie
- func (r *Response) Request() *Request
- func (r *Response) SetBody(body *Body)
- func (r *Response) SetStatusCode(statusCode int)
- func (r *Response) SetStatusCodeAndText(statusCode int, statusText string)
- func (r *Response) StatusCode() int
- type ResponseDecoder
- type ResponseEncode
- type ResponseProcess
Constants ¶
This section is empty.
Variables ¶
View Source
var HttpMethods = []string{
"GET",
"HEAD",
"POST",
"PUT",
"PATCH",
"DELETE",
"CONNECT",
"OPTIONS",
"TRACE",
}
Functions ¶
func PragmaCacheControl ¶
PragmaCacheControl RFC 7234, section 5.4: Pragma: no-cache && Cache-Control: no-cache
func ValidHeader ¶
func ValidQuery ¶
Types ¶
type Body ¶
type Body struct {
// contains filtered or unexported fields
}
func NewWriteBody ¶
func (*Body) ReadString ¶
type Request ¶
type Request struct {
http.Request
Response *Response
BufReadr *codec.ByteBuf
BufWriter *codec.ByteBuf
// contains filtered or unexported fields
}
Request http请求体
func NewRequest ¶
func (*Request) AddCookieEntity ¶
type RequestDecoder ¶
type RequestDecoder struct {
}
RequestDecoder 请求解码器, 从io缓冲区读取字节流, 并解码为http请求对象, 缓冲区一般为socket连接, 也可以使字节数组等
func (*RequestDecoder) Decoder ¶
func (r *RequestDecoder) Decoder(request *Request) (err error)
Decoder 解码入口
type RequestEncode ¶ added in v1.1.0
type RequestEncode struct{}
RequestEncode http编码器, 把request对象编码成字节流, 并写入io缓冲区, 根据 RFC2616 规范编码
func NewRequestEncode ¶ added in v1.1.0
func NewRequestEncode() *RequestEncode
func (*RequestEncode) Encoder ¶ added in v1.1.0
func (r *RequestEncode) Encoder(request *Request) (err error)
type RequestProcess ¶
type RequestProcess struct {
// contains filtered or unexported fields
}
func NewRequestProcess ¶
func NewRequestProcess() *RequestProcess
func (*RequestProcess) Disconnect ¶
func (r *RequestProcess) Disconnect(session *event.Session) error
type Response ¶
type Response struct {
Proto string
ProtoMajor int
ProtoMinor int
Header http.Header
Close bool
Server string
BufWriter *codec.ByteBuf
BufReader *codec.ByteBuf
// contains filtered or unexported fields
}
func NewReplyResponse ¶
NewReplyResponse 根据request创建Response, 用于服务端模式
func (*Response) AddCookieEntity ¶
func (*Response) SetStatusCode ¶
func (*Response) SetStatusCodeAndText ¶ added in v1.1.0
func (*Response) StatusCode ¶
type ResponseDecoder ¶ added in v1.1.0
type ResponseDecoder struct{}
ResponseDecoder 解码器, 从io缓冲区读取字节流, 并解码为response对象
func NewResponseDecoder ¶ added in v1.1.0
func NewResponseDecoder() *ResponseDecoder
func (*ResponseDecoder) Decoder ¶ added in v1.1.0
func (r *ResponseDecoder) Decoder(response *Response) (err error)
type ResponseEncode ¶
type ResponseEncode struct{}
ResponseEncode 编码器, 把response编码为字节流并写入缓冲区
func NewResponseEncode ¶
func NewResponseEncode() *ResponseEncode
func (*ResponseEncode) Encode ¶
func (r *ResponseEncode) Encode(response *Response) (err error)
type ResponseProcess ¶
type ResponseProcess struct {
// contains filtered or unexported fields
}
func NewResponseProcess ¶
func NewResponseProcess() *ResponseProcess
func (*ResponseProcess) Disconnect ¶
func (r *ResponseProcess) Disconnect(session *event.Session) error
Click to show internal directories.
Click to hide internal directories.