POST /add-user.php HTTP/1.1
Host: www.example.com
Content-Length: 27
Content-Type: application/x-www-form-urlencoded
...
And the payload:
firstName=John&lastName=Doe
As you can see, the
Content-Type
header is different, indicating that the encoding of the values in the payload is different.
HTTP status codes
A server should answer all requests with an HTTP status code. This is a 3-digit number indicating if the request was successful or
telling the client what went wrong. Here's a table with some of the most important and useful ones.
Status Code
Meaning
200
OK: the request was successful
303
See Other: used to redirect to a different URI, after a POST request, for instance
400
Bad Request: the server couldn't understand the request, because the syntax was incorrect
401
Unauthorized: user authentication is required
403
Forbidden: the server refuses to execute the request, authorization won't help
404
Not Found: the requested URI was not found
500
Internal Server Error: The server encountered an unexpected condition and couldn't fulfill the request
TCP & UDP Ports
In most cases, one device has many different services, for example, a web server, an email server, an FTP server, a Spotify streaming
service, ...
If the device had just an IP address, it would be impossible to know which application a packet was sent to. That's why every service
has a port number. It's an identifier for all different services or applications on a single device. In the example above, the web server
will only listen for requests on port 80, the email server only on port 25, the FTP server only on port 20, Spotify will only receive
streams on port 4371 ...
To specify a certain port, you can use a colon after the IP address of after the domain name. But most of the time, you don't have to
add it explicitly. For example, all web servers listen on port 80, so a web browser will always connect to port 80.
http://stackoverflow.com/questions/176264/what-is-the-difference-between-a-uri-a-url-and-a-urn
https://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html
https://en.wikipedia.org/wiki/List_of_HTTP_status_codes