aboutsummaryrefslogtreecommitdiff
path: root/src/pkg/http/request.go
AgeCommit message (Collapse)Author
2011-11-03net: renamingsRob Pike
This is Go 1 package renaming CL #3. This one merely moves the source; the import strings will be changed after the next weekly release. This one moves pieces into net. http -> net/http http/cgi -> net/http/cgi http/fcgi -> net/http/fcgi http/pprof -> net/http/pprof http/httptest -> net/http/httptest mail -> net/mail rpc -> net/rpc rpc/jsonrpc -> net/rpc/jsonrpc smtp -> net/smtp url -> net/url Also remove rand (now math/rand) from NOTEST - it has a test. The only edits are in Makefiles and deps.bash. R=golang-dev, bradfitz CC=golang-dev https://golang.org/cl/5335048
2011-11-01src/pkg/[a-m]*: gofix -r error -force=errorRuss Cox
R=golang-dev, iant CC=golang-dev https://golang.org/cl/5322051
2011-10-24http: add package commentBrad Fitzpatrick
Fixes #2378 R=rsc CC=golang-dev https://golang.org/cl/5312052
2011-10-14http: RoundTrippers shouldn't mutate RequestBrad Fitzpatrick
Fixes #2146 R=rsc CC=golang-dev https://golang.org/cl/5284041
2011-10-12http: remove Request.RawURLBrad Fitzpatrick
Its purpose is not only undocumented, it's also unknown (to me and Russ, at least) and leads to complexity, bugs and confusion. R=golang-dev, adg, rsc CC=golang-dev https://golang.org/cl/5213043
2011-09-19http: prevent DumpRequest from adding implicit headersBrad Fitzpatrick
Fixes #2272 R=rsc CC=golang-dev https://golang.org/cl/5043051
2011-09-15http: MaxBytesReader doc cleanupsBrad Fitzpatrick
Comments from rsc after 4921049 was submitted. R=rsc CC=golang-dev https://golang.org/cl/5034042
2011-09-15http: fix WriteProxy documentationBrad Fitzpatrick
Fixes #2258 R=golang-dev, rsc CC=golang-dev https://golang.org/cl/5016048
2011-08-23http: add MaxBytesReader to limit request body sizeBrad Fitzpatrick
This adds http.MaxBytesReader, similar to io.LimitReader, but specific to http, and for preventing a class of DoS attacks. This also makes the 10MB ParseForm limit optional (if not already set by a MaxBytesReader), documents it, and also adds "PUT" as a valid verb for parsing forms in the request body. Improves issue 2093 (DoS protection) Fixes #2165 (PUT form parsing) R=golang-dev, adg CC=golang-dev https://golang.org/cl/4921049
2011-08-18mime: ParseMediaType returns os.Error now, not a nil mapBrad Fitzpatrick
ParseMediaType previously documented that it always returned a non-nil map, but also documented that it returned a nil map to signal an error. That is confusing, contradictory and not Go-like. Now it returns (mediatype string, params map, os.Error). R=golang-dev, r CC=golang-dev https://golang.org/cl/4867054
2011-08-18http: remove a TODO due to new behavior of nil mapsRob Pike
R=golang-dev, dsymonds, adg CC=golang-dev https://golang.org/cl/4907049
2011-08-17url: new packageRob Pike
This is just moving the URL code from package http into its own package, which has been planned for a while. Besides clarity, this also breaks a nascent dependency cycle the new template package was about to introduce. Add a gofix module, url, and use it to generate changes outside http and url. Sadness about the churn, gladness about some of the naming improvements. R=dsymonds, bradfitz, rsc, gustavo, r CC=golang-dev https://golang.org/cl/4893043
2011-08-10http: fix ParseMultipartForm after MultipartReader errorBrad Fitzpatrick
Addresses part of issue 2093 Thanks to espians....@ R=golang-dev, nigeltao CC=golang-dev https://golang.org/cl/4808087
2011-07-27container/vector: removed some uses of container/vector in other pkgsJohn Asmuth
R=gri CC=golang-dev https://golang.org/cl/4823054
2011-07-21undo CL 4808044 / 1bd754e69ce7Russ Cox
ServeMux depends on having a URL in order to mux. It might be that the right fix is to have CONNECT handlers just not look at URL. ««« original CL description http: do not parse req.URL for CONNECT CONNECT's argument is not a URL. R=golang-dev, bradfitz, rsc CC=golang-dev https://golang.org/cl/4808044 »»» TBR=bradfitz CC=golang-dev https://golang.org/cl/4798046
2011-07-21http: do not parse req.URL for CONNECTYasuhiro Matsumoto
CONNECT's argument is not a URL. R=golang-dev, bradfitz, rsc CC=golang-dev https://golang.org/cl/4808044
2011-06-29http: make NewChunkedReader publicAndrew Balholm
R=golang-dev, bradfitz CC=golang-dev https://golang.org/cl/4634112
2011-06-28strings.Split: make the default to split all.Rob Pike
Change the signature of Split to have no count, assuming a full split, and rename the existing Split with a count to SplitN. Do the same to package bytes. Add a gofix module. R=adg, dsymonds, alex.brainman, rsc CC=golang-dev https://golang.org/cl/4661051
2011-06-24http: better handling of 0-length Request.BodyBrad Fitzpatrick
As rsc suggested after change 58a6bdac3d12 was committed, we now read the first byte of Request.Body when the Request.ContentLength is 0 to disambiguate between a truly zero-length body and a body of unknown length where the user didn't set the ContentLength field. This was also causing the reverse proxy problem where incoming requests (which always have a body, of private type http.body, even for 0-lengthed requests) were being relayed to the http Transport for fetching, which was serializing the request as a chunked request (since ContentLength was 0 and Body was non-nil) Fixes #1999 R=golang-dev, kevlar CC=golang-dev https://golang.org/cl/4628063
2011-06-23http: buffer Request.WriteBrad Fitzpatrick
Fixes #1996 R=golang-dev, r CC=golang-dev https://golang.org/cl/4639068
2011-06-22os.Error API: don't export os.ErrorString, use os.NewError consistentlyRobert Griesemer
This is a core API change. 1) gofix misc src 2) Manual adjustments to the following files under src/pkg: gob/decode.go rpc/client.go os/error.go io/io.go bufio/bufio.go http/request.go websocket/client.go as well as: src/cmd/gofix/testdata/*.go.in (reverted) test/fixedbugs/bug243.go 3) Implemented gofix patch (oserrorstring.go) and test case (oserrorstring_test.go) Compiles and runs all tests. R=r, rsc, gri CC=golang-dev https://golang.org/cl/4607052
2011-06-16http: make Headers be source of truthBrad Fitzpatrick
Previously Request and Response had redundant fields for Referer, UserAgent, and cookies which caused confusion and bugs. It also didn't allow us to expand the package over time, since the way to access fields would be in the Headers one day and promoted to a field the next day. That would be hard to gofix, especially with code ranging over Headers. After a discussion on the mail package's design with a similar problem, we've designed to make the Headers be the source of truth and add accessors instead. Request: change: Referer -> Referer() change: UserAgent -> UserAgent() change: Cookie -> Cookies() new: Cookie(name) *Cookie new: AddCookie(*Cookie) Response: change: Cookie -> Cookies() Cookie: new: String() string R=rsc CC=golang-dev https://golang.org/cl/4620049
2011-06-16mime/multipart: convert Reader from interface to structBrad Fitzpatrick
It was always a weird interface but I didn't know what I was doing at the time. rsc questioned me about it then but didn't press on it during review. Then adg bugged me about it too recently. So clean it up. It parallels the Writer struct too. R=golang-dev, r, rsc CC=golang-dev https://golang.org/cl/4602063
2011-06-08http: fix handling of 0-lengthed http requestsBrad Fitzpatrick
Via Russ Ross' bug report on golang-nuts, it was not possible to send an HTTP request with a zero length body with either a Content-Length (it was stripped) or chunking (it wasn't set). This means Go couldn't upload 0-length objects to Amazon S3. (which aren't as silly as they might sound, as S3 objects can have key/values associated with them, set in the headers) Amazon further doesn't supported chunked uploads. (not Go's problem, but we should be able to let users set an explicit Content-Length, even if it's zero.) To fix the ambiguity of an explicit zero Content-Length and the Request struct's default zero value, users need to explicit set TransferEncoding to []string{"identity"} to force the Request.Write to include a Content-Length: 0. identity is in RFC 2616 but is ignored pretty much everywhere. We don't even then serialize it on the wire, since it's kinda useless, except as an internal sentinel value. The "identity" value is then documented, but most users can ignore that because NewRequest now sets that. And adds more tests. R=golang-dev, rsc CC=golang-dev https://golang.org/cl/4603041
2011-06-08http: change most map[string][]string types to new Values typeBrad Fitzpatrick
This replaces most the map[string][]string usage with a new Values type name, with the usual methods. It also changes client.PostForm to take a Values, rather than a map[string]string, closing a TODO in the code. R=rsc CC=golang-dev https://golang.org/cl/4532123
2011-05-31http: have client set Content-Length when possibleBrad Fitzpatrick
Also some cleanup, removing redundant code. Make more things use NewRequest. Add some tests, docs. R=golang-dev, adg, rsc CC=golang-dev https://golang.org/cl/4561047
2011-05-25encoding/base64: add DecodeString and EncodeToStringBrad Fitzpatrick
... like encoding/hex. Same signatures. R=golang-dev, rsc CC=golang-dev https://golang.org/cl/4530070
2011-05-20http: include Host header in requests, even with proxiesBrad Fitzpatrick
A user pointed out that Go didn't work with their corp proxy, always throwing 400 Bad Request errors. Looking at the RFC 2616, Host is always required, even with proxies. The old code assumed that writing an absolute URL in the first line of an HTTP request implied that the Host header was no longer necessary. Double-checked behavior with curl. R=golang-dev, dsymonds CC=golang-dev https://golang.org/cl/4539075
2011-05-13http: add Request.SetBasicAuth methodBrad Fitzpatrick
R=golang-dev, dsymonds, rsc CC=golang-dev https://golang.org/cl/4543050
2011-05-03http: fix FormFile nil pointer dereference on missing multipart formAndrew Gerrand
R=rsc CC=golang-dev https://golang.org/cl/4463042
2011-04-28http: add Header.Write methodEvan Shaw
R=golang-dev, bradfitz, dsymonds CC=golang-dev https://golang.org/cl/4426069
2011-04-28http: add MultipartForm, FormFile, and ParseMultipartForm to RequestAndrew Gerrand
R=rsc, bradfitz CC=golang-dev https://golang.org/cl/4431068
2011-04-27http: put a limit on POST sizeBrad Fitzpatrick
R=rsc CC=golang-dev https://golang.org/cl/4432076
2011-04-21http: clarify docs on Request HTTP versionBrad Fitzpatrick
Fixes #910 R=adg, rsc1 CC=golang-dev https://golang.org/cl/4439062
2011-04-20src/pkg: make package doc comments consistently start with "Package foo".Nigel Tao
R=rsc CC=golang-dev https://golang.org/cl/4442064
2011-04-14http: add NewRequest helperBrad Fitzpatrick
NewRequest will save a lot of boilerplate code. This also updates some docs on Request.Write and adds some tests. R=rsc, petar-m, r CC=golang-dev https://golang.org/cl/4406047
2011-03-10http: move RemoteAddr & UsingTLS from ResponseWriter to RequestBrad Fitzpatrick
ResponseWriter.RemoteAddr() string -> Request.RemoteAddr string ResponseWriter.UsingTLS() bool -> Request.TLS *tls.ConnectionState R=rsc, bradfitzwork CC=gburd, golang-dev https://golang.org/cl/4248075
2011-03-06http: use Header type consistentlyRuss Cox
R=bradfitzgo, dsymonds CC=golang-dev https://golang.org/cl/4244053
2011-03-06http: add cookie supportPetar Maymounkov
R=rsc1, mattn, bradfitzwork, pascal, bradfitzgo CC=golang-dev https://golang.org/cl/4214042
2011-03-05http: fix, use WriteProxyRuss Cox
Fixes #53. R=bradfitzgo, bradfitzwork CC=golang-dev https://golang.org/cl/4240075
2011-03-02http: give ParseHTTPVersion a real example.David Symonds
R=rsc CC=golang-dev https://golang.org/cl/4239050
2011-03-01http: export parseHTTPVersion.David Symonds
R=rsc, adg CC=golang-dev https://golang.org/cl/4244045
2011-02-23http: introduce Header type, implement with net/textprotoPetar Maymounkov
textproto: introduce Header type websocket: use new interface to access Header R=rsc, mattn CC=golang-dev https://golang.org/cl/4185053
2011-02-17http: send full URL in proxy requestsRuss Cox
Fixes #53. (again) R=agl1 CC=golang-dev https://golang.org/cl/4167054
2011-01-14http: fix scheme-relative URL parsing; add ParseRequestURLBrad Fitzpatrick
Also adds some tests for Issue 900 which was the reason the current URL parsing is broken. (the previous fix was wrong) R=rsc, adg, dangabrad, bradfitzwork CC=golang-dev https://golang.org/cl/3910042
2010-11-01strings: ContainsBrad Fitzpatrick
Tiny helper to avoid strings.Index(s, sub) != -1 R=rsc, r2, r CC=golang-dev https://golang.org/cl/2265044
2010-10-06http: return the correct error if a header line is too long.Stephen Ma
R=golang-dev, r2 CC=golang-dev https://golang.org/cl/2372042
2010-09-27http: support HTTP/1.0 Keep-AliveBrad Fitzpatrick
R=rsc, bradfitz1 CC=golang-dev https://golang.org/cl/2261042
2010-09-27http: correct escaping of different parts of URLRuss Cox
Fixes #1076. R=adg CC=golang-dev https://golang.org/cl/2248045
2010-09-22http: don't always escape all reserved chars (fix build)Andrew Gerrand
R=nigeltao, nigeltao_golang CC=golang-dev https://golang.org/cl/2206044