For certain requests (see Requests that Support UTF-8) you can use UTF-8 character encoding in headers that specify paths and file names. When you use UTF-8 character encoding, you must include the X-Agile-Encoding header in your requests, like so:
1X-Agile-Encoding: UTF8
The header is optional and encoding defaults to US ASCII.
If you supply an invalid encoding, Origin Storage returns a 400 HTTP Status Code with reason -51, invalid coding.
Notes:
- All path name and file name headers also support US ASCII.
- Although the JSON-RPC interface supports UTF-8, the interface uses unicode escaping rather than URL encoding. For example,
файлы
is\\u0444\\u0430\\u0439\\u043b\\u044b
.
Requests that Support UTF-8
The following requests support UTF-8 and the X-Agile-Encoding header:
Request | Headers in the Request that Support UTF-8 |
---|---|
Create multipart (multipart/create) | X-Agile-Directory , X-Agile-Basename |
Post Raw (post/raw) See File Raw Post. | X-Agile-Directory , X-Agile-Basename request parametersX-Agile-Path response parameter |
Notes:
- Create multipart piece (
multipart/piece
) and complete multipart (multipart/complete
) do not require UTF-8 encoding because they do not allow the caller to pass file names. - Origin Storage path segment names and file names have a limit of 4096 bytes. Because UTF-8 is supported, be sure to calculate the actual length before passing paths and file names in headers if you are using other than basic Latin letters, digits, and punctuation signs. See Path Segment and File Name Limitations for additional information.
Request and Response Example
Here is a sample request using UTF-8 encoding:
1POST /post/raw HTTP/1.12User-Agent: curl/7.22.0 (x86_64-pc-linux-gnu) libcurl/7.22.0 OpenSSL/1.0.1 zlib/1.2.3.4 libidn/1.23 librtmp/2.33Host: example.net:80804Accept: */*5X-Agile-Authorization: d9e89ef8-fe07-4b6a-8cc5-bc03e4d1ce426X-Agile-Directory: /7X-Agile-Basename: test%20file.txt8X-Agile-Encoding: UTF89Content-Length: 2910Content-Type: application/x-www-form-urlencoded11[29 bytes of data]
Here is a sample response:
1HTTP/1.1 200 OK2Date: Tue, 03 Feb 2015 22:40:42 GMT3Server: Apache/2.2.22 (Ubuntu)4X-Agile-Status: 05Content-Length: 06X-Agile-Checksum: 6908750bc780002d195e362de56a77ad79bbc36091159032763b4387cdb0fca57X-Agile-Size: 298X-Agile-Path: /test%20file.txt9Vary: Accept-Encoding10Content-Type: text/xml;charset=utf-8