Connection-Less
Only one request per one connection
StateLess
The protocol has no memory of transaction, and the server does not know what state the client is.
Two ways to maintain HTTP connection:
Cookie | Session | |
---|---|---|
Definition | Cookies are client-side files that are stored on a local computer and contain user information. | Sessions are server-side files that store user information. |
Expiry | Cookies expire after the user specified lifetime. | The session ends when the user closes the browser or logs out of the program. |
Data storage | It can only store a limited amount of data. | It is able to store an unlimited amount of information. |
Function | It is not necessary for us to execute a function in order to get cookies going because they are stored on the local computer. | Utilizing the session start() method is required before we can begin the session. |
Data Format | Cookies are used to store information in a text file. | The data is saved in an encrypted format during sessions. |
Informational
100 - Continue
Success
200 - OK
201 - Created
204 - No Content
Redirection
301 - Moved Permanently
304 - Not Modified
Client Error
400 - Bad Request
401 - Unauthorized
403 - Forbidden
404 - Not Found
Server Error
500 - Internal Server Error
502 - Bad Gateway
GET
requests the specified page information.POST
submits data (such as submitting forms or uploading files). The data is included in the request body.PUT
replaces the content of the specified document.DELETE
deletes the specified page.GET
is used to retrieve remote data and POST
is used to insert/update remote data.GET
encodes parameters in url (not safe) and POST
includes data in body.GET
sends once, POST
sends header first (return 100) and sends real data (return 200).Use HTTP header Range
and Content-Range
:
Range:bytes=512000-
, which informs the server to transfer files from the 512K location of the file.Content-Range:bytes 512000-/1024000
, and the HTTP status code returned by the server should be 206.