state->bytes_received += olen; \
} while (0)
-#define STATUS_CREATED 1900
-#define STATUS_ACCEPTED 1901
-#define STATUS_NO_CONTENT 1902
-#define STATUS_PARTIAL_CONTENT 1903
-
-#define ERR_INVALID_BUCKET_NAME 2000
-#define ERR_INVALID_OBJECT_NAME 2001
-#define ERR_NO_SUCH_BUCKET 2002
-#define ERR_METHOD_NOT_ALLOWED 2003
-#define ERR_INVALID_DIGEST 2004
-#define ERR_BAD_DIGEST 2005
-#define ERR_UNRESOLVABLE_EMAIL 2006
-#define ERR_INVALID_PART 2007
-#define ERR_INVALID_PART_ORDER 2008
-#define ERR_NO_SUCH_UPLOAD 2009
-#define ERR_REQUEST_TIMEOUT 2010
-#define ERR_LENGTH_REQUIRED 2011
-#define ERR_REQUEST_TIME_SKEWED 2012
-#define ERR_BUCKET_EXISTS 2013
-#define ERR_BAD_URL 2014
-#define ERR_PRECONDITION_FAILED 2015
-#define ERR_NOT_MODIFIED 2016
-#define ERR_INVALID_UTF8 2017
-#define ERR_USER_SUSPENDED 2100
-#define ERR_INTERNAL_ERROR 2200
+#define STATUS_CREATED 1900
+#define STATUS_ACCEPTED 1901
+#define STATUS_NO_CONTENT 1902
+#define STATUS_PARTIAL_CONTENT 1903
+
+#define ERR_INVALID_BUCKET_NAME 2000
+#define ERR_INVALID_OBJECT_NAME 2001
+#define ERR_NO_SUCH_BUCKET 2002
+#define ERR_METHOD_NOT_ALLOWED 2003
+#define ERR_INVALID_DIGEST 2004
+#define ERR_BAD_DIGEST 2005
+#define ERR_UNRESOLVABLE_EMAIL 2006
+#define ERR_INVALID_PART 2007
+#define ERR_INVALID_PART_ORDER 2008
+#define ERR_NO_SUCH_UPLOAD 2009
+#define ERR_REQUEST_TIMEOUT 2010
+#define ERR_LENGTH_REQUIRED 2011
+#define ERR_REQUEST_TIME_SKEWED 2012
+#define ERR_BUCKET_EXISTS 2013
+#define ERR_BAD_URL 2014
+#define ERR_PRECONDITION_FAILED 2015
+#define ERR_NOT_MODIFIED 2016
+#define ERR_INVALID_UTF8 2017
+#define ERR_UNPROCESSABLE_ENTITY 2018
+#define ERR_USER_SUSPENDED 2100
+#define ERR_INTERNAL_ERROR 2200
typedef void *RGWAccessHandle;
dout(15) << "supplied_md5=" << supplied_md5 << dendl;
}
+ if (supplied_etag) {
+ strncpy(supplied_md5, supplied_etag, sizeof(supplied_md5));
+ }
+
MD5 hash;
string oid;
multipart = s->args.exists("uploadId");
policy.encode(aclbl);
etag = calc_md5;
+
+ if (supplied_etag && etag.compare(supplied_etag) != 0) {
+ ret = -ERR_UNPROCESSABLE_ENTITY;
+ goto done_err;
+ }
map<string, bufferlist> attrs;
bufferlist bl;
bl.append(etag.c_str(), etag.size() + 1);
{ ERR_USER_SUSPENDED, 401, "UserSuspended" },
{ ERR_INVALID_UTF8, 412, "Invalid UTF8" },
{ ERR_BAD_URL, 412, "Bad URL" },
+ { ERR_UNPROCESSABLE_ENTITY, 422, "UnprocessableEntity" },
};
#define ARRAY_LEN(arr) (sizeof(arr) / sizeof(arr[0]))