UNInT-I - WP - Notes Biks
UNInT-I - WP - Notes Biks
UNInT-I - WP - Notes Biks
Web Programming
Prepared by
Keerthana R
AP/CSE
KSRCE
DNS-Domain Name Systems
• The Domain Name System (DNS) is like the internet’s phone book. It helps you
find websites by translating easy-to-remember names (like www.example.com)
into the numerical IP addresses (like 192.0.2.1) that computers use to locate each
other on the internet.
• Without DNS, you would have to remember long strings of numbers to visit your
favorite websites.
• Domain Name System (DNS) is a hostname used for IP address translation
services.
• DNS is a distributed database implemented in a hierarchy of name servers. It is an
application layer protocol for message exchange between clients and servers.
• It is required for the functioning of the Internet.
What is the Need for DNS?
• The client machine sends a request to the local name server, which, if
the root does not find the address in its database, sends a request to the
root name server, which in turn, will route the query to a top-level
domain (TLD) or authoritative name server.
• The root name server can also contain some hostName to IP address
mappings. The Top-level domain (TLD) server always knows who the
authoritative name server is.
• So finally the IP address is returned to the local name server which in
turn returns the IP address to the host.
cont
URL
• URL is the abbreviation of Uniform Resource Locator. It is the
resource address on the internet. The URL (Uniform Resource
Locator) is created by Tim Berners-Lee and the Internet Engineering
working group in 1994. URL is the character string (address) which is
used to access data from the internet. The URL is the type of URI
(Uniform Resource Identifier).
Cont.
• A URL contains the following information which is listed below:
• Protocol name
• A colon followed by double forward-slash (://)
• Hostname (domain name) or IP address
• A colon followed by port number (optional – unless specified otherwise, “:80” is
the default when using HTTP, and “:443” is the default when using HTTPS)
• Path of the file
Syntax of the URL:
• Protocol://hostname/filename
WWW
• The World Wide Web (WWW) is a system of interconnected documents and
resources, like websites and web pages, that can be accessed via the internet.
Here's a simple breakdown:
• Webpages: These are the documents or files you see online. They can contain
text, images, videos, and more.
• Websites: A collection of related web pages, often all part of the same domain
(like "example.com").
• Browser: A software application like Chrome, Firefox, or Safari that you use
to view web pages.
• Links: Clickable text or images that take you from one webpage to another.
• In short, the WWW allows people to navigate between pages on the internet
using web browsers and links. It is part of the internet but specifically refers to
the collection of linked documents accessible through web browsers.
Cont..
• Web Protocols: The WWW uses specific rules called protocols to allow
computers to communicate. The main one is HTTP (Hypertext Transfer Protocol),
which enables web browsers and servers to talk to each other. There's also
HTTPS, which adds a layer of security for encrypted data transmission.
• URL (Uniform Resource Locator): This is the address of a webpage (like "
https://www.example.com"). It tells the browser where to find the page on the
internet.
• HTML (Hypertext Markup Language): The language used to structure web
pages. It tells your browser how to display text, images, links, and other content.
• Servers and Clients: When you type a URL into a browser and hit enter, your
computer (the client) sends a request to a web server. The server processes the
request and sends back the webpage, which your browser then displays.
HTTP:Request
• An HTTP (Hypertext Transfer Protocol) request is a fundamental part of web
communications, forming the basis of data exchange on the internet. It’s a
protocol used for fetching resources, such as HTML documents, images, and other
files, from web servers. The communication between a client (like a web browser)
and a server occurs through these HTTP requests.
Working:
• Request Line: An HTTP request starts with a request line, which includes the
following:
• Method: This indicates the action to be performed on the resource. Common
methods include GET (retrieve a resource), POST (submit data to the server), PUT
(update a resource), DELETE (remove a resource), and others.
• Request URL: The URL of the resource being requested.
• HTTP Version: The version of the HTTP protocol being used.
• Request Headers: Following the request line are headers, which provide additional
information about the request. This can include details about the client’s browser,
the types of responses that the client will accept, cookies, and more.
• Blank Line: A blank line indicates the end of the headers section.
• Request Body (Optional): Not all requests have a body. Bodies are typically included
in POST or PUT requests, where you’re sending data to the server (like form inputs
or file uploads). The body contains the data being sent.
The structure of HTTP requests
HTTP response
• An HTTP response is what a server sends back to the client after receiving and
processing an HTTP request. It is a key part of the data exchange in web
communications, essentially being the server’s answer to the client’s request.
Here’s a breakdown of the components of an HTTP response:
Working:
• Status Line: This is the first line of the response and includes:
• HTTP Version: Indicates the HTTP protocol version used (e.g., HTTP/1.1).
• Status Code: A three-digit number that indicates the outcome of the request.
Common status codes include 200 (OK, request succeeded), 404 (Not Found, the
resource can’t be found), 500 (Internal Server Error), etc.
• Status Text: A brief, human-readable explanation of the status code (e.g., OK, Not
Found, Internal Server Error).
Cont..
• Response Headers: These are key-value pairs providing additional information
about the response. They can include details such as the server type, content
type, content length, caching policies, set cookies, and other metadata.
• Blank Line: A blank line signifies the end of the header section.
• Response Body: This part of the response contains the actual data or resource that
the client requested. For example, it could be an HTML file, JSON data, an image,
etc. In some cases, particularly when the response indicates an error (like a 404),
the body might contain a message explaining the error.
Web Clients and Web Servers:
• A Web client is an application installed on the user’s device that they can use to
surf the internet. Web clients request computer servers for a webpage but don’t
store them.
• Without these clients, an ordinary user can’t use the internet. When you search for
a particular webpage through your browser, it retrieves the page from the
appropriate server and displays the result. The client and server communicate via
HTTP(Hypertext Transfer Protocol).
• You can think of the HTTP protocol as the language of the web. It enables
networked devices to send and receive traffic using a set of simple rules.
However, there’re other types of protocols, such as SSH(Secure Shell), FTP(File
Transfer Protocol) and SMTP(Simple Mail Transfer Protocol).
Features of Web Clients
• These days, all web browsers offer some standard features which aim to make
internet browsing easier for us. In short, your choice of web client should feature
some of the following.
• Support for private/incognito browsing.
• VPN or Proxy support.
• Multiple tabs or windows.
• Back/Previous and Forward buttons.
• Home, Refresh, Stop buttons.
• Address bar for URL.
• History and bookmark.
Example:
• Some popular examples of web clients include Google Chrome,
Microsoft Edge, Safari, Tor, etc. So all types of internet browsers are
client software. However, there’re other types of clients that many
people use for everyday tasks. Video calling solutions like Zoom or
Jitsi are one example of such clients. And so are SSH clients such as
PuTTY or WinSCP. They allow users to connect to a different
machine over the web.
• Another example of web clients includes email applications. If you
have got an email app like Gmail or Microsoft Outlook, those are also
a type of web(email) client.
What is a Web Server?
• Web Servers are systems that are connected to the internet and store web pages.
In addition it sends out requested data over the web using HTTP. In nutshell, like
Apache– the Web Servers are just like libraries for web pages. They store, process
and deliver the web resources to the client software.
• Servers can also use other data transfer protocols such as SMTP and FTP. Mail
servers use SMTP for transferring emails from one user to another. Additionally
FTP server is used for high speed file transfer operations.
Features of Web Servers:
• HTML stands for HyperText Markup Language and it is used to create webpages. It
uses HTML tags and attributes to describe the structure and formatting of a web page.
• HTML consists of various elements, that are responsible for telling search engines how to
display page content. For example, headings, lists, images, links, and more.
• HTML Example
• <!DOCTYPE html>
• <html>
• <head>
• <title>First HTML Code</title>
• </head>
• <body>
• <h2>Welcome To GFG</h2>
• <p>Hello Geeks</p>
• </body>
• </html>
Features of HTML
• HTML uses predefined tags and elements that instruct the browser on
how to display the content.
• HTML elements include an opening tag, some content, and a closing
tag. It’s important to remember to include closing tags. If omitted, the
browser applies the effect of the opening tag until the end of the page.
HTML Page Structure
• The basic structure of an HTML page is shown below. It contains the essential
building-block elements (i.e. doctype declaration, HTML, head, title, and body
elements) upon which all web pages are created.
Cont..
• An HTML document can be created using an HTML text editor. Save the text
file using the “.html” or “.htm” extension. Once saved as an HTML document,
the file can be opened as a webpage in the browser.
• Note: Basic/built-in text editors are Notepad (Windows) and TextEdit (MacOS).
Other advanced text editors include Sublime Text, Visual Studio Code, Froala,
etc.