Fundamentals of HTTP protocol part I

HTTP stands for Hypertext Transfer Protocol and it is the protocol used for communication over the World Wide Web. The main idea that HTTP brings to the table is to allow two-way conversation between web Clientes and web servers. Billions of JPEG images, HTML pages, text files, MPEG movies, Java applets, audio files, and more are being carried out across the internet through HTTP protocol. HTTP moves the bulk of this information conveniently, and reliably from web servers all around the world to web clients.

HTTP is based on TCP protocol when data are being sent HTTP make sure that the data that are being sent will not be damaged or scrambled in transit, even when it comes from the other side of the globe.

The concept around Web clients and Servers

Web content lives on web servers and web servers speak the HTTP protocol, so they are often called HTTP servers. Web servers are there for web client requests and these requests are made via HTTP verbs which are GET, POST, PUT, DELETE, PATCH.

Probably you have been using HTTP clients or Web clients every day. The most common client is a web browser, such as Google Chrome or Firefox. Web clients request HTTP objects from HTTP servers and display the objects on the screen.

Web Resources

Resources are hosted on web servers and a web resource is the source of web content. The simplest kind of web resource is a static file on the web server's filesystem and these files can contain anything: they might be HTML, CSS, text files, or even images such as JPEG, PNG images, etc.

Though resources don't have to be static files, they can also be software programs that generate content on demand for instance Java Applets.

Media Types

Because Web recourses can be many thousands of different data types, HTTP carefully tags each object being transported through the web with a data format label called MIME type.

MIME stands for Multipurpose Internet Mail Extensions and was originally designed to solve a problem encountered in moving messages between different electronic mail systems. MIME types are most commonly found in the headers of HTTP messages to describe the content that an HTTP server is responding with or the formatting of the data that is being posted in a request) We can find also MIME types in email headers to describe the message format and attachments.

MIME types are case insensitive , but traditionally everything is written in lower case, bellow we have some MIME types examples:

text/plain
text/html
image/jpeg
image/png
audio/mpeg
audio/ogg
audio/*
video/mp4
application/octet-stream
…

URIs

URI stands for Uniform Resource Identifier and there are two types of URI: Uniform Resource Locator (URL) and Uniform Resource Name. In nutshell, URI is a unique identifier used by web clients to point out what resources they are interested in from web server contents. Bellow, we have a URI example for an image resource on sample.com web server:

www.sample.com/images/logo.jpg

URLs

URL stands for Uniform Resource Locator, it describes the specific location of a resource on a particular server. They tell you the path to fetch a resource from a precise, fixed location.

Example URLs

www.sample.com/index.html
www.sample.com/products
www.sample.com/images/logo.jpg

URNs

URN stands for Uniform Resouce Name it serves as a unique name for a particular piece of content, independent of where the resource currently resides and it always starts with the prefix urn, for example.

urn:isbn:0451450523 to identify a book by its ISBN number.

Conclusion

The Web speak HTTP and HTTP is based on TCP. using HTTP for web requests is safe because the message will not lose, damage, or scrambled in the process of transactions.

Finally, in order to establish communication between the web server and the client we need URIs. Web client, they point to resources that are interested in from web server through URLs or URNs by that we can make a request to send ou get a differents objects from web servers and MIME types can help to clarify the request message since we may request different object format

No Comments Yet