Basic information for HTTP and HTML

2 minute read

If you use web programming, you need basic knowledge about http protocol. Google, Amazon, and others offer a variety of web APIs. Coin Exchange also uses a lot of web sockets. I think, the start of the web is best done at http. Let’s get started.

HTTP(HyperText Transfer Protocol)

List of HTTP header fields

Wiki : List of HTTP header fields

Link : HTTP headers

HTTP headers let the client and the server pass additional information with an HTTP request or response. An HTTP header consists of its case-insensitive name followed by a colon (:), then by its value. Whitespace before the value is ignored.

Header fields are colon-separated key-value pairs in clear-text string format, terminated by a carriage return (CR) and line feed (LF) character sequence. The end of the header section is indicated by an empty field(line), resulting in the transmission of two consecutive CR-LF pairs.

In the past, long lines could be folded into multiple lines; continuation lines are indicated by the presence of a space (SP) or horizontal tab (HT) as the first character on the next line. This folding is now deprecated.

Header field names are case-insensitive. This is in contrast to HTTP method names (GET, POST, etc.), which are case-sensitive.

HTTP response status codes

Link : HTTP response status codes

  • 100–199 : Informational responses
  • 200–299 : Successful responses
  • 300–399 : Redirects
  • 400–499 : Client errors
  • 500–599 : Server errors

100 Continue

This interim response indicates that everything so far is OK and that the client should continue the request, or ignore the response if the request is already finished.

200 OK

The request has succeeded. The meaning of the success depends on the HTTP method: GET: The resource has been fetched and is transmitted in the message body. HEAD: The entity headers are in the message body. PUT or POST: The resource describing the result of the action is transmitted in the message body. TRACE: The message body contains the request message as received by the server

400 Bad Request

The server could not understand the request due to invalid syntax.

401 Unauthorized

Although the HTTP standard specifies “unauthorized”, semantically this response means “unauthenticated”. That is, the client must authenticate itself to get the requested response.

404 Not Found

The server can not find requested resource. In the browser, this means the URL is not recognized. In an API, this can also mean that the endpoint is valid but the resource itself does not exist. Servers may also send this response instead of 403 to hide the existence of a resource from an unauthorized client. This response code is probably the most famous one due to its frequent occurrence on the web.

408 Request Timeout

This response is sent on an idle connection by some servers, even without any previous request by the client. It means that the server would like to shut down this unused connection. This response is used much more since some browsers, like Chrome, Firefox 27+, or IE9, use HTTP pre-connection mechanisms to speed up surfing. Also note that some servers merely shut down the connection without sending this message.

500 Internal Server Error

The server has encountered a situation it doesn’t know how to handle.

HTML(HyperText Markup Language)

<!DOCTYPE html>
<html>
  <head>
    <title>This is title of this page.</title>
  </head>
  <body>
    <h1>Title of each page</h1>
    <p>This is paragraph</p>
    <div></div>
    <pre></pre>
  </body>
</html>

Tags: ,

Categories:

Updated:

Leave a comment