Reputation: 3412
I have an assignment at school to build a webserver that handles GET/HEAD/PUT requests, via browser and Telnet, i have a working server handling GET/HEAD and telnet requests but i cant find out how a put request works/looks. I know its used to put content on a webserver but the syntax i cant find=/
-Jonas
Upvotes: 3
Views: 9247
Reputation: 99515
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.
A response to this (if you created a new resource) may be something like this:
HTTP/1.1 201 Created
ETag: ".."
Content-Length: 0
If you updated an existing resource, it could be
HTTP/1.1 204 No Content
ETag: ".."
Content-Length: 0
Or just '200 Ok' if you want to return some more information.
This information is not that hard to find though, just look in the HTTP/1.1 specification.
Upvotes: 4