0% found this document useful (0 votes)
44 views

Web Working Principles

The document discusses several key concepts related to how the web works: 1. Browsers send HTTP requests to servers and receive HTTP responses containing web page content. 2. DNS servers resolve domain names to IP addresses so browsers can connect to the correct server. 3. The client-server model describes how servers provide resources to multiple clients simultaneously over the Internet.

Uploaded by

Arul Deepa
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
44 views

Web Working Principles

The document discusses several key concepts related to how the web works: 1. Browsers send HTTP requests to servers and receive HTTP responses containing web page content. 2. DNS servers resolve domain names to IP addresses so browsers can connect to the correct server. 3. The client-server model describes how servers provide resources to multiple clients simultaneously over the Internet.

Uploaded by

Arul Deepa
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 5

Web working principles

Every time you open your browsers, type some URLs and press enter, you will see beautiful web
pages appear on your screen. But do you know what is happening behind these simple actions?

Normally, your browser is a client. After you type a URL, it takes the host part of the URL and
sends it to a Domain Name Server (DNS) in order to get the IP address of the host. Then it
connects to the IP address and asks to setup a TCP connection. The browser sends HTTP
requests through the connection. The server handles them and replies with HTTP responses
containing the content that make up the web page. Finally, the browser renders the body of the
web page and disconnects from the server.

A web server, also known as an HTTP server, uses the HTTP protocol to communicate with
clients. All web browsers can be considered clients.

We can divide the web's working principles into the following steps:

● Client uses TCP/IP protocol to connect to server.


● Client sends HTTP request packages to server.
● Server returns HTTP response packages to client. If the requested resources include
dynamic scripts, server calls script engine first.
● Client disconnects from server, starts rendering HTML.

This is a simple work flow of HTTP affairs -notice that the server closes its connections after it
sends data to the clients, then waits for the next request.

URL and DNS resolution


We always use URLs to access web pages, but do you know how URLs work?
The full name of a URL is Uniform Resource Locator.
DNS is an abbreviation of Domain Name System. It's the naming system for computer network services,
and it converts domain names to actual IP addresses, just like a translator.

To understand more about its working principle, let's see the detailed DNS resolution process as
follows.

1. After typing the domain name www.qq.com in the browser, the operating system will
check if there are any mapping relationships in the hosts' files for this domain name. If
so, then the domain name resolution is complete.
2. If no mapping relationships exist in the hosts' files, the operating system will check if any
cache exists in the DNS. If so, then the domain name resolution is complete.
3. If no mapping relationships exist in both the host and DNS cache, the operating system
finds the first DNS resolution server in your TCP/IP settings, which is likely your local
DNS server. When the local DNS server receives the query, if the domain name that you
want to query is contained within the local configuration of its regional resources, it
returns the results to the client. This DNS resolution is authoritative.
4. If the local DNS server doesn't contain the domain name but a mapping relationship
exists in the cache, the local DNS server gives back this result to the client. This DNS
resolution is not authoritative.
5. If the local DNS server cannot resolve this domain name either by configuration of
regional resources or cache, it will proceed to the next step, which depends on the local
DNS server's settings. -If the local DNS server doesn't enable forwarding, it routes the
request to the root DNS server, then returns the IP address of a top level DNS server
which may know the domain name, .com in this case. If the first top level DNS server
doesn't recognize the domain name, it again reroutes the request to the next top level
DNS server until it reaches one that recognizes the domain name. Then the top level DNS
server asks this next level DNS server for the IP address corresponding to www.qq.com. -
If the local DNS server has forwarding enabled, it sends the request to an upper level
DNS server. If the upper level DNS server also doesn't recognize the domain name, then
the request keeps getting rerouted to higher levels until it finally reaches a DNS server
which recognizes the domain name.

Whether or not the local DNS server enables forwarding, the IP address of the domain name
always returns to the local DNS server, and the local DNS server sends it back to the client.

Client-Server Model
The client-server model describes how a server provides resources and services to one or more
clients. Examples of servers include web servers, mail servers, and file servers. Each of these
servers provide resources to client devices, such as desktop computers, laptops, tablets, and
smartphones. Most servers have a one-to-many relationship with clients, meaning a single server
can provide resources to multiple clients at one time.
When a client requests a connection to a server, the server can either accept or reject the
connection. If the connection is accepted, the server establishes and maintains a connection with
the client over a specific protocol. For example, an email client may request an SMTP
connection to a mail server in order to send a message. The SMTP application on the mail server
will then request authentication from the client, such as the email address and password. If these
credentials match an account on the mail server, the server will send the email to the intended
recipient.

While Internet servers typically provide connections to multiple clients at a time, each physical machine
can only handle so much traffic. Therefore, popular online services distribute clients across multiple
physical servers, using a technique called distributed computing. In most cases, it does not matter which
specific machine users are connected to, since the servers all provide the same service.

HTTP protocol
HTTP messages are how data is exchanged between a server and a client. There are two types
of messages: requests sent by the client to trigger an action on the server, and responses, the
answer from the server.

The HTTP protocol is a core part of web services. It's important to know what the HTTP
protocol is before you understand how the web works.
HTTP is the protocol that is used to facilitate communication between browser and web server. It
is based on the TCP protocol and usually uses port 80 on the side of the web server. It is a
protocol that utilizes the request-response model -clients send requests and servers respond.
According to the HTTP protocol, clients always setup new connections and send HTTP requests
to servers. Servers are not able to connect to clients proactively, or establish callback
connections. The connection between a client and a server can be closed by either side. For
example, you can cancel your download request and HTTP connection and your browser will
disconnect from the server before you finish downloading.
The HTTP protocol is stateless, which means the server has no idea about the relationship
between the two connections even though they are both from same client. To solve this problem,
web applications use cookies to maintain the state of connections.
Because the HTTP protocol is based on the TCP protocol, all TCP attacks will affect HTTP
communications in your server. Examples of such attacks are SYN flooding, DoS and DDoS
attacks.

Concepts in web principles


Request: request data from users, including POST, GET, Cookie and URL.
Response: response data from server to clients.
Conn: connections between clients and servers.
Handler: Request handling logic and response generation.

1. Create a listening socket, listen to a port and wait for clients.


2. Accept requests from clients.
3. Handle requests, read HTTP header. If the request uses POST method, read data in the
message body and pass them to handlers. Finally, socket returns response data to clients.

Once we know the answers to the three following questions, it's easy to know how the web
works in Go.

● How do we listen to a port?


● How do we accept client requests?
● How do we allocate handlers?
Web Browser
web Browser is an application software that allows us to view and explore information on the
web. User can request for any web page by just entering a URL into address bar.
Web browser can show text, audio, video, animation and more. It is the responsibility of a web
browser to interpret text and commands contained in the web page.
Earlier the web browsers were text-based while now a days graphical-based or voice-based web
browsers are also available. Following are the most common web browser available today:
Browser Vendor
Internet Explorer Microsoft
Google Chrome Google
Mozilla Firefox Mozilla
Netscape Netscape Communications
Navigator Corp.
Opera Opera Software
Safari Apple
Sea Monkey Mozilla Foundation
K-meleon K-meleon

Architecture
There are a lot of web browser available in the market. All of them interpret and display
information on the screen however their capabilities and structure varies depending upon
implementation. But the most basic component that all web browser must exhibit are listed
below:

● Controller/Dispatcher

● Interpreter

● Client Programs

Controller works as a control unit in CPU. It takes input from the keyboard or mouse, interpret
it and make other services to work on the basis of input it receives.
Interpreter receives the information from the controller and execute the instruction line by line.
Some interpreter are mandatory while some are optional For example, HTML interpreter
program is mandatory and java interpreter is optional.
Client Program describes the specific protocol that will be used to access a particular service.
Following are the client programs tat are commonly used:

● HTTP

● SMTP

● FTP

● NNTP

● POP

You might also like