HTTP PUT request, how can I create it, and where can I find examples / syntax?
I have an assignment in school to build a web server that handles GET / HEAD / PUT requests through browser and Telnet, I have a working server that handles GET / HEAD and telnet requests, but I can't figure out how the request request works / looks like. I know he used to post content on a web server, but the syntax I cant find = /
-Jonas
+3
Sultanen
source
to share
1 answer
PUT /urlofnewresource HTTP/1.1
Content-Length: xxx
Host: example.org
Connection: close
Any-Other-Header: ..
Contents. This can be any binary or text file.
The answer to this (if you've created a new resource) might be something like this:
HTTP/1.1 201 Created
ETag: ".."
Content-Length: 0
If you've updated an existing resource, it might be
HTTP/1.1 204 No Content
ETag: ".."
Content-Length: 0
Or just "200 Ok" if you want to return additional information.
This information isn't that hard to find, just take a look at the HTTP / 1.1 specification.
+2
Evert
source
to share