Introduction To HTTP - Understanding HTTP Basics
Introduction To HTTP - Understanding HTTP Basics
HTTP stands for hypertext transfer protocol and is used to transfer data across the Yes
Web. No
It is a critical protocol for web developers to understand and because of it widespread use it is also used in Vote
To give you an idea of how simple the HTTP protocol started out take a look at the Original specification
which was only 1 page.
There have been several versions of HTTP starting with the original 0.9 version.
The current version is 1.1 and was last revised in 2014. See Wiki for more details.
How It Works
Like most of the Internet protocols http it is a command and response text based protocol using a client Search
server communications model.
Search …
Subscribe to Newsletter
Name*
Email*
Subscribe
The presence of a message body in a request is signalled by a Content-Length or Transfer-Encoding header field.
Request message framing is independent of method semantics, even if the method does not define any use for a
node-red
message body. – RFC 7230 section 3.3.
MQTT Brokers
mqtt and python
Note: the message body is not followed by a CRLF See RFC 7230 section 3.5
Internet
HTTP Requests
We saw the general request response format earlier now we will cover the request message in more detail.
Where
Notes:
Note: URL (uniform resource Locator) is used for web pages. It is an example of a URI (uniform resource
indicator).
The actual http request is not shown by the browser, and is only visible using special tools like http
header live (Firefox).
HTTP vs URL
Most people are familiar with entering a url into a web browser. Usually looking like this.
The url can also includes the port which is normally hidden by the browser, but you can manually include
it as shown below:
This tells the web browser the address of the resource to locate and the protocol to use to retrieve that
resource (http).
http is the transfer protocol that transfer the resource (web page,image,video etc) from the server to the
client.
Response Status codes are split into 5 groups each group has a meaning and a three digit code.
1xx – Informational
2xx – Successful
3xx -Multiple Choice
4xx– Client Error
5xx -Server Error
For example a successful page request will return a 200 response code and an unsuccessful a 400
response code.
and here is a screen shot of the http request-response that happens behind the scenes.
Notice the request headers are automatically inserted by the browser, and so are the response headers
are inserted by the web server.
There is no body content in the request. The body content in the reply is a web page, and is shown in the
browser, and not by the live headers tool.
Request Types
So far we haven’t mentioned request types, but we have seen the GET request type in our examples.
The GET request type or method is used for requesting a resource from a web server.
GET is most commonly used request type and was the only request type in the Original HTTP specification.
On the Internet today the GET (getting web pages) and POST (submitting web forms)methods are the
ones most commonly used.
The Other methods are used when working with Web and IOT APIs specifically put,delete and head.
There is a good basic overview on w3 schools, and the Microsoft MDN site covers them in more detail.
7 comments
Pirulino says:
April 30, 2020 at 5:43 pm
Reply
Vikas says:
February 17, 2020 at 3:44 pm
What headers are compulsory to add when sending a request? I know HOST: and CONNECTION: has to be added,
question is what if I don’t add USER-AGENT etc?
Reply
steve says:
February 17, 2020 at 5:41 pm
Hi
I believe Host is the only required header.If you don’t supply the headers required by the application then you
may not get the desired response.
Reply
Akhil says:
August 25, 2019 at 6:26 pm
Thanks for the information. What does CRLF stand for? And what does it mean?
Reply
steve says:
August 26, 2019 at 10:08 am
Reply
Waleed says:
August 7, 2019 at 5:06 am
Why is HTTP version number presented in both a request line and a statue line
Reply
steve says:
August 7, 2019 at 3:09 pm
It is in the request and response and indicates the version used by the browser and the version supported by
the server.
Reply
Leave a Reply
Your email address will not be published. Required fields are marked *
Comment
Name *
Email *
Website
Post Comment
Sign Up to Newsletter