Chapter 8: Web Browser & Server
34 slides · use ←/→ or Space to navigate, F for fullscreen.
Jump to a lesson deck: Introduction to Web Browsers & Architecture Evolution & Comparison of Web Browsers Extending the Browser Introduction to Web Servers General Server Characteristics HTTP Request Types & Caching Accessing Web Servers Apache & XAMPP System Architecture: 1, 2 & 3 Tiers
Chapter 8: Web Browser & Server
How browsers work and how web servers deliver content — architecture, HTTP requests, XAMPP, and multi-tier system architecture.
Introduction to Web Browsers & Architecture
What a web browser is and the basic components of its architecture.
Introduction
- A web browser is a software application for retrieving, presenting and traversing information 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.
- Examples: Google Chrome, Safari, Internet Explorer, Mozilla Firefox, Opera, Netscape Communicator.
Web Browser Architecture
Many commercial browsers interpret and display web documents. Their capabilities and structure vary depending on implementation, but all must have the most basic components:
- Controller
- Client programs
- Interpreters
Controller
├─ Client programs : HTTP Client, FTP Client, SMTP Client
├─ Interpreters : HTML Interpreter, Optional Interpreter
└─ Driver program / Screen Input-Output + Graphical User Interface
Roles of the Components
- Controller — works as a control unit (like the CPU). It takes input from the keyboard or mouse, interprets it, and makes other services work on the basis of the input it receives.
- Interpreter — receives information from the controller and executes the instructions line by line.
- Client program — describes the specific protocol that will be used to access a service. When a link is selected, the controller extracts the scheme from the URL; this determines which client (HTTP, FTP, etc.) will be used to fetch the document.
The browser fetches the document and, depending on the document type (HTML, XML, etc.), calls the appropriate interpreter to render and display it.
Evolution & Comparison of Web Browsers
The browser timeline from WorldWideWeb to Chrome, and how browsers are compared.
Evolution of Web Browsers
| Year | Browser |
|---|---|
| 1990 | WorldWideWeb (Nexus) |
| 1993 | Mosaic |
| 1994 | Netscape |
| 1995 | Internet Explorer |
| 1996 | Opera |
| 1998 / 2002 | Mozilla |
| 2003 | Safari |
| 2004 | Firefox 1.0 |
| 2006 | Internet Explorer 7 |
| 2008 | Google Chrome |
Highlights
- WorldWideWeb (1990) — the first graphical web browser and WYSIWYG HTML editor, developed by Tim Berners-Lee, inventor of the web. Renamed to Nexus to avoid confusion with the system.
- Mosaic (1993) — credited with popularising the internet and introducing the web to the public; roughly 4 million users.
- Netscape (1994) — the first commercial browser (Netscape Navigator) by Marc Andreessen; reached 90% of all web use at its peak.
- Internet Explorer (1995) — Microsoft's browser, starting the first browser war; peak of about 95% usage during 2002–2003.
- Opera (1996) — offered to the public by Telenor; later ported to mobile devices. Never achieved widespread desktop use.
- Mozilla (1998 / 2002) — Netscape released its source code; the Mozilla project built from scratch (initially named Phoenix).
- Safari (2003) — Apple's browser, introducing the WebKit layout engine, later adopted by many mobile devices.
- Firefox 1.0 (2004) — started the second browser war as Internet Explorer's share slipped.
- Internet Explorer 7 (2006) — adopted features from its open-source competition, such as tabbed browsing and anti-phishing protection.
- Google Chrome (2008) — lightweight, fast and stable; a strong new competitor.
Comparison of Web Browsers
Browsers are compared on features such as cloud sync, private browsing, full-screen mode, side tabs, custom extensions, platform support, JavaScript engine, and whether they are open source.
| Browser | JavaScript engine | Open source |
|---|---|---|
| Chrome | V8 | No (based on Chromium) |
| Firefox | SpiderMonkey / TraceMonkey | Yes |
| Safari | WebKit / Nitro | No |
| Edge | Chakra / V8 | No |
Extending the Browser
Helper applications, plugins/add-ons and Java applets.
Extending the Browser
A browser designer cannot sustain the development effort required to support every possible document format, and owners of proprietary formats may not want to expose their encoding. To accommodate this, browsers incorporate features that allow new functionality to be added without recompilation — such applications are called extensible.
- Helper applications
- Plugins / add-ons
- Java applets
Helper Applications
- An external viewer program launched to display content retrieved using a web browser.
- Examples: Adobe Reader, Windows Media Player, QuickTime Player.
- Unlike a plugin (whose full code is included in the browser), a small line is added to the browser code telling it to open a certain helper application when it encounters a certain file format.
- This provides a simple mechanism to extend browser functionality by invoking external applications (e.g. Adobe Reader) to display documents.
Plugins / Add-ons
- A plugin is software that manages internet content a browser is not designed to process.
- Because plugins run in the same address space as the browser, they must be carefully constructed — a faulty plugin could corrupt the browser's internal data structures.
- For some file types you may need a special plugin, also known as an add-on or extension.
Java Applets
- An applet is a program written in Java, a general-purpose programming language.
- The applet code is downloaded from a web server and executed within the browser.
- To run an applet you need to install a Java Virtual Machine.
- Applets provide interactive features that cannot be provided by HTML alone, such as online game collections.
<html>
<head>
<title>World</title>
</head>
<body>
<applet code="HelloWorld.class" width=400 height=80>
</applet>
</body>
</html> Introduction to Web Servers
What a web server does and the most popular servers.
Introduction to Web Server
- A web server is specialised software that responds to client requests by providing resources.
- When users enter a URL into a web browser, they request specific documents from a web server.
- It maps the URL to a file on the server and returns the requested document to the client.
- It communicates with the client using HTTP — the protocol for transferring requests and files over the internet.
- Examples: Internet Information Services (IIS), Personal Web Server (PWS), Apache Web Server, Tomcat.
Popular Web Servers
| Web server | Approx. share |
|---|---|
| Apache | 51.4% |
| Nginx | 31.4% |
| Microsoft-IIS | 11.9% |
| LiteSpeed | 1.3% |
| Google Servers | 0.6% |
| Tomcat | 0.3% |
Apache is the most popular web server overall, but nginx dominates in growth. Note that a website may use more than one web server.
General Server Characteristics
Document root, server root, virtual hosts and proxy servers.
Document Root
- Web servers have two separate directories.
- The document root is the root directory of all servable documents.
- Example: if the site is
www.bloomers.comand the document root is namedtopdocs, stored in/admin/web, then the document directory is/admin/web/topdocs. - If a request URL is
http://www.bloomers.com/bulbs/tulips.html, the server searches for/admin/web/topdocs/bulbs/tulips.html. - Servers can have virtual document trees — sometimes a different disk, possibly on a different machine, is used after the original disk is filled.
Server Root
The server root is the root directory for all the code that implements the server. It usually contains four items — the server code itself plus three subdirectories:
| Directory | Purpose |
|---|---|
conf | Configuration information. |
logs | To store what has happened. |
cgi-bin | Executable scripts. |
Other Server Services
- Virtual hosts — multiple sites on the same system.
- Proxy servers — to serve documents from the document roots of other sites.
- Support for FTP, Gopher, News and email, in addition to HTTP.
- Support for database access.
HTTP Request Types & Caching
GET vs POST, and how browsers cache responses.
HTTP Request Types
Also known as request methods. The most popular are get and post, used to retrieve and send client form data to a web server.
| GET request | POST request |
|---|---|
|
Sends form content as part of the URL Retrieves the appropriate resource from the web server Limits the query to 1024 characters |
Updates the contents of the web server (e.g. posting new messages to a forum) Has no limit on query length Not part of the URL and cannot be seen by the user |
POST data is sent to a server-side form handler.
Caching
- Browsers cache (save on disk) web pages, allowing for quick reloading.
- They cache responses to GET requests.
- They do not cache responses to POST requests.
Accessing Web Servers
Local vs remote servers, domain names, TLDs, IP addresses and DNS lookups.
Accessing Web Servers
Requesting documents requires knowing the machine name on which the web server resides — through local or remote web servers, and through a domain name or an IP address.
Local web server
- Resides on the user's machine.
- Requests documents by machine name or
localhost— the host name that references the local machine.
Remote web server
- Resides on a different machine.
- Domain name — represents a group of hosts on the internet; it combines a host name (www) and a top-level domain to form a fully qualified host name.
- Top-level domain (TLD) — describes the type of organisation that owns the domain name, e.g.
.comor.org. - Fully qualified host name — a user-friendly way to identify a site on the internet.
IP address and DNS
- IP address — a unique address for locating computers on the internet.
- Domain Name Server (DNS) — maintains a database of host names and corresponding IP addresses. It translates a fully qualified host name to an IP address — known as a DNS lookup.
Apache & XAMPP
The Apache web server and the XAMPP local development stack.
Apache Web Server
- Maintained by the Apache Software Foundation.
- Currently the most popular web server.
- Stable, efficient and portable.
On Windows you can start it via Start → Programs → Apache httpd Server → Control Apache Server → Start.
What is XAMPP?
XAMPP is a simple and lightweight Apache distribution that makes it extremely easy for developers to create a local web server for testing purposes.
| Letter | Stands for |
|---|---|
| X | Cross-platform |
| A | Apache |
| M | MySQL |
| P | PHP |
| P | Perl |
What is included in XAMPP?
| Component | Description |
|---|---|
| Apache | The actual web server application that possesses and delivers web content to computers. |
| MySQL | The world's most popular open-source database management system. |
| PHP | The most popular server-side scripting language; works perfectly with MySQL. |
| Perl | A high-level dynamic programming language used extensively in network programming and system administration. |
Other modules
OpenSSL, phpMyAdmin, MediaWiki, Joomla, WordPress, FileZilla FTP Server, Mercury Mail Transport System, Tomcat, Strawberry Perl, Webalizer and the XAMPP Control Panel.
System Architecture: 1, 2 & 3 Tiers
Client-server architecture, tiers, and why 3-tier solves the problems of 2-tier.
Client-Server Architecture
| Client tasks | Server tasks |
|---|---|
|
Provide a way for users to submit queries Run applications that use the results of queries Display results of queries |
Implement a data manipulation language that can directly access and update the database |
A two-tier system has clients that are connected directly to the server.
Tiers
- 1-tier — client computers and a file server.
- 2-tier — client tier + database tier (clients connect directly to the server).
- 3-tier — client tier + business logic (middle) tier + database (information) tier.
Problems with a Two-Tier System
- Performance degrades as the number of users increases.
- Scalability — supports only a limited number of users; simultaneous client requests require separate connections and CPU/memory, so performance degrades rapidly.
- Lack of security — clients have direct access to the database.
- Reusability — clients are mostly monolithic, so reuse is not possible.
Solutions with a 3-Tier Implementation
- Improved scalability — distributed application servers mean a separate connection from each client is not required; connections from a few application servers are sufficient.
- Improved security — the client does not access the database directly.
- Reusability — greater with service implementation.
Conclusion: the problems in a two-tier architecture can be handled using a three-tier implementation.
The Three Tiers
| Tier | Role |
|---|---|
| Client tier | The top tier. The application's user interface; users interact with the application through it, it makes requests to and retrieves data from the information tier, and displays data to the user. |
| Information tier | The data (bottom) tier. Maintains data for the application, stored in a relational database management system. |
| Middle tier | Implements business logic and presentation logic; acts as intermediary between application clients and application data. |
Middle tier responsibilities
- Controller logic — processes client requests from the top tier and retrieves data from the database.
- Presentation logic — processes data from the information tier and presents content to the client.
- Business logic — enforces business rules, dictates how clients can access application data and how applications process data, and ensures data validity before updating the database.