May a URL contain arbitrary binary data in a GET
May a URL contain raw binary data in a GET-request?
Is it possible to create a URL, www.example.com/**binary-data**
, where www.example.com/
are ordinary ASCII characters, and **binary-data**
are arbitrary raw byte-values, eg, 0x10
.
I don't won't to encode the binary data, but just create a string, eg, char*
in C, that contains both the ASCII characters and the binary data.
Or is POST-request the only way to send raw binary data as part of the body?
不,但可以百分比转义非URI字符。
No. A URL transmitted in an HTTP GET request is percent-encoded, UTF-8 encoded Unicode text (resulting in an "ASCII" string).
Again, it's Unicode text.
Unicode encodings do not produce arbitrary binary data. There is no equivalent text for some arbitrary binary data.
Moving away from "raw", the server and request can, of course, agree on the use of a scheme such as Base64 to turn arbitrary binary data into Unicode text. By that point, though, you might as well use an HTTP request with a body, and although as far as HTTP is concerned the bodies are raw binary data, HTTP headers can indicate a standard format. Such requests include POST and PUT.
There are also practical limits to the length of the URL.
链接地址: http://www.djcxy.com/p/42178.html下一篇: 可能URL中包含GET中的任意二进制数据