HTTP and Web Servers
HTTP (Hypertext Transfer Protocol) is the language that web browsers and web servers speak to each other. Example, Request a web page or download a file or watch a video, it is HTTP that makes it possible.
1 — Building Blocks Of HTTP
An HTTP transaction always involves a Client and Server. Loading a page may take many requests sometimes to different servers. Example, When you are reading a News on News Website you are requesting the content from the server where it has been hosted and when you are watching an embedded video from the same page, you may be requesting the video from another web server such as a YouTube Web Server.
A Web address is also called a URI (Uniform Resource Identifier). From a web user’s view, URI is just a piece of text that you put into your web browser that tells it which page to go. URI is made up of several different parts.
is a part of the URI, that tells the browser which web server to connect to. Example, www.twitter.com
The browser has to extract the hostname from the URI, look it up to find the IP Address, and then connect to the right port number on that IP address. Example, 184.108.40.206:700
2 — Web Server and Client Programs Communication
Types of HTTP Requests
Every request contains an HTTP verb or method, which tells the server what the client is asking it to do.
1 — GET
GET is one of many HTTP verbs or methods. This is what browser use whenever they ask a server to send them a copy of a web page or an image or another request. HTTP Response to a GET request is going to be whatever it is that the server has to send back to fulfill the client’s request. That could be a piece of HTML or an image or some other data. The GET method is really for requesting a copy of a resource.
One of the parts a URI can have is a query part.
Most of the time, query parameters don’t get into a URI by the user typing them out into the browser. Query parameters often come from a user submitting in HTML form.
Sending HTTP Request over to the server is defined by HTTP Request Line.
Method Request-Target HTTP-Version
Here GET is the method, URI is the Request-target and HTTP/1.1 is the Version.
2 — POST
Used a lot with Forms. POST is for things that act more or less like a form submission.
Ways to Architect a web app
- Single page apps.
- Apps with a lot of clients logic.
- Apps that are almost entirely on the server.
- Apps with a whole bunch of different servers.
Common Design Pattern for Server side web apps using forms.
POST-REDIRECT-GET is a pattern that says a POST action should always REDIRECT to a GET action. This pattern is meant to provide a more intuitive interface for users, specifically by reducing the number of duplicate form submissions.
A server that accepts requests as a web server, can sometimes make a request as a web client.
3 — PUT
The PUT method completely replaces whatever currently exists at the target URL with something else. With this method, you can create a new resource or overwrite an existing one given you know the exact Request-URI. In short, the PUT method is used to create or overwrite a resource at a particular URL that is known by the client.
4 — PATCH
The PATCH method is a request method supported by the HTTP protocol for making partial changes to an existing resource. The PATCH method provides an entity containing a list of changes to be applied to the resource requested using the HTTP URI. The list of changes is supplied in the form of a PATCH document.
5 — DELETE
HTTP DELETE request method deletes the specified resource.
Syntax: DELETE /file.html HTTP/1.1
3 — Web Hosting, Web Services, and Cookies
URL Shortening — A URL shortener is a Web site that will create a short Uniform Resource Locator (URL) or Web page address from a long one so that the short version, which is easier to remember and enter, can be used instead.
Web Cookies — A small text file (up to 4 KB) created by a website that is stored in the user’s computer either temporarily for that session only or permanently on the hard disk (persistent cookie). Cookies provide a way for the website to recognize you and keep track of your preferences.
Localhost — “Localhost” refers to the local computer that a program is running on. For example, if you are running a Web browser on your computer, your computer is considered to be the “localhost.” … The local machine is defined as “localhost,” which gives it an IP address of 127.0.0.1.
Deployment — In its IT context, deployment encompasses all the processes involved in getting new software or hardware up and running properly in its environment, including installation, configuration, running, testing, and making necessary changes.
Popular Web Servers — These specialized web servers handle a large number of requests very quickly.
- Microsoft IIS
There are a couple of particular headers, that is especially important for web applications.
These Headers are used to store and transmit cookies. An HTTP cookie is a piece of data that a web server asks a browser to store and send back. Cookies are immensely important to many web apps. They make it possible to stay logged in to a website or to associate multiple queries into a single session. And they are also used to track users for advertising purposes.
- An encrypted version of HTTP.
- HTTPS websites have a green lock on the address bar.
- https:// in the URI.
- Originally HTTPs was used to protect the credit card information, passwords, and other high-security information.
- As web security and privacy got more and more important, a lot of major sites started using HTTPs on every connection.
- HTTPs does two really important things.
- It protects your data from the Eavesdroppers (is the act of secretly or stealthily listening to the private conversation or communications of others without their consent) on the network.
- Checks the authenticity of the site you’re talking to.
APIs are a huge part of the modern web, a lot of web applications make use of a server-side part that exposes an API and the client side part that sends queries to that API.
The first version of HTTP didn’t even have a version number on it, but it was later called version 0.9. It only supported GET Requests and expected all Responses to be in HTML and it didn’t even have any Headers.
It added headers, POST Requests for forms, status codes and Content types.
HTTP 1.1 — (1999–2007)
- Improved Caching controls.
- Range Requests (Resuming downloads).
- Transfer encoding (Compression).
- Persistent Connection.
- Chunk Messages.
- Ability to host multiple websites on the same server and IP Address by using the HOST header.
- Much more efficient especially for busy services.
- Multiplexing (Many requests at once).
- Better Compression.
- Server push.
HTTP Status Codes
- 200 — OK, Success
- 301 — Moved Permanently
- 302 — Found, Redirected to new URL
- 304 — Not Modified
- 401 — Unauthorised
- 403 — Forbidden
- 404 — Not Found
- 418 — I’m a Teapot, (April Fool)
- 500 — Internal Server Error
- 504 — Gateway timeout (Timeout loading)
Web hosting is a service that allows organizations and individuals to post a website or web page onto the Internet. A web host, or web hosting service provider, is a business that provides the technologies and services needed for the website or web page to be viewed on the Internet. Websites are hosted or stored, on special computers called servers. When Internet users want to view your website, all they need to do is type your website address or domain into their browser. Their computer will then connect to your server and your web pages will be delivered to them through the browser.
Most hosting companies require that you own your domain in order to host with them. If you do not have a domain, the hosting companies will help you purchase one.
What is Web Service?
Web service is a standardized medium to propagate communication between the client and server applications on the World Wide Web.
Web services provide a common platform that allows multiple applications built on various programming languages to have the ability to communicate with each other.
SOAP — Simple Object Access Protocol
SOAP was developed as an intermediate language so that applications built on various programming languages could talk quickly to each other and avoid the extreme development effort.
WSDL — Web Services Description Language
WSDL is an XML-based file which tells the client application what the web service does and gives all the information required to connect to the web service.
REST — REpresentational State Transfer.
REST is used to build Web services that are lightweight, maintainable, and scalable.
The Concepts cover Introductory level of understanding of HTTP and Web Servers, which is enough to give you a quick start in your work. Thanks for reading and Have a Good Day… 😃. Also don't forget to share with like minded people
Subscribe to get your daily round-up of top tech stories!