If I send a HTTP GET request do I receive the response in GET?
Which method does the server user to respond to the requests it gets?
HTTP is request-response protocol. Irrespective of the HTTP method (GET, POST, HEAD, etc.) you use to make a request to the server, the server always responds in the same way (which has nothing to do with your request method); of course content of response is changed depending on your request.
So there's no such thing as POST or GET responses.
how is the server-upload user-download handled?
When uploading files to a server/service you're sending a request that contains the file itself, the HTTP protocol suggests that you should send data using the POST request.
When downloading files from server, the server will send you file inside the response. You should use the GET request when asking for remote files, as GET is defined as command used for retrieving resources. Also, the type of data being sent is specified in header part of both the request and response as Content-Type
.
Note that you can also upload files using GET, by stuffing the entire file into URL, or download files with response to POST request. However these are non-standard applications and have limitations (for example- limit on maximum length of URL), you would also have a lot more work on the server-side processing these requests.
Does it default to POST for large files?
This should be answered already - server does not send you any POSTs or GETs, just responses.
As a programmer how can I ensure that downloading is easy (resumable) for my end users?
This will depend on both the server-side and client-side technology used. Modern browsers and properly configured web servers generally can resume downloads of existing files automatically. However if you're building the file response manually on the server, you will also need to manually handle the download resume. See this answer for implementation with PHP.
The GET
and POST
are request methods for clients. See comparison.
- GET - Requests data from a specified resource. The query string (name/value pairs) is sent in the URL of a GET request.
- POST - Submits data to be processed to a specified resource. The query string (name/value pairs) is sent in the HTTP message body of a POST request.
The method doesn't change from request to response. The response headers doesn't even mention the method. (Example from this HTTP Basics article.)
HTTP/1.1 200 OK
Date: Sun, 18 Oct 2009 08:56:53 GMT
Server: Apache/2.2.14 (Win32)
Last-Modified: Sat, 20 Nov 2004 07:16:26 GMT
ETag: "10000000565a5-2c-3e94b66c2e680"
Accept-Ranges: bytes
Content-Length: 44
Connection: close
Content-Type: text/html
X-Pad: avoid browser bug
<html><body><h1>It works!</h1></body></html>
Here, the Content-Type
header playes bigger role in identifying what the client should do with the content.