Web Technology: Basic
Web Technology: Basic
Basic
2
3
Network Application
• An Application over a network is called a network application
• A network application is commonly called a service
• A service comprises of two discrete participants:
4
Client/Server Computing
Server
5
Client-Server concept
12
Server: Stateless and Stateful
• Servers may also be of two types based on forgetfulness: stateless and
statefull.
• A statefull server has stronger memory power. It can not only remember
the facts of the ongoing transaction but also history of previous
transactions. Therefore, the design of a statefull server is very complex.
• A server can act as a client to other servers. Using this model, a server
can execute a task by dividing it into sub-tasks and then having other
servers complete the subtasks.
13
Server: Stateless and Stateful || other concepts
• Client-server system is stateless if:
Client is independently responsible for its actions, server doesn’t track set
of clients or ensure that cached data stays up to date
• Client-server system is stateful if:
Server tracks its clients, takes actions to keep their cached states “current”.
Client can trust its cached data.
14
Server: Stateless and Stateful
•
• A server can act as a client to other servers. Using this model, a server
can execute a task by dividing it into sub-tasks and then having other
servers complete the subtasks.
15
Best known examples?
19
Contd..
• encapsulation of services: A message tells a server what service is
requested. It is up to the server to determine how to get the job done. A
server can be upgraded without effecting the clients as long as the
published message interface is not changed.
• integrity: The server code and server data is centrally maintained, which
results in cheaper maintenance and the guarding of shared data integrity.
At the same time, the clients remain personal and independent.
20
Virtual Hosting
• Normally one host has one domain name
• Virtual hosting is a method for hosting multiple domain names (with
separate handling of each name) on a single server
• IP address to Domain Name mapping is 1:1
• IP address to DN is 1:M
• One IP address but multiple domain name
• Web Site hosting agencies use virtual hosting
• A host may have more than one IP address, if it is connected to many
networks
21
Name Based Hosting
• Name-based virtual hosts use multiple host names for the same IP
address.
• A technical prerequisite needed for name-based virtual hosts is a web
browser with HTTP/1.1 support to include the target hostname in the
request. This allows a server hosting multiple sites behind one IP
address to deliver the correct site's content.
• For instance, a server could be receiving requests for two domains,
www.example.com and www.example.net, both of which resolve to the
same IP address.
• For www.example.com, the server would send the HTML file from the
directory /var/www/user/GU/site/, while requests for www.example.net
would make the server serve pages from /var/www/user/IST/site/.
22
IP Based Hosting
• When IP-based virtual hosting is used, each site (either a DNS host
name) points to a unique IP address.
• The web server is configured with multiple physical network interfaces,
virtual network interfaces on the same physical interface or multiple IP
addresses on one interface.
23
Port-based Hosting
• The default port number for HTTP is 80. However, most web servers can be
configured to operate on almost any port number, provided the port number
is not in use by any other program on the server.
24
Basic Services
• Name Service:
• Remote login Service:
• File Service:
• Mail Service:
• Web Service:
25
Name Service
• For a common user it is hard to remember correctly an IP Address
• An equivalent symbolic name is associated with this number as an
identifier of the machine in application layer and such a name is called
domain name.
• With domain name a connection cannot be established directly.
• For transport layer connection, the IP address of the host is required
• Name service resolves a domain name to IP address for establishing
connection or vice versa
– Forward Mapping: Mapping of domain names to ip address. This is
commonly what the name server does.
– Reverse Mapping : Mapping of ip address to domain names. Used in
diskless machines. Certain applications also require this to check for
security.
• The domain name of the machine 50.22.136.227 is www.gauhati.ac.in.
• A mapping is simply an association between two things
26
Flat Namespace
• Originally each machine name on the internet consisted of a sequence
of characters.
• A central site Internet Network Information Center Administered the
namespace and assigned new names.
• Issues
– single point of failure
– traffic volume
– distant centralized database
– maintenance
– scaling
27
Distributed Name Space
• Decentralize the naming mechanism by delegating authority for part of
the namespace to different players. It means to distribute the database.
28
Hierarchal Naming Scheme
• A hierarchical, domain-based naming scheme
• Root Domain (.)
• Top Level Domains (TLD)
– Generic (.com, .edu, .gov, .org, .net ….)
– Country (.in, .jp .us .nl …)
29
Hierarchal Naming Scheme
A top-level domain (TLD) is one of the domains at the highest level in the
hierarchical Domain Name System of the Internet
The top-level domain names are installed in the root zone of the name
space. For all domains in lower levels, it is the last part of the domain
name, that is, the last label of a fully qualified domain name.
30
Domain Name System (DNS)
• Defined in RFC (Request for Comments) 1034,1035
• The system comprises of
• Name Client:
– Name client requests a name server to resolve the given domain name to its
IP address
– It uses UDP and not TCP in the transport layer
• Name Server:
– name server resolves the given name to its IP address
– It listens to port no UDP port no 53
• Distributed Name Database
– name-to-IP address mappings are stored in a name database associated with
a name server
31
Protocol
• A client calls a library program, resolver
• Resolver sends a UDP packet the local name server listening at port no
53
• The server looks into the local name database and returns the ip address
to the resolver if it has it in its cache. Resolver forwards it to the client
• If it does not know it will see how closely it can match the requested
name and use whatever information it has cached.
• It will remove the leftmost parts one at a time, checking if it knows
anything about www.gauhati.ac.in , gauhati.ac.in, ac.in. , in,
• In the worst case there is no match but the `.' (root) of the name, It will
then ask a . server about www.gauhati.ac.in
• This . server will not know the answer but it will help your server on its
way by giving a referral, telling it where to look instead.
• These referrals will eventually lead your server to a nameserver that
knows the answer.
32
Simple DNS example
33
requesting host Xyz.edu
abc.ac.in
33
DNS example
root name server
Root name server:
• may not know
authoritative name server 2 6
• may know intermediate 7 3
name server: who to
contact to find
authoritative name server
intermediate name server
dns.test1.edu
4 5
1 8
34
Name Servers
• Local name servers:
– each ISP, company has local (default) name server
– host DNS query first goes to local name server and is resolved by
using local name database.
• Authoritative name server:
– for a host: stores that host’s IP address, name
– can perform name/address translation for that host’s name
• Root Name Servers
– Root servers are the servers at the root of the Domain Name System
hierarchy
– “. “ Servers
– 13 Nos in the world
– In India three root servers are placed, one in Mumbai (I root), one in
Delhi (K root) and one in Chennai (F root)
35
36
Root Name Servers
• A root name server is a name server for the Domain Name System's
root zone.
• It directly answers requests for records in the root zone and answers
other requests returning a list of the designated authoritative name
servers for the appropriate top-level domain (TLD).
• The root name servers are a critical part of the Internet because they are
the first step in translating (resolving) human readable host names into
IP addresses that are used in communication between Internet hosts.
• here are currently 13 root name servers specified, with names in the
form letter.root-servers.net, where letter ranges from A to M
37
Who operates root servers?
38
Contd..
• There are more than 300 root servers scattered around the world, on all
six populated continents.
• They are reachable using 13 numeric IP addresses – one per operating
organization, except for Verisign, which has two.
• Most of those addresses are assigned to multiple servers scattered
around the world, so DNS queries sent to those addresses get fast
responses from local servers.
• Because there are only 13 root server IP addresses, only 13 root servers
can be seen from any single location at any given time.
39
Authoritative Name Server
40
Remote Login Service: TELNET
telnet
• Remote Login(TELNET) a service which client
allows a local machine to login to a
remote machine.
• The local machine now works as a
terminal of the remote machine.
• TELNET is the basis of other application
protocols, like FTP, HTTP etc
– Step1 telnet 50.22.136.227
23
– Step2 login : password:
– Step3 commands
– Step 4 bye
telnet
server
41
File Service: FTP
ftp
server
42
Web Service: World Wide Web
• The World Wide Web (www) or the Web
service is the most popular service on the
Internet
• WWW was originated by Timothy Berners
Lee in march 1989 at CERN, the European Web
Particle Physics Laboratory client
• He wrote the first web client and server in
1990
• WWW is a network of pages containing
hypermedia information HTTP
• A Web client, talks to a Web server (Port 80)
using HTTP (HyperText Transport Protocol)
80
Web
Server
43
TELNET as Alternative Web Browser
• TELNET software can be used as poor alternative to a web browser.
• It can be used to request an HTML page from Web server and then
interpret the HTML page and display its contents on the user’s screen
• If the user’s , for some reason, does not have Web Browser, but knows
how to enter TELNET commands, and has some software that can
interpret HTML pages.
• In such case, the user can actually type TELNET commands that mimic
the function of Web Browser, by requesting web pages from a web
server.
• However, the point to note is that TELNET can actually be used to send
HTTP commands to a Web Server
telnet 172.16.0.2 80
GET /index.html
44
Hypermedia Page
• Hypermedia components
– Text ( .html, .htm)
– Image (.jpg, .gif, etc)
– Audio (.wav)
– Video (.avi)
45
Uniform Resource Locator: URL
protocol://domain_name:target_port/relative_path/file_name.extension#section
• http://www.gauhati.ac.in/ist/prog/btech/index.html#btech_04
• Defaults
– Protocol: http
– Domain_name: current
– Target Port:80
– Relative path: wrt DocumentRoot (/var/www/html)
– File: DirectoryIndex (index.html)
– Section : #TOP
• Server Configutation Directives in /etc/httpd/conf/httpd.conf
• In lieu of domain_name we can use an IP address also.
Example
46
URI
• A Uniform Resource Identifier (URI) is a compact sequence of
characters that identifies an abstract or physical resource.
• A URI can be further classified as a locator, a name, or both.
• The term “Uniform Resource Locator” (URL) refers to the subset of
URIs that, in addition to identifying a resource, provide a means of
locating the resource by describing its primary access mechanism (e.g.,
its network “location”).
47
URL
• A URL is a URI that, in addition to identifying a web resource, specifies
the means of acting upon or obtaining the representation, specifying
both its primary access mechanism and network location.
• For example, the URL http://guist.ac.in/index.html refers to a resource
identified as index.html whose representation, in the form of HTML and
related code, is obtainable via HyperText Transfer Protocol (http) from a
network host whose domain name is guist.ac.in
48
URN
• A URN is a URI that identifies a resource by name in a particular
namespace *.
• A URN can be used to talk about a resource without implying its
location or how to access it.
– The International Standard Book Number (ISBN) system for
uniquely identifying books provides a typical example of the use of
URNs.
– The URN for that edition would be urn:isbn:0-486-27557-4.
* Namespaces
• In order to ensure the global uniqueness of URN namespaces, their
identifiers (NID [Namespace Identifier]) are required to be registered
with the IANA(Internet Assigned Numbers Authority) .
49
Contd..
Syntax
• The syntax of a URN
<URN> ::= "urn:" <NID> ":" <NSS>
• This renders as: urn:<NID>:<NSS>
• The leading
– urn: sequence is case-insensitive.
– <NID> is the namespace identifier, which determines the syntactic
interpretation of <NSS>, the namespace-specific string.
– Example : urn:isbn:0451450523
50
Conceptual distinctions
51
Examples
• Examples of URIs–again from the RFC:
• ftp.is.co.za/rfc/rfc1808.txt
• http://www.ietf.org/rfc/rfc2396.txt
• ldap://[2001:db8::7]/c=GB?objectClass?one
• mailto:[email protected]
• news:comp.infosystems.www.servers.unix
• telnet://192.0.2.16:80/ (
• urn:oasis:names:specification:docbook:dtd:xml:4.1.2
52
Examples
• Examples of URIs–again from the RFC:
• ftp://ftp.is.co.za/rfc/rfc1808.txt (also a URL because of the protocol)
• http://www.ietf.org/rfc/rfc2396.txt (also a URL because of the protocol)
• ldap://[2001:db8::7]/c=GB?objectClass?one (also a URL because of the
protocol)
• mailto:[email protected] (also a URL because of the protocol)
• news:comp.infosystems.www.servers.unix (also a URL because of the
protocol)
• telnet://192.0.2.16:80/ (also a URL because of the protocol)
• urn:oasis:names:specification:docbook:dtd:xml:4.1.2
53
Web Browser
• A web browser is a software application for retrieving, presenting and
traversing information resources on the World Wide Web.
• An information resource is identified by a Uniform Resource Identifier
(URI) and may be a web page, image, video or other piece of content.
• Hyperlinks present in resources enable users easily to navigate their
browsers to related resources.
• A web browser can also be defined as an application software or
program designed to enable users to access, retrieve and view
documents and other resources on the Internet.
• Although browsers are primarily intended to use the World Wide Web,
they can also be used to access information provided by web servers in
private networks or files in file systems.
• Browsers:
– Internet Explorer
– Netscape Navigator
– Mozilla Firefox
– Chrome
– Opera
– Safari
54
History - web browser
• The first web browser was invented in 1990 by Sir Tim Berners-Lee. It
was called WorldWideWeb (no spaces) and was later renamed Nexus.
• In 1993, Mosaic (later Netscape), browser software was innovated by
Marc Andreessen ,"the world's first popular browser which made the
World Wide Web system easy to use and more accessible to the average
person
• Andreessen, the leader of the Mosaic team at NCSA, soon started his
own company, named Netscape, and released the Mosaic-influenced
Netscape Navigator in 1994, which quickly became the world's most
popular browser, accounting for 90% of all web use at its peak
• Microsoft responded with its Internet Explorer in 1995, also heavily
influenced by Mosaic, initiating the industry's first browser war.
• Internet Explorer gained dominance in the web browser market; Internet
Explorer usage share peaked at over 95% by 2002.
55
Contd..
• Opera was released in 1996; although it has never achieved widespread
use, having less than 2% browser usage share as of February 2012
according to Net Applications.
• Its Opera-mini version has an additive share, in April 2011 amounting to
1.1% of overall browser use.
• In 1998, Netscape launched what was to become the Mozilla Foundation
in an attempt to produce a competitive browser using the open source
software model.
• That browser would eventually evolve into Firefox
• As of August 2011, Firefox has a 28% usage share.
• Apple's Safari had its first beta release in January 2003; as of April
2011, it had a dominant share of Apple-based web browsing, accounting
for just over 7% of the entire browser market.
56
Contd..
• The most recent major entrant to the browser market is Chrome, first
released in September 2008. Chrome's take-up has increased
significantly year on year, by doubling its usage share from 8% to 16%
by August 2011.
57
Source: http://en.wikipedia.org View current usage share
58
Most used web browser by country as of June 2015
59
Web Browser – Function
• Function of a web browser is to bring information resources to the user
("retrieval" or "fetching"), allow them to view the information
("display", "rendering"), and then access other information
("navigation", "following links").
• This process begins when the user inputs a Uniform Resource Locator
(URL), for example http://en.wikipedia.org/, into the browser.
• The prefix of the URL, the Uniform Resource Identifier or URI,
determines how the URL will be interpreted.
• The most commonly used kind of URI starts with http: and identifies a
resource to be Retrieved over the Hypertext Transfer Protocol (HTTP).
• Many browsers also support a variety of other prefixes, such as https:
for HTTPS, ftp: for the File Transfer Protocol, and file: for local files.
• Prefixes that the web browser cannot directly handle are often handed
off to another application entirely. For example, mailto: URIs are
usually passed to the user's default e-mail application, and news: URIs
are passed to the user's default newsgroup reader.
60
Contd..
• In the case of http, https, file, and others, once the resource has been
Retrieved the web browser will display it.
• HTML and associated content (image files, formatting information such as
CSS, etc.) is passed to the browser's layout engine to be transformed from
markup to an interactive document, a process known as "rendering".
• Aside from HTML, web browsers can generally display any kind of content
that can be part of a web page.
• Most browsers can display images, audio, video, and XML files, and often
have plug-ins to support Flash applications and Java applets.
• Upon encountering a file of an unsupported type or a file that is set up to be
downloaded rather than displayed, the browser prompts the user to save the
file to disk.
• Information resources may contain hyperlinks to other information
resources. Each link contains the URI of a resource to go to. When a link is
clicked, the browser navigates to the resource indicated by the link's target
URI, and the process of bringing content to the user begins again.
61
HTTP Commands
• GET :Request for obtaining a Web page
• HEAD :Request to read the header of a Web page. If a browser wants to
know the last modified date of a Web page
• PUT :Request the server to store a Web page
• POST : Similar to PUT, but is used for updating a existing Web page
• DELETE : Remove a Web page (Obsolete)
• LINK : Connects two resources (Obsolete)
• UNLINK : Disconnects two resources (Obsolete)
• Note that GET is the most common command sent by a client browser
as apart of the HTTP request to a Web server.
• This is because not many Web servers would allow a client to
delete/add/link/unlink files.
62
Web Content
63
Thank You
Next Slide