diff --git a/blobserver/go/camlistored.go b/blobserver/go/camlistored.go index ab46b1aab..0a06bc36e 100644 --- a/blobserver/go/camlistored.go +++ b/blobserver/go/camlistored.go @@ -14,7 +14,8 @@ import "io" import "io/ioutil" import "os" import "regexp" -import "mime/multipart" + +// import "mime/multipart" // import multipart "github.com/bradfitz/golang-mime-multipart" var listen *string = flag.String("listen", "0.0.0.0:3179", "host:port to listen on") @@ -24,8 +25,8 @@ var putPassword string var kGetPutPattern *regexp.Regexp = regexp.MustCompile(`^/camli/(sha1)-([a-f0-9]+)$`) var kBasicAuthPattern *regexp.Regexp = regexp.MustCompile(`^Basic ([a-zA-Z0-9\+/=]+)`) -var kMultiPartContentPattern *regexp.Regexp = regexp.MustCompile( - `^multipart/form-data; boundary="?([^" ]+)"?`) + +var kBlobRefPattern *regexp.Regexp = regexp.MustCompile(`^([a-z0-9]+)-([a-f0-9]+)$`) type BlobRef struct { HashName string @@ -41,7 +42,7 @@ func ParsePath(path string) *BlobRef { if obj.HashName == "sha1" && len(obj.Digest) != 40 { return nil } - return obj; + return obj } func (o *BlobRef) IsSupported() bool { @@ -73,7 +74,7 @@ func (o *BlobRef) FileName() string { func badRequestError(conn *http.Conn, errorMessage string) { conn.WriteHeader(http.StatusBadRequest) - fmt.Fprintf(conn, "%s\n", errorMessage) + fmt.Fprintf(conn, "%s\n", errorMessage) } func serverError(conn *http.Conn, err os.Error) { @@ -98,7 +99,7 @@ func putAllowed(req *http.Request) bool { password := string(outBuf) fmt.Println("Decoded bytes:", bytes, " error: ", err) fmt.Println("Got userPass:", password) - return password != "" && password == putPassword; + return password != "" && password == putPassword } func getAllowed(req *http.Request) bool { @@ -110,7 +111,7 @@ func handleCamliForm(conn *http.Conn, req *http.Request) { fmt.Fprintf(conn, `
-