func (u *UrlValue) All() map[string][]string { if u.values != nil { return *u.values } r := url.Values{} u.init() u.Args.VisitAll(func(k, v []byte) { key := engine.Bytes2str(k) r.Add(key, engine.Bytes2str(v)) }) u.values = &r return *u.values }
func (r *Request) StdRequest() *http.Request { if r.stdRequest != nil { return r.stdRequest } var req http.Request ctx := r.context req.Method = r.Method() req.Proto = "HTTP/1.1" req.ProtoMajor = 1 req.ProtoMinor = 1 req.RequestURI = r.URI() req.ContentLength = r.Size() req.Host = r.Host() req.RemoteAddr = r.RemoteAddress() hdr := make(http.Header) ctx.Request.Header.VisitAll(func(k, v []byte) { sk := engine.Bytes2str(k) sv := engine.Bytes2str(v) switch sk { case "Transfer-Encoding": req.TransferEncoding = append(req.TransferEncoding, sv) default: hdr.Set(sk, sv) } }) req.Header = hdr req.Body = r.Body() rURL, err := url.ParseRequestURI(req.RequestURI) if err != nil { ctx.Logger().Printf("cannot parse requestURI %q: %s", req.RequestURI, err) r.response.Error("Internal Server Error") } req.URL = rURL r.stdRequest = &req return r.stdRequest }
func (r *Request) Method() string { return engine.Bytes2str(r.context.Method()) }
func (r *Request) URI() string { return engine.Bytes2str(r.context.RequestURI()) }
func (r *Request) Host() string { return engine.Bytes2str(r.context.Host()) }
func (r *Request) Scheme() string { return engine.Bytes2str(r.context.URI().Scheme()) }
func (r *Request) UserAgent() string { return engine.Bytes2str(r.context.UserAgent()) }
func (r *Request) Referer() string { return engine.Bytes2str(r.context.Referer()) }
func (r *Request) Cookie(key string) string { return engine.Bytes2str(r.context.Request.Header.Cookie(key)) }
func (u *UrlValue) Get(key string) string { u.init() return engine.Bytes2str(u.Args.Peek(key)) }
func (u *URL) RawQuery() string { return engine.Bytes2str(u.url.QueryString()) }
func (u *URL) QueryValue(name string) string { return engine.Bytes2str(u.url.QueryArgs().Peek(name)) }
func (u *URL) Path() string { return engine.Bytes2str(u.url.Path()) }
func (u *URL) RawPath() string { return engine.Bytes2str(u.url.PathOriginal()) }
func (h *ResponseHeader) Get(key string) string { return engine.Bytes2str(h.header.Peek(key)) }