correct uploadUrl in preupload

This commit is contained in:
Brad Fitzpatrick 2010-07-21 20:16:59 -07:00
parent dfc79a96fd
commit bb3c33131e
1 changed files with 10 additions and 1 deletions

View File

@ -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)
}