From bb3c33131e6ab75485696c1379d8bdf5f9ca8e7d Mon Sep 17 00:00:00 2001 From: Brad Fitzpatrick Date: Wed, 21 Jul 2010 20:16:59 -0700 Subject: [PATCH] correct uploadUrl in preupload --- blobserver/go/camlistored.go | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/blobserver/go/camlistored.go b/blobserver/go/camlistored.go index 18baa2bdd..1db75e022 100644 --- a/blobserver/go/camlistored.go +++ b/blobserver/go/camlistored.go @@ -292,8 +292,17 @@ func handlePreUpload(conn *http.Conn, req *http.Request) { ret := make(map[string]interface{}) ret["maxUploadSize"] = 2147483647 // 2GB.. *shrug* ret["alreadyHave"] = haveVector.Copy() - ret["uploadUrl"] = "http://localhost:3179/camli/upload" ret["uploadUrlExpirationSeconds"] = 86400 + + if len(req.Host) > 0 { + scheme := "http" // TODO: https + ret["uploadUrl"] = fmt.Sprintf("%s://%s/camli/upload", + scheme, req.Host) + } else { + ret["uploadUrl"] = "/camli/upload" + } + + returnJson(conn, ret) }