Table of Contents |
---|
...
SCSP Method | HTTP Method | RFC 7231 Section |
---|---|---|
SCSP WRITE | POST |
Info |
---|
Write for contextsThe Swarm setting scsp.requireExplicitContextCreate protects content-bearing objects from being created erroneously as contexts (buckets or domains). With this setting enabled, Swarm will not create a context object unless it includes the required header: Content-type: application/castorcontext. (v9.1) |
Info |
---|
S3 compatibilityThe Swarm setting scsp.autoContentMD5Computation improves S3 compatibility by automating Content-MD5 hashing |
...
. the gencontentmd5 query argument or the deprecated Expect: Content-MD5 header does not need to be included on writes (although |
...
a separate Content-MD5 header may want to be supplied for content integrity checking). This setting is ignored wherever it is invalid, such as on a multipart initiate/complete or an EC APPEND. (v9.1) |
WRITE for named objects
If you WRITE a named object that already exists, the The existing object is overwritten with a new version if performing a WRITE of a named object that already exists.
WRITE that overwrites object
Code Block | ||
---|---|---|
| ||
POST /bucket/photo.jpg HTTP/1.1 Host: cluster.example.com User-Agent: Swarm Client/0.1 Content-Length: 43402 Expect: 100-continue Content-Type: image/jpeg Content-Language: en/us, x-pig-latin Content-Version: 42 CRLF [ content ] |
To prevent overwriting an existing object, include Include the If-None-Match: * request header to prevent overwriting an existing object.
If Swarm WRITEs the named object if the named object does not exist, Swarm WRITEs the named object.
If the named object exists, Swarm responds with a 412 Precondition Fail error if the named object exists.
WRITE that prevents overwriting
...
Using PUT Create for named objects
If you want Add the scsp.allowPutCreate=True to the configuration parameters to configure Swarm to allow you to use using the HTTP PUT operation to create new named objects, add the scsp.allowPutCreate=True to your configuration parameters. You . The putcreate query argument can also enable it using the putcreate query argument.
Info |
---|
ExceptionAlthough domains and buckets are named, Swarm processes all PUT requests on these objects as updates, regardless of the setting.
|
Preventing overwriting: If-None-Match
In contrast to an unnamed object, if you WRITE a named object that already exists, the existing object is overwritten with a new version . To prevent overwriting an existing object, include if performing a WRITE of a named object that already exists. Include the If-None-Match: * request header to prevent overwriting an existing object.
If Swarm WRITEs the named object if the named object does not exist, Swarm WRITEs the named object.
If the named object exists, Swarm responds with a 412 Precondition Fail error if the named object exists.
Info |
---|
NoteSwarm returns a 412 error on SCSP WRITE of named objects if the domain or bucket does not exist or cannot be loaded. |
...
Code Block | ||
---|---|---|
| ||
POST / HTTP/1.1 Host: cluster.example.com User-Agent:Swarm Client/0.1 Content-Length: 43402 Expect: 100-continue Content-Type: image/jpeg Content-Language: en/us, x-pig-latin Content-Version: 42 CRLF [ content ] |
If you WRITE an unnamed object, a A new object is created and a new UUID is returned . If you WRITE an alias object, a if performing a WRITE of an unnamed object. A new object is created and a new alias UUID is returned if performing a WRITE of an alias object.
See WRITE for Unnamed Objects.
WRITE for alias objects
To Add alias=yes to create alias objects, add alias=yes:
WRITE for alias object
Code Block | ||
---|---|---|
| ||
POST /?alias HTTP/1.1 Host: cluster.example.com User-Agent: Swarm Client/0.1 |
...
See Working with Large Objects.
Info |
---|
NoteIf you WRITE Swarm returns a 503 Service Unavailable error if performing a WRITE of an object of more than 4 TB in size, Swarm returns a 503 Service Unavailable error. |
WRITE for large files (Expect: 100-continue)
The Expect: 100-continue header tells the server that the client will wait after sending the header lines and before sending the content in the message body. The Swarm server can respond with a redirect or an error response.
If the server is ready to store the contents, it The server returns a 100 Continue response, telling the client to transmit the entity body if the server is ready to store the contents. The client should needs to wait for a 100 Continue response from the server before proceeding to send the data.
If the server is not ready, it The server sends a 413 Request entity too large error response and closes the connection if the server is not ready.
Swarm allows the client to omit the Expect: 100-continue header, sending all the content at once. In response, the The server reads and discards all data if it must respond with a redirect or error. For Swarm logs a warning for WRITE messages that include more than 65536 bytes, Swarm logs a warning:
Error if Expect header is missing
Code Block | ||
---|---|---|
| ||
Please use Expect: 100-continue for large amounts of data. |
If The cluster returns a 507 Insufficient Storage error if any node in the cluster does not have enough space to write the object, the cluster returns a 507 Insufficient Storage error.
Child pages (Children Display) |
---|