Example #1
0
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
}
Example #2
0
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
}
Example #3
0
func (r *Request) Method() string {
	return engine.Bytes2str(r.context.Method())
}
Example #4
0
func (r *Request) URI() string {
	return engine.Bytes2str(r.context.RequestURI())
}
Example #5
0
func (r *Request) Host() string {
	return engine.Bytes2str(r.context.Host())
}
Example #6
0
func (r *Request) Scheme() string {
	return engine.Bytes2str(r.context.URI().Scheme())
}
Example #7
0
func (r *Request) UserAgent() string {
	return engine.Bytes2str(r.context.UserAgent())
}
Example #8
0
func (r *Request) Referer() string {
	return engine.Bytes2str(r.context.Referer())
}
Example #9
0
func (r *Request) Cookie(key string) string {
	return engine.Bytes2str(r.context.Request.Header.Cookie(key))
}
Example #10
0
func (u *UrlValue) Get(key string) string {
	u.init()
	return engine.Bytes2str(u.Args.Peek(key))
}
Example #11
0
File: url.go Project: webx-top/echo
func (u *URL) RawQuery() string {
	return engine.Bytes2str(u.url.QueryString())
}
Example #12
0
File: url.go Project: webx-top/echo
func (u *URL) QueryValue(name string) string {
	return engine.Bytes2str(u.url.QueryArgs().Peek(name))
}
Example #13
0
File: url.go Project: webx-top/echo
func (u *URL) Path() string {
	return engine.Bytes2str(u.url.Path())
}
Example #14
0
File: url.go Project: webx-top/echo
func (u *URL) RawPath() string {
	return engine.Bytes2str(u.url.PathOriginal())
}
Example #15
0
func (h *ResponseHeader) Get(key string) string {
	return engine.Bytes2str(h.header.Peek(key))
}