Documentation
¶
Index ¶
- Variables
- func AddRouter(Url []byte, method HttpMethod, handler func(*HttpRequest, *HttpResponse)) error
- func DefaultGETHandler(request *HttpRequest, response *HttpResponse, phpPlugin *php.Plugin)
- func DefaultHEADHandler(request *HttpRequest, response *HttpResponse)
- func DefaultPOSTHandler(request *HttpRequest, response *HttpResponse)
- func Handler(rawPacket []byte, phpPlugin *php.Plugin) (rep *stream.HttpStream, isKeepAlive bool)
- func RemoveRouter(Url []byte, method HttpMethod) error
- type HttpMethod
- type HttpRequest
- type HttpResponse
- type HttpStateCode
Constants ¶
This section is empty.
Variables ¶
View Source
var CRLF = []byte{13, 10}
"/r/n"
View Source
var SEP = []byte{58, 32}
": "
Functions ¶
func AddRouter ¶
func AddRouter(Url []byte, method HttpMethod, handler func(*HttpRequest, *HttpResponse)) error
func DefaultGETHandler ¶
func DefaultGETHandler(request *HttpRequest, response *HttpResponse, phpPlugin *php.Plugin)
Default GET method
root/URL
func DefaultHEADHandler ¶
func DefaultHEADHandler(request *HttpRequest, response *HttpResponse)
Default HEAD method
func DefaultPOSTHandler ¶
func DefaultPOSTHandler(request *HttpRequest, response *HttpResponse)
Default POST method
func RemoveRouter ¶
func RemoveRouter(Url []byte, method HttpMethod) error
Types ¶
type HttpMethod ¶
type HttpMethod uint8
HttpMethod
GET POST HEAD
const ( GET HttpMethod = 71 POST HttpMethod = 80 HEAD HttpMethod = 72 )
type HttpRequest ¶
type HttpRequest struct {
// contains filtered or unexported fields
}
HTTP请求
func (*HttpRequest) GetAllParamKey ¶
func (req *HttpRequest) GetAllParamKey() []string
获取request的所有参数名
type HttpResponse ¶
type HttpResponse struct {
// contains filtered or unexported fields
}
HTTP返回
func (*HttpResponse) SetHeader ¶
func (rep *HttpResponse) SetHeader(key string, value string)
设置response的首部
func (*HttpResponse) Write ¶
func (rep *HttpResponse) Write(Data ...interface{})
Response Content 写入接口
type HttpStateCode ¶
type HttpStateCode uint16
HttpStateCode
const ( OK HttpStateCode = 200 PartialContent HttpStateCode = 206 BadRequest HttpStateCode = 400 Forbidden HttpStateCode = 403 NotFound HttpStateCode = 404 InternalServerError HttpStateCode = 500 )
Click to show internal directories.
Click to hide internal directories.