Repository: minio/minio (language: go)

Issue:
PutObject incompatibility with RFC-7232 and difference to AWS
Per [RFC-7232 §6: precedence](https://datatracker.ietf.org/doc/html/rfc7232#section-6) a `PUT` request should return 412 not 304.
```
 3.  When If-None-Match is present, evaluate the If-None-Match
       precondition:

       *  if true, continue to step 5

       *  if false for GET/HEAD, respond 304 (Not Modified)

       *  if false for other methods, respond 412 (Precondition Failed)
```

However AWS S3 documentation does not explicitly note support for _conditional requests_ for `PutObject`, only on `GetObject` (and some others like `CopyObject`). 
```
GET /Key+?partNumber=PartNumber&response-cache-control=ResponseCacheControl&response-content-disposition=ResponseContentDisposition&response-content-encoding=ResponseContentEncoding&response-content-language=ResponseContentLanguage&response-content-type=ResponseContentType&response-expires=ResponseExpires&versionId=VersionId HTTP/1.1
Host: Bucket.s3.amazonaws.com
If-Match: IfMatch
If-Modified-Since: IfModifiedSince
If-None-Match: IfNoneMatch
If-Unmodified-Since: IfUnmodifiedSince
```

Apparently AWS returns a _not implemented_ response:  https://stackoverflow.com/questions/12654828/amazon-s3-avoid-overwriting-objects-with-the-same-name (?)

## Expected Behavior
Minio should either copy AWS S3, or correctly follow RFC-7232.  Either way differences should be noted in the documentation.

## Current Behavior
⚠️ Running behind Cloudflare tunnels
Minio returns 304:
```
PUT https://...
if-none-match: "afa3a23620d1c15e7081a5bdf6cd5f94"

HTTP 304 Not Modified
```

## Steps to Reproduce (for bugs)
1. Upload a file
2. Re-upload the same file with a `if-none-match` header with matching `ETag`.

## Context
Trying to prevent duplicate uploads of the same content.

## Your Environment
* Version used (`minio --version`): RELEASE.2023-11-20T22-40-07Z
* Server setup and configuration: Docker



Discussion / hints:
We don't intend to change here and comply with AWS S3. 

These headers are necessary for optimistic concurrency.

Will add the 412 instead of 304.

Fix patch:
diff --git a/cmd/object-handlers-common.go b/cmd/object-handlers-common.go
index e84fd26cab609..3feff7b68c06a 100644
--- a/cmd/object-handlers-common.go
+++ b/cmd/object-handlers-common.go
@@ -185,7 +185,7 @@ func checkPreconditionsPUT(ctx context.Context, w http.ResponseWriter, r *http.R
 		if isETagEqual(objInfo.ETag, ifNoneMatchETagHeader) {
 			// If the object ETag matches with the specified ETag.
 			writeHeaders()
-			w.WriteHeader(http.StatusNotModified)
+			writeErrorResponse(ctx, w, errorCodes.ToAPIErr(ErrPreconditionFailed), r.URL)
 			return true
 		}
 	}


Test patch: