Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

HTTP PUT request, how can i generate one and where can i find examples/syntax?

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

like image 299
Sultanen Avatar asked Dec 05 '25 05:12

Sultanen


1 Answers

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.

like image 135
Evert Avatar answered Dec 09 '25 00:12

Evert



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!