diff --git a/.last_go_version b/.last_go_version
index 314fafa0d..eea31607d 100644
--- a/.last_go_version
+++ b/.last_go_version
@@ -1 +1 @@
-6g version weekly.2011-08-10 9382
+6g version weekly.2011-08-17 9528+
diff --git a/clients/go/camwebdav/main.go b/clients/go/camwebdav/main.go
index acd32fc84..e8a01eaa9 100644
--- a/clients/go/camwebdav/main.go
+++ b/clients/go/camwebdav/main.go
@@ -9,6 +9,7 @@ import (
"log"
"os"
"strings"
+ "url"
"xml"
"camli/blobref"
@@ -200,12 +201,12 @@ func ls(path string) (paths []string) {
}
// TODO(rh) settle on an internal format for paths, and a better way to translate between paths and URLs
-func url2path(url *http.URL) string {
- return strings.Trim(url.Path, "/") // TODO(rh) make not suck
+func url2path(url_ *url.URL) string {
+ return strings.Trim(url_.Path, "/") // TODO(rh) make not suck
}
-func path2url(path string) *http.URL {
- return &http.URL{Path: "/" + path} // TODO(rh) make not suck
+func path2url(path string) *url.URL {
+ return &url.URL{Path: "/" + path} // TODO(rh) make not suck
}
func parseprop(x *xmlparser) (props []string) {
diff --git a/clients/go/camwebdav/response.go b/clients/go/camwebdav/response.go
index d7f8677f2..9bf916293 100644
--- a/clients/go/camwebdav/response.go
+++ b/clients/go/camwebdav/response.go
@@ -2,10 +2,11 @@ package main
import (
"bytes"
- "exp/template"
+ "template"
"fmt"
"http"
"time"
+ "url"
)
type xmler interface {
@@ -15,10 +16,10 @@ type xmler interface {
// See: http://www.webdav.org/specs/rfc4918.html
// 14.7 href XML Element
-type href http.URL
+type href url.URL
func (h *href) XML(b *bytes.Buffer) {
- b.WriteString("" + template.HTMLEscapeString((*http.URL)(h).String()) + "")
+ b.WriteString("" + template.HTMLEscapeString((*url.URL)(h).String()) + "")
}
// 14.16 multistatus XML Element
diff --git a/lib/go/camli/blobserver/handlers/enumerate_test.go b/lib/go/camli/blobserver/handlers/enumerate_test.go
index 9bab55af2..926c912b0 100644
--- a/lib/go/camli/blobserver/handlers/enumerate_test.go
+++ b/lib/go/camli/blobserver/handlers/enumerate_test.go
@@ -23,17 +23,18 @@ import (
"http/httptest"
"os"
"testing"
+ "url"
)
-func makeGetRequest(url string) *http.Request {
+func makeGetRequest(url_ string) *http.Request {
req := &http.Request{
Method: "GET",
- RawURL: url,
+ RawURL: url_,
}
var err os.Error
- req.URL, err = http.ParseURL(url)
+ req.URL, err = url.Parse(url_)
if err != nil {
- panic("Error parsing url: " + url)
+ panic("Error parsing url: " + url_)
}
return req
}
diff --git a/lib/go/camli/blobserver/handlers/upload.go b/lib/go/camli/blobserver/handlers/upload.go
index 548c90adb..757aafaa4 100644
--- a/lib/go/camli/blobserver/handlers/upload.go
+++ b/lib/go/camli/blobserver/handlers/upload.go
@@ -80,7 +80,11 @@ func handleMultiPartUpload(conn http.ResponseWriter, req *http.Request, blobRece
break
}
- contentDisposition, params := mime.ParseMediaType(mimePart.Header.Get("Content-Disposition"))
+ contentDisposition, params, err := mime.ParseMediaType(mimePart.Header.Get("Content-Disposition"))
+ if err != nil {
+ addError(err.String())
+ break
+ }
if contentDisposition != "form-data" {
addError(fmt.Sprintf("Expected Content-Disposition of \"form-data\"; got %q", contentDisposition))
break
diff --git a/lib/go/camli/blobserver/localdisk/path.go b/lib/go/camli/blobserver/localdisk/path.go
index 2209ff068..3a960726b 100644
--- a/lib/go/camli/blobserver/localdisk/path.go
+++ b/lib/go/camli/blobserver/localdisk/path.go
@@ -18,10 +18,11 @@ package localdisk
import (
"fmt"
- "http"
+
"path/filepath"
"camli/blobref"
+ "url"
)
func BlobFileBaseName(b *blobref.BlobRef) string {
@@ -44,5 +45,5 @@ func (ds *DiskStorage) PartitionRoot(partition string) string {
if partition == "" {
return ds.root
}
- return filepath.Join(ds.root, "partition", http.URLEscape(partition))
+ return filepath.Join(ds.root, "partition", url.QueryEscape(partition))
}
diff --git a/lib/go/camli/client/enumerate.go b/lib/go/camli/client/enumerate.go
index 8f2e8840b..7277a61b9 100644
--- a/lib/go/camli/client/enumerate.go
+++ b/lib/go/camli/client/enumerate.go
@@ -19,8 +19,9 @@ package client
import (
"camli/blobref"
"fmt"
- "http"
+
"os"
+ "url"
)
type EnumerateOpts struct {
@@ -57,9 +58,9 @@ func (c *Client) EnumerateBlobsOpts(ch chan<- blobref.SizedBlobRef, opts Enumera
if after == "" {
waitSec = opts.MaxWaitSec
}
- url := fmt.Sprintf("%s/camli/enumerate-blobs?after=%s&limit=%d&maxwaitsec=%d",
- c.server, http.URLEscape(after), enumerateBatchSize, waitSec)
- req := c.newRequest("GET", url)
+ url_ := fmt.Sprintf("%s/camli/enumerate-blobs?after=%s&limit=%d&maxwaitsec=%d",
+ c.server, url.QueryEscape(after), enumerateBatchSize, waitSec)
+ req := c.newRequest("GET", url_)
resp, err := c.httpClient.Do(req)
if err != nil {
return error("http request", err)
diff --git a/lib/go/camli/client/remove.go b/lib/go/camli/client/remove.go
index 53d8f6ee0..2acef7fef 100644
--- a/lib/go/camli/client/remove.go
+++ b/lib/go/camli/client/remove.go
@@ -26,6 +26,7 @@ import (
"strings"
"camli/blobref"
+ "url"
)
type removeResponse struct {
@@ -35,8 +36,8 @@ type removeResponse struct {
// Remove the list of blobs. An error is returned if the server failed to
// remove a blob. Removing a non-existent blob isn't an error.
func (c *Client) RemoveBlobs(blobs []*blobref.BlobRef) os.Error {
- url := fmt.Sprintf("%s/camli/remove", c.server)
- params := make(http.Values) // "blobN" -> BlobRefStr
+ url_ := fmt.Sprintf("%s/camli/remove", c.server)
+ params := make(url.Values) // "blobN" -> BlobRefStr
needsDelete := make(map[string]bool) // BlobRefStr -> true
for n, b := range blobs {
if b == nil {
@@ -47,7 +48,7 @@ func (c *Client) RemoveBlobs(blobs []*blobref.BlobRef) os.Error {
needsDelete[b.String()] = true
}
- req, err := http.NewRequest("POST", url, strings.NewReader(params.Encode()))
+ req, err := http.NewRequest("POST", url_, strings.NewReader(params.Encode()))
if err != nil {
return fmt.Errorf("Error creating RemoveBlobs POST request: %v", err)
}
diff --git a/lib/go/camli/client/upload.go b/lib/go/camli/client/upload.go
index cac9f709f..02847b9a1 100644
--- a/lib/go/camli/client/upload.go
+++ b/lib/go/camli/client/upload.go
@@ -29,6 +29,7 @@ import (
"strings"
"camli/blobref"
+ "url"
)
var _ = log.Printf
@@ -237,9 +238,9 @@ func (c *Client) Upload(h *UploadHandle) (*PutResult, os.Error) {
// Pre-upload. Check whether the blob already exists on the
// server and if not, the URL to upload it to.
- url := fmt.Sprintf("%s/camli/stat", c.server)
+ url_ := fmt.Sprintf("%s/camli/stat", c.server)
requestBody := "camliversion=1&blob1=" + blobRefString
- req := c.newRequest("POST", url)
+ req := c.newRequest("POST", url_)
req.Header.Add("Content-Type", "application/x-www-form-urlencoded")
req.Body = ioutil.NopCloser(strings.NewReader(requestBody))
req.ContentLength = int64(len(requestBody))
@@ -338,8 +339,8 @@ func (c *Client) Upload(h *UploadHandle) (*PutResult, os.Error) {
if otherLocation == "" {
return errorf("303 without a Location")
}
- baseUrl, _ := http.ParseURL(stat.uploadUrl)
- absUrl, err := baseUrl.ParseURL(otherLocation)
+ baseUrl, _ := url.Parse(stat.uploadUrl)
+ absUrl, err := baseUrl.Parse(otherLocation)
if err != nil {
return errorf("303 Location URL relative resolve error: %v", err)
}
diff --git a/lib/go/camli/googlestorage/googlestorage.go b/lib/go/camli/googlestorage/googlestorage.go
index 7b98ab107..d3e8c276b 100644
--- a/lib/go/camli/googlestorage/googlestorage.go
+++ b/lib/go/camli/googlestorage/googlestorage.go
@@ -27,6 +27,7 @@ import (
"os"
"strconv"
"strings"
+ "url"
"xml"
"camli/third_party/code.google.com/goauth2/oauth"
@@ -94,9 +95,9 @@ func (gsa *Client) doRequest(req *http.Request, canResend bool) (resp *http.Resp
}
// Makes a simple body-less google storage request
-func (gsa *Client) simpleRequest(method, url string) (resp *http.Response, err os.Error) {
+func (gsa *Client) simpleRequest(method, url_ string) (resp *http.Response, err os.Error) {
// Construct the request
- req, err := http.NewRequest(method, url, nil)
+ req, err := http.NewRequest(method, url_, nil)
if err != nil {
return
}
@@ -206,7 +207,7 @@ func (gsa *Client) EnumerateObjects(bucket, after string, limit uint) ([]SizedOb
// Build url, with query params
params := make([]string, 0, 2)
if after != "" {
- params = append(params, "marker="+http.URLEscape(after))
+ params = append(params, "marker="+url.QueryEscape(after))
}
if limit > 0 {
params = append(params, fmt.Sprintf("max-keys=%v", limit))
diff --git a/lib/go/camli/misc/amazon/s3/client.go b/lib/go/camli/misc/amazon/s3/client.go
index 37373c9e8..c6ef12bfd 100644
--- a/lib/go/camli/misc/amazon/s3/client.go
+++ b/lib/go/camli/misc/amazon/s3/client.go
@@ -27,6 +27,7 @@ import (
"log"
"os"
"strconv"
+ "url"
"xml"
)
@@ -49,8 +50,8 @@ func (c *Client) httpClient() *http.Client {
return http.DefaultClient
}
-func newReq(url string) *http.Request {
- req, err := http.NewRequest("GET", url, nil)
+func newReq(url_ string) *http.Request {
+ req, err := http.NewRequest("GET", url_, nil)
if err != nil {
panic(fmt.Sprintf("s3 client; invalid URL: %v", err))
}
@@ -131,9 +132,9 @@ type listBucketResults struct {
func (c *Client) ListBucket(bucket string, after string, maxKeys uint) (items []*Item, reterr os.Error) {
var bres listBucketResults
- url := fmt.Sprintf("http://%s.s3.amazonaws.com/?marker=%s&max-keys=%d",
- bucket, http.URLEscape(after), maxKeys)
- req := newReq(url)
+ url_ := fmt.Sprintf("http://%s.s3.amazonaws.com/?marker=%s&max-keys=%d",
+ bucket, url.QueryEscape(after), maxKeys)
+ req := newReq(url_)
c.Auth.SignRequest(req)
res, err := c.httpClient().Do(req)
if res != nil && res.Body != nil {
@@ -149,8 +150,8 @@ func (c *Client) ListBucket(bucket string, after string, maxKeys uint) (items []
}
func (c *Client) Get(bucket, key string) (body io.ReadCloser, size int64, err os.Error) {
- url := fmt.Sprintf("http://%s.s3.amazonaws.com/%s", bucket, key)
- req := newReq(url)
+ url_ := fmt.Sprintf("http://%s.s3.amazonaws.com/%s", bucket, key)
+ req := newReq(url_)
c.Auth.SignRequest(req)
var res *http.Response
res, err = c.httpClient().Do(req)
@@ -174,8 +175,8 @@ func (c *Client) Get(bucket, key string) (body io.ReadCloser, size int64, err os
}
func (c *Client) Delete(bucket, key string) os.Error {
- url := fmt.Sprintf("http://%s.s3.amazonaws.com/%s", bucket, key)
- req := newReq(url)
+ url_ := fmt.Sprintf("http://%s.s3.amazonaws.com/%s", bucket, key)
+ req := newReq(url_)
req.Method = "DELETE"
c.Auth.SignRequest(req)
res, err := c.httpClient().Do(req)
diff --git a/lib/go/camli/misc/gpgagent/gpgagent.go b/lib/go/camli/misc/gpgagent/gpgagent.go
index e05be3cf8..97501e074 100644
--- a/lib/go/camli/misc/gpgagent/gpgagent.go
+++ b/lib/go/camli/misc/gpgagent/gpgagent.go
@@ -20,11 +20,12 @@ import (
"encoding/hex"
"bufio"
"fmt"
- "http"
+
"net"
"io"
"strings"
"os"
+ "url"
)
// A connection to the GPG agent.
@@ -74,7 +75,7 @@ type PassphraseRequest struct {
}
func (c *Conn) RemoveFromCache(cacheKey string) os.Error {
- _, err := fmt.Fprintf(c.c, "CLEAR_PASSPHRASE %s\n", http.URLEscape(cacheKey))
+ _, err := fmt.Fprintf(c.c, "CLEAR_PASSPHRASE %s\n", url.QueryEscape(cacheKey))
if err != nil {
return err
}
@@ -129,12 +130,12 @@ func (c *Conn) GetPassphrase(pr *PassphraseRequest) (passphrase string, outerr o
if s == "" {
return "X"
}
- return http.URLEscape(s)
+ return url.QueryEscape(s)
}
_, err = fmt.Fprintf(c.c, "GET_PASSPHRASE %s%s %s %s %s\n",
opts,
- http.URLEscape(pr.CacheKey),
+ url.QueryEscape(pr.CacheKey),
encOrX(pr.Error),
encOrX(pr.Prompt),
encOrX(pr.Desc))
diff --git a/lib/go/camli/search/handler.go b/lib/go/camli/search/handler.go
index 6d9d58915..2fe212fb5 100644
--- a/lib/go/camli/search/handler.go
+++ b/lib/go/camli/search/handler.go
@@ -31,6 +31,7 @@ import (
"camli/blobserver"
"camli/jsonconfig"
"camli/httputil"
+ "url"
)
const buffered = 32 // arbitrary channel buffer size
@@ -75,7 +76,6 @@ func newHandlerFromConfig(ld blobserver.Loader, conf jsonconfig.Obj) (http.Handl
}, nil
}
-
// TODO: figure out a plan for an owner having multiple active public keys, or public
// key rotation
func (h *Handler) Owner() *blobref.BlobRef {
@@ -351,7 +351,6 @@ func (b *DescribedBlob) ContentRef() (br *blobref.BlobRef, ok bool) {
return
}
-
func (b *DescribedBlob) PeerBlob(br *blobref.BlobRef) *DescribedBlob {
if b.Request == nil {
return &DescribedBlob{BlobRef: br, Stub: true}
@@ -410,7 +409,7 @@ func (b *DescribedBlob) jsonMap() map[string]interface{} {
}
type DescribedPermanode struct {
- Attr http.Values // a map[string][]string
+ Attr url.Values // a map[string][]string
}
func (dp *DescribedPermanode) jsonMap() map[string]interface{} {
@@ -642,7 +641,7 @@ func (sh *Handler) serveFiles(rw http.ResponseWriter, req *http.Request) {
}
func (dr *DescribeRequest) populatePermanodeFields(pi *DescribedPermanode, pn, signer *blobref.BlobRef, depth int) {
- pi.Attr = make(http.Values)
+ pi.Attr = make(url.Values)
attr := pi.Attr
claims, err := dr.sh.index.GetOwnerClaims(pn, signer)
diff --git a/lib/go/camli/third_party/code.google.com/goauth2/oauth/oauth.go b/lib/go/camli/third_party/code.google.com/goauth2/oauth/oauth.go
index 5990008b7..ba8c1e380 100644
--- a/lib/go/camli/third_party/code.google.com/goauth2/oauth/oauth.go
+++ b/lib/go/camli/third_party/code.google.com/goauth2/oauth/oauth.go
@@ -44,6 +44,7 @@ import (
"json"
"os"
"time"
+ "url"
)
// Config is the configuration of an OAuth consumer.
@@ -106,23 +107,23 @@ func (t *Transport) transport() http.RoundTripper {
// AuthCodeURL returns a URL that the end-user should be redirected to,
// so that they may obtain an authorization code.
func (c *Config) AuthCodeURL(state string) string {
- url, err := http.ParseURL(c.AuthURL)
+ url_, err := url.Parse(c.AuthURL)
if err != nil {
panic("AuthURL malformed: " + err.String())
}
- q := http.Values{
+ q := url.Values{
"response_type": {"code"},
"client_id": {c.ClientId},
"redirect_uri": {c.redirectURL()},
"scope": {c.Scope},
"state": {state},
}.Encode()
- if url.RawQuery == "" {
- url.RawQuery = q
+ if url_.RawQuery == "" {
+ url_.RawQuery = q
} else {
- url.RawQuery += "&" + q
+ url_.RawQuery += "&" + q
}
- return url.String()
+ return url_.String()
}
// Exchange takes a code and gets access Token from the remote server.
@@ -131,7 +132,7 @@ func (t *Transport) Exchange(code string) (tok *Token, err os.Error) {
return nil, os.NewError("no Config supplied")
}
tok = new(Token)
- err = t.updateToken(tok, http.Values{
+ err = t.updateToken(tok, url.Values{
"grant_type": {"authorization_code"},
"redirect_uri": {t.redirectURL()},
"scope": {t.Scope},
@@ -163,13 +164,13 @@ func (t *Transport) RoundTrip(req *http.Request) (resp *http.Response, err os.Er
}
func (t *Transport) Refresh() os.Error {
- return t.updateToken(t.Token, http.Values{
+ return t.updateToken(t.Token, url.Values{
"grant_type": {"refresh_token"},
"refresh_token": {t.RefreshToken},
})
}
-func (t *Transport) updateToken(tok *Token, v http.Values) os.Error {
+func (t *Transport) updateToken(tok *Token, v url.Values) os.Error {
v.Set("client_id", t.ClientId)
v.Set("client_secret", t.ClientSecret)
r, err := (&http.Client{Transport: t.transport()}).PostForm(t.TokenURL, v)
diff --git a/lib/go/camli/third_party/github.com/mncaudill/go-flickr/flickr.go b/lib/go/camli/third_party/github.com/mncaudill/go-flickr/flickr.go
index b8fa10aff..4233d1b7d 100644
--- a/lib/go/camli/third_party/github.com/mncaudill/go-flickr/flickr.go
+++ b/lib/go/camli/third_party/github.com/mncaudill/go-flickr/flickr.go
@@ -9,6 +9,7 @@ import (
"io/ioutil"
"os"
"sort"
+ "url"
)
const (
@@ -113,12 +114,12 @@ func encodeQuery(args map[string]string) string {
s.WriteString("&")
}
i++
- s.WriteString(k + "=" + http.URLEscape(v))
+ s.WriteString(k + "=" + url.QueryEscape(v))
}
return s.String()
}
-func (request *Request) buildPost(url string, filename string, filetype string) (*http.Request, os.Error) {
+func (request *Request) buildPost(url_ string, filename string, filetype string) (*http.Request, os.Error) {
f, err := os.Open(filename)
if err != nil {
return nil, err
@@ -169,7 +170,7 @@ func (request *Request) buildPost(url string, filename string, filetype string)
postRequest := &http.Request{
Method: "POST",
- RawURL: url,
+ RawURL: url_,
Host: apiHost,
Header: http_header,
Body: r,
@@ -211,7 +212,7 @@ func (r *Request) sendPost(post *http.Request) (body string, err os.Error) {
}
rawBody, err := ioutil.ReadAll(resp.Body)
if err != nil {
- return
- }
+ return
+ }
return string(rawBody), nil
}
diff --git a/server/go/camlistored/publish.go b/server/go/camlistored/publish.go
index 66930bd46..068f10cdd 100644
--- a/server/go/camlistored/publish.go
+++ b/server/go/camlistored/publish.go
@@ -34,6 +34,7 @@ import (
"camli/jsonconfig"
"camli/schema"
"camli/search"
+ "url"
)
// PublishHandler publishes your info to the world, if permanodes have
@@ -251,7 +252,7 @@ func (pr *publishRequest) SubresThumbnailURL(path []*blobref.BlobRef, fileName s
fmt.Fprintf(&buf, "/h%s", br.DigestPrefix(10))
}
fmt.Fprintf(&buf, "/=%s", resType)
- fmt.Fprintf(&buf, "/%s", http.URLEscape(fileName))
+ fmt.Fprintf(&buf, "/%s", url.QueryEscape(fileName))
if maxDimen != -1 {
fmt.Fprintf(&buf, "?mw=%d&mh=%d", maxDimen, maxDimen)
}
@@ -393,12 +394,12 @@ func (pr *publishRequest) serveSubject() {
pr.pf(" \n", pr.staticPath(filename))
}
for _, filename := range pr.ph.JSFiles {
- // TODO(bradfitz): Remove this manual dependency hack once Issue 37 is resolved.
- if filename == "camli.js" {
- pr.pf(" \n", pr.staticPath("base64.js"))
- pr.pf(" \n", pr.staticPath("Crypto.js"))
- pr.pf(" \n", pr.staticPath("SHA1.js"))
- }
+ // TODO(bradfitz): Remove this manual dependency hack once Issue 37 is resolved.
+ if filename == "camli.js" {
+ pr.pf(" \n", pr.staticPath("base64.js"))
+ pr.pf(" \n", pr.staticPath("Crypto.js"))
+ pr.pf(" \n", pr.staticPath("SHA1.js"))
+ }
pr.pf(" \n", pr.staticPath(filename))
if filename == "camli.js" && pr.ViewerIsOwner() {
pr.pf(" \n", pr.base+"?camli.mode=config&cb=onConfiguration")
diff --git a/server/go/camlistored/ui.go b/server/go/camlistored/ui.go
index b51ac11ee..c981c59b6 100644
--- a/server/go/camlistored/ui.go
+++ b/server/go/camlistored/ui.go
@@ -32,6 +32,7 @@ import (
"camli/jsonconfig"
"camli/search"
uistatic "camlistore.org/server/uistatic"
+ "url"
)
var _ = log.Printf
@@ -144,7 +145,7 @@ func newUiFromConfig(ld blobserver.Loader, conf jsonconfig.Obj) (h http.Handler,
func camliMode(req *http.Request) string {
// TODO-GO: this is too hard to get at the GET Query args on a
// POST request.
- m, err := http.ParseQuery(req.URL.RawQuery)
+ m, err := url.ParseQuery(req.URL.RawQuery)
if err != nil {
return ""
}
@@ -254,13 +255,13 @@ func (ui *UIHandler) serveDiscovery(rw http.ResponseWriter, req *http.Request) {
}
discoveryHelper(rw, req, map[string]interface{}{
- "blobRoot": ui.BlobRoot,
- "searchRoot": ui.SearchRoot,
- "jsonSignRoot": ui.JSONSignRoot,
- "uploadHelper": "?camli.mode=uploadhelper", // hack; remove with better javascript
- "downloadHelper": "./download/",
+ "blobRoot": ui.BlobRoot,
+ "searchRoot": ui.SearchRoot,
+ "jsonSignRoot": ui.JSONSignRoot,
+ "uploadHelper": "?camli.mode=uploadhelper", // hack; remove with better javascript
+ "downloadHelper": "./download/",
"directoryHelper": "./tree/",
- "publishRoots": pubRoots,
+ "publishRoots": pubRoots,
})
}
@@ -350,8 +351,8 @@ func (ui *UIHandler) serveFileTree(rw http.ResponseWriter, req *http.Request) {
}
fth := &FileTreeHandler{
- Fetcher: ui.Storage,
- file: blobref,
+ Fetcher: ui.Storage,
+ file: blobref,
}
fth.ServeHTTP(rw, req)
}