diff options
author | Ian Lance Taylor <ian@gcc.gnu.org> | 2012-12-12 23:13:29 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@gcc.gnu.org> | 2012-12-12 23:13:29 +0000 |
commit | a42a906c420d7bb196cb8541e0ab65264a0b04b0 (patch) | |
tree | 8c441679e35147b1e9bec048f733fc394fb0c161 /libgo/go/net/http/request.go | |
parent | bc77608b97abcc4bb3171f08a71e34ae342e9f8d (diff) | |
download | gcc-a42a906c420d7bb196cb8541e0ab65264a0b04b0.zip gcc-a42a906c420d7bb196cb8541e0ab65264a0b04b0.tar.gz gcc-a42a906c420d7bb196cb8541e0ab65264a0b04b0.tar.bz2 |
libgo: Update to current master library sources.
From-SVN: r194460
Diffstat (limited to 'libgo/go/net/http/request.go')
-rw-r--r-- | libgo/go/net/http/request.go | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/libgo/go/net/http/request.go b/libgo/go/net/http/request.go index 61557ff..0b6e6cb 100644 --- a/libgo/go/net/http/request.go +++ b/libgo/go/net/http/request.go @@ -124,6 +124,7 @@ type Request struct { // The host on which the URL is sought. // Per RFC 2616, this is either the value of the Host: header // or the host name given in the URL itself. + // It may be of the form "host:port". Host string // Form contains the parsed form data, including both the URL @@ -643,16 +644,20 @@ func parsePostForm(r *Request) (vs url.Values, err error) { return } -// ParseForm parses the raw query from the URL. +// ParseForm parses the raw query from the URL and updates r.Form. +// +// For POST or PUT requests, it also parses the request body as a form and +// put the results into both r.PostForm and r.Form. +// POST and PUT body parameters take precedence over URL query string values +// in r.Form. // -// For POST or PUT requests, it also parses the request body as a form. -// POST and PUT body parameters take precedence over URL query string values. // If the request Body's size has not already been limited by MaxBytesReader, // the size is capped at 10MB. // // ParseMultipartForm calls ParseForm automatically. // It is idempotent. -func (r *Request) ParseForm() (err error) { +func (r *Request) ParseForm() error { + var err error if r.PostForm == nil { if r.Method == "POST" || r.Method == "PUT" { r.PostForm, err = parsePostForm(r) @@ -728,6 +733,7 @@ func (r *Request) ParseMultipartForm(maxMemory int64) error { // FormValue returns the first value for the named component of the query. // POST and PUT body parameters take precedence over URL query string values. // FormValue calls ParseMultipartForm and ParseForm if necessary. +// To access multiple values of the same key use ParseForm. func (r *Request) FormValue(key string) string { if r.Form == nil { r.ParseMultipartForm(defaultMaxMemory) |