how the web worksa computer that is devoted to running a database management system (dbms) • mail...

88
Fundamentals of Web Development Randy Connolly and Ricardo Hoar Fundamentals of Web Development Randy Connolly and Ricardo Hoar © 2015 Pearson http://www.funwebdev.com How the Web Works Chapter 1 (Edited) 1

Upload: others

Post on 26-Jan-2020

3 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: How the Web WorksA computer that is devoted to running a Database Management System (DBMS) • Mail servers. A computer creating and satisfying mail requests, typically using the Simple

Fundamentals of Web Development Randy Connolly and Ricardo Hoar

Fundamentals of Web Development Randy Connolly and Ricardo Hoar

© 2015 Pearson

http://www.funwebdev.com

How the Web Works

Chapter 1 (Edited)

1

Page 2: How the Web WorksA computer that is devoted to running a Database Management System (DBMS) • Mail servers. A computer creating and satisfying mail requests, typically using the Simple

Fundamentals of Web Development Randy Connolly and Ricardo Hoar

https://cs486t.wordpress.com/

2

Course Information Course Number CS 486T

Name: Web Application Development

Credits: 3

Contact hours: Lecture Hours: 2

Lab Hours: 2

Prerequisites: IS220T Database fundamental

Page 3: How the Web WorksA computer that is devoted to running a Database Management System (DBMS) • Mail servers. A computer creating and satisfying mail requests, typically using the Simple

Fundamentals of Web Development Randy Connolly and Ricardo Hoar

Instructor’s Information:

Name: Dr. Myriam Hadjouni

E-mail: [email protected]

Office No: 2.501.44

Office hours:

Monday [10.00 to 11.50 pm]

Tuesday [ 1.00-2.50 pm]

3

Page 4: How the Web WorksA computer that is devoted to running a Database Management System (DBMS) • Mail servers. A computer creating and satisfying mail requests, typically using the Simple

Fundamentals of Web Development Randy Connolly and Ricardo Hoar

Objectives of the course

• 3.1 Understand the structure and function of Website

• 3.2 Covers the concepts of networks and internet function at

high level.

• 3.3 Design and create website by exploring the base language

:HTML

• 3.4 Identify and use common HTML tags, add an image ,table

and hyperlinks to connect series of webpages

• 3.5 Demonstrate the knowledge of coding and database

technology

• 3.6 Design and build an interactive website

4

Page 5: How the Web WorksA computer that is devoted to running a Database Management System (DBMS) • Mail servers. A computer creating and satisfying mail requests, typically using the Simple

Fundamentals of Web Development Randy Connolly and Ricardo Hoar

Percentage %

overall grade Assessment Week Assessment method

10% Week 7

Monday(12.00-12.50) Midterm 1

15% Week 11

Monday(12.00-12.50) Midterm 2

5% Weeks 1-13 Lecture quizzes

5%

Weeks 1-13:

Class evaluations

Assignments

Weekly homework

Weekly lab progress

10% By the end of week 12 Theory and Practice :

Project

15% Week 14 Lab exam

40% After Week 15 Final exam (Theory)

5

Page 6: How the Web WorksA computer that is devoted to running a Database Management System (DBMS) • Mail servers. A computer creating and satisfying mail requests, typically using the Simple

Fundamentals of Web Development Randy Connolly and Ricardo Hoar

Objectives

Definitions and History

Internet Protocols

Client-Server Model

Domain Name System Uniform Resource Locators (URL)

1 2

3 4

5 6

Hypertext Transfer Protocol (HTTP) 7 Web Servers 8

6

Where is the

Internet? 4

Page 7: How the Web WorksA computer that is devoted to running a Database Management System (DBMS) • Mail servers. A computer creating and satisfying mail requests, typically using the Simple

Fundamentals of Web Development Randy Connolly and Ricardo Hoar

DEFINITIONS AND HISTORY Section 1 of 8

7

Page 8: How the Web WorksA computer that is devoted to running a Database Management System (DBMS) • Mail servers. A computer creating and satisfying mail requests, typically using the Simple

Fundamentals of Web Development Randy Connolly and Ricardo Hoar

Internet = Web?

• The World-Wide Web (WWW or simply the Web) is

certainly what most people think of when they see the

word “internet.”

• But the WWW is only a subset of the Internet.

The answer is no

Internet

Web

Email

Onlinegaming

FTP

8

Page 9: How the Web WorksA computer that is devoted to running a Database Management System (DBMS) • Mail servers. A computer creating and satisfying mail requests, typically using the Simple

Fundamentals of Web Development Randy Connolly and Ricardo Hoar

Short History of the Internet

• The early ARPANET network was funded and controlled by the

United States government, and was used exclusively for academic

and scientific purposes.

• The early network started small with just a handful of connected

campuses in 1969 and grew to a few hundred by the early 1980s.

Perhaps not short enough

9

Page 10: How the Web WorksA computer that is devoted to running a Database Management System (DBMS) • Mail servers. A computer creating and satisfying mail requests, typically using the Simple

Fundamentals of Web Development Randy Connolly and Ricardo Hoar

ARPANET

• The research network ARPANET was created in the 1960s.

• ARPANET used packet switching

• ARPANET: Advanced Research Project Agency

Network

The beginnings of the Internet

10

Page 11: How the Web WorksA computer that is devoted to running a Database Management System (DBMS) • Mail servers. A computer creating and satisfying mail requests, typically using the Simple

Fundamentals of Web Development Randy Connolly and Ricardo Hoar

Circuit vs Packet Switching

• A circuit switching establishes an actual physical connection

between two people through a series of physical switches.

• A packet-switched network does not require a continuous

connection:

• It splits the messages into smaller chunks called packets

and routes them to the appropriate place based on the

destination address

• Packets can take different routes to the destination

11

Page 12: How the Web WorksA computer that is devoted to running a Database Management System (DBMS) • Mail servers. A computer creating and satisfying mail requests, typically using the Simple

Fundamentals of Web Development Randy Connolly and Ricardo Hoar

TCP/IP

• In addition to ARPANET, other networks were created such as

X.25 and USENET.

• To promote the growth and unification of the disparate

networks a suite of protocols was invented to unify the

networks together.

• By 1981, TCP/IP (Transmission Control Protocol /

Internet Protocol) begun to be adopted.

12

Page 13: How the Web WorksA computer that is devoted to running a Database Management System (DBMS) • Mail servers. A computer creating and satisfying mail requests, typically using the Simple

Fundamentals of Web Development Randy Connolly and Ricardo Hoar

WWW on TCP/IP

• On January , 1983, TCP/IP was adopted across all of

ARPANET.

• The next decade saw an explosion in the numbers of

users.

• During these early years, email and text-based

systems were the extent of the Internet experience.

• The invention of the WWW is usually attributed to the

British Tim Berners-Lee.

13

Page 14: How the Web WorksA computer that is devoted to running a Database Management System (DBMS) • Mail servers. A computer creating and satisfying mail requests, typically using the Simple

Fundamentals of Web Development Randy Connolly and Ricardo Hoar

Core Features of the Web

Shortly after that initial proposal Berners-Lee developed the

main features of the web:

1. A URL to uniquely identify a resource on the WWW.

2. The HTTP protocol to describe how requests and responses

operate.

3. The HTML markup language to publish documents.

4. A software program (web server software) that can respond

to HTTP requests.

5. A program (a browser) to make HTTP requests from URLs

and that can display the HTML it receives.

14

Page 15: How the Web WorksA computer that is devoted to running a Database Management System (DBMS) • Mail servers. A computer creating and satisfying mail requests, typically using the Simple

Fundamentals of Web Development Randy Connolly and Ricardo Hoar

W3C

• In late 1994, Berners-Lee helped found the World Wide

Web Consortium (W3C), which became the

international standards organization that would oversee

the growth of the web.

• This growth was very much facilitated by the decision to

not patent the work and ideas done by its employee and

instead left the web protocols and code-base royalty free.

The World Wide Web Consortium

15

Page 16: How the Web WorksA computer that is devoted to running a Database Management System (DBMS) • Mail servers. A computer creating and satisfying mail requests, typically using the Simple

Fundamentals of Web Development Randy Connolly and Ricardo Hoar

INTERNET PROTOCOLS Section 2 of 8

16

Page 17: How the Web WorksA computer that is devoted to running a Database Management System (DBMS) • Mail servers. A computer creating and satisfying mail requests, typically using the Simple

Fundamentals of Web Development Randy Connolly and Ricardo Hoar

What’s a Protocol?

• The internet exists today because of a suite of interrelated

communications protocols.

• A protocol is a set of rules that partners in communication

use when they communicate.

• The TCP/IP Internet protocols were originally abstracted

as a four-layer stack.

• Later abstractions subdivide it further into five or seven

layers.

• Since we are focused on the top layer anyhow, we will use

the earliest and simplest four-layer network model.

A Layered Architecture

17

Page 18: How the Web WorksA computer that is devoted to running a Database Management System (DBMS) • Mail servers. A computer creating and satisfying mail requests, typically using the Simple

Fundamentals of Web Development Randy Connolly and Ricardo Hoar

Four Layer Network Model

18

Page 19: How the Web WorksA computer that is devoted to running a Database Management System (DBMS) • Mail servers. A computer creating and satisfying mail requests, typically using the Simple

Fundamentals of Web Development Randy Connolly and Ricardo Hoar

Four Layer Network Model

Link Layer: responsible for both the physical transmission across

media (wires, wireless) and establishing logical links

Internet Layer: sometimes also called the IP Layer, routes

packets between communication partners across networks.

Transport Layer: ensures transmissions arrive, in order, and

without error.

Application Layer implement process-to-process communication

and are at a higher level of abstraction

19

Page 20: How the Web WorksA computer that is devoted to running a Database Management System (DBMS) • Mail servers. A computer creating and satisfying mail requests, typically using the Simple

Fundamentals of Web Development Randy Connolly and Ricardo Hoar

Link Layer

• It handles issues like packet creation, transmission, reception and

error detection, collisions, line sharing and more.

• It uses the identifier MAC address (Media Access Control)

assigned to the network hardware and which are used at the

physical networking level.

20

Save this for your networking course

Page 21: How the Web WorksA computer that is devoted to running a Database Management System (DBMS) • Mail servers. A computer creating and satisfying mail requests, typically using the Simple

Fundamentals of Web Development Randy Connolly and Ricardo Hoar

Internet Layer

• The Internet uses the Internet Protocol (IP) addresses to

identify destinations on the Internet.

• Every device connected to the Internet has an IP address, which

is a numeric code that is meant to uniquely identify it.

• The newest version of the IP protocol is IPv6

• Your IP address will generally be assigned to you by your Internet

Service Provider (ISP).

21

Internet Protocol (IP)

Page 22: How the Web WorksA computer that is devoted to running a Database Management System (DBMS) • Mail servers. A computer creating and satisfying mail requests, typically using the Simple

Fundamentals of Web Development Randy Connolly and Ricardo Hoar

IP Addresses

IPv4

• 12 numbers are used

• implemented as four 8-bit

integers

• 4 integers together can

encode approximately 4.2

billion unique IP addresses.

• These range from 0.0.0.0 to

255.255.255.255

IPv6

• 16-bit integers. written in

hexadecimal, due to their

longer length.

• 2128 unique addresses.

22

Two types

Page 23: How the Web WorksA computer that is devoted to running a Database Management System (DBMS) • Mail servers. A computer creating and satisfying mail requests, typically using the Simple

Fundamentals of Web Development Randy Connolly and Ricardo Hoar

Transport Layer

The transport layer ensures transmissions arrive, in order, and

without error. This is accomplished through a few mechanisms.

1. 1st the data is broken into packets formatting according

to the Transmission Control Protocol (TCP).

2. 2nd each packet is acknowledged (ACK) back to the

sender.

If a packet is lost, the transmitter will realize a packet has

been lost since no ACK arrived for that packet.

That packet is retransmitted and is reordered at the

destination.

23

Page 24: How the Web WorksA computer that is devoted to running a Database Management System (DBMS) • Mail servers. A computer creating and satisfying mail requests, typically using the Simple

Fundamentals of Web Development Randy Connolly and Ricardo Hoar

Application Layer

• With the application layer, we are the level of protocols familiar

to most web developers.

• Application layer protocols implement process-to-process

communication and are at a higher level of abstraction in

comparison to the low-level packet and IP addresses protocols in

the layers below it.

• Examples: HTTP, SSH, FTP, DNS, POP, and SMTP.

24

Page 25: How the Web WorksA computer that is devoted to running a Database Management System (DBMS) • Mail servers. A computer creating and satisfying mail requests, typically using the Simple

Fundamentals of Web Development Randy Connolly and Ricardo Hoar

CLIENT-SERVER MODEL Section 3 of 8

25

Page 26: How the Web WorksA computer that is devoted to running a Database Management System (DBMS) • Mail servers. A computer creating and satisfying mail requests, typically using the Simple

Fundamentals of Web Development Randy Connolly and Ricardo Hoar

Client-Server Model

• The web is sometimes referred to as a client-server model of

communications.

• In the client-server model, there are two types of actors:

clients and servers.

• The server is a computer agent that is normally active 24/7,

listening for queries from any client who makes a request.

• A client is a computer agent that makes requests and receives

responses from the server.

What is it?

26

Page 27: How the Web WorksA computer that is devoted to running a Database Management System (DBMS) • Mail servers. A computer creating and satisfying mail requests, typically using the Simple

Fundamentals of Web Development Randy Connolly and Ricardo Hoar

Request-Response Loop

• Within the client-server model, the request-response

loop is the most basic mechanism on the server for

receiving requests and transmitting data in response.

• The client initiates a request to a server and gets a

response that could include some resource like an HTML

file, an image or some other data.

27

Page 28: How the Web WorksA computer that is devoted to running a Database Management System (DBMS) • Mail servers. A computer creating and satisfying mail requests, typically using the Simple

Fundamentals of Web Development Randy Connolly and Ricardo Hoar

Server Types

• Web servers: A computer servicing HTTP requests.

• Application servers: A server that hosts and executes web

applications.

• Database servers. A computer that is devoted to running a

Database Management System (DBMS)

• Mail servers. A computer creating and satisfying mail requests,

typically using the Simple Mail Transfer Protocol (SMTP) for

sending mail.

• Media servers (streaming server) : is a special type of server

dedicated to servicing requests for images and videos.

• Authentication servers. An authentication server handles the

most common security needs of web applications.

28

Page 29: How the Web WorksA computer that is devoted to running a Database Management System (DBMS) • Mail servers. A computer creating and satisfying mail requests, typically using the Simple

Fundamentals of Web Development Randy Connolly and Ricardo Hoar

DOMAIN NAME SYSTEM (DNS) Section 5 of 8

29

Page 30: How the Web WorksA computer that is devoted to running a Database Management System (DBMS) • Mail servers. A computer creating and satisfying mail requests, typically using the Simple

Fundamentals of Web Development Randy Connolly and Ricardo Hoar

Domain Name System

• As elegant as IP addresses may be, human beings do not enjoy

having to recall long strings of numbers.

• Instead of IP addresses, we use the Domain Name System

(DNS)

Why do we need it?

30

Page 31: How the Web WorksA computer that is devoted to running a Database Management System (DBMS) • Mail servers. A computer creating and satisfying mail requests, typically using the Simple

Fundamentals of Web Development Randy Connolly and Ricardo Hoar

Domain Levels

server1.www.funwebdev.com

Top Level Domain (TLD)

Second-Level Domain (SLD)

Third-Level Domain

Fourth-Level Domain

com

funwebdev

www

server1

Top-Level Domain (TLD)

Second-Level Domain (SLD)

Third-Level Domain

Fourth-Level Domain

Most general

Most specific

31

Page 32: How the Web WorksA computer that is devoted to running a Database Management System (DBMS) • Mail servers. A computer creating and satisfying mail requests, typically using the Simple

Fundamentals of Web Development Randy Connolly and Ricardo Hoar

UNIFORM RESOURCE LOCATORS

(URL)

Section 6 of 8

32

Page 33: How the Web WorksA computer that is devoted to running a Database Management System (DBMS) • Mail servers. A computer creating and satisfying mail requests, typically using the Simple

Fundamentals of Web Development Randy Connolly and Ricardo Hoar

URL Components

• In order to allow clients to request particular resources

from the server, a naming mechanism is required so that

the client knows how to ask the server for file.

• For the web that naming mechanism is the Uniform

Resource Locator (URL).

• A path includes the folder(s) / directory(ies) and the page

filename and extension

http://www.funwebdev.com/index.php?page=17#article

Protocol Domain Query String FragmentPath

33

Page 34: How the Web WorksA computer that is devoted to running a Database Management System (DBMS) • Mail servers. A computer creating and satisfying mail requests, typically using the Simple

Fundamentals of Web Development Randy Connolly and Ricardo Hoar

URL Components

34

Part Description

Domain The domain identifies the server from which we are

requesting resources.

Port The optional port attribute allows us to specify connections to

ports other than the defaults.

Path The path is a familiar concept to anyone who has ever used a

computer file system. The root of a web server corresponds

to a folder somewhere on that server.

Fragment This optional part is used as a way of requesting a portion of

a page and will scroll down to it.

Page 35: How the Web WorksA computer that is devoted to running a Database Management System (DBMS) • Mail servers. A computer creating and satisfying mail requests, typically using the Simple

Fundamentals of Web Development Randy Connolly and Ricardo Hoar

Query String

• Query strings are used to pass information such as user form input

from the client to the server. They will be covered in depth later.

• In URLs, they are encoded as key-value pairs delimited by “&”

symbols and preceded by the “?” symbol.

• Example, a typical YouTube video:

http://www.youtube.com/watch?v=ABC123

or http://youtu.be/ABC123

?username=john&password=abcdefg

Keys

ValuesDelimiters

35

Page 36: How the Web WorksA computer that is devoted to running a Database Management System (DBMS) • Mail servers. A computer creating and satisfying mail requests, typically using the Simple

Fundamentals of Web Development Randy Connolly and Ricardo Hoar

HYPERTEXT TRANSFER

PROTOCOL (HTTP)

Section 7 of 8

36

Page 37: How the Web WorksA computer that is devoted to running a Database Management System (DBMS) • Mail servers. A computer creating and satisfying mail requests, typically using the Simple

Fundamentals of Web Development Randy Connolly and Ricardo Hoar

HTTP

• The HTTP or Hypertext Transfer Protocol establishes a

TCP connection on port 80 (by default).

• The server waits for the request, and then responds with a

response code, headers and an optional message (which can

include files).

37

Page 38: How the Web WorksA computer that is devoted to running a Database Management System (DBMS) • Mail servers. A computer creating and satisfying mail requests, typically using the Simple

Fundamentals of Web Development Randy Connolly and Ricardo Hoar

Web Requests

• We might think of an entire page being returned in a single HTTP response, this is not in fact what happens.

• In reality the experience of seeing a single web page is facilitated by the client's browser which requests the initial HTML page, then parses the returned HTML to find all the resources referenced from within it, like images, style sheets and scripts.

• Only when all the files have been retrieved is the page fully loaded for the user.

• A single web page may require multiple resources, possibly from different domains.

38

Page 39: How the Web WorksA computer that is devoted to running a Database Management System (DBMS) • Mail servers. A computer creating and satisfying mail requests, typically using the Simple

Fundamentals of Web Development Randy Connolly and Ricardo Hoar

Browser parsing HTML and

making subsequent requests

39

Page 40: How the Web WorksA computer that is devoted to running a Database Management System (DBMS) • Mail servers. A computer creating and satisfying mail requests, typically using the Simple

Fundamentals of Web Development Randy Connolly and Ricardo Hoar

HTTP Headers

• Headers are one of the most powerful aspects of HTTP,

they define what kind of response the server will send.

• Request headers include data about the client machine.

• Web developers use this information for analytic reasons

and for site customization.

• Some the Request headers include: Host, User Agent ,

Accept, Connection,…

• Response headers have information about the server

answering the request and the data being sent.

40

Page 41: How the Web WorksA computer that is devoted to running a Database Management System (DBMS) • Mail servers. A computer creating and satisfying mail requests, typically using the Simple

Fundamentals of Web Development Randy Connolly and Ricardo Hoar

HTTP Request Methods

• The HTTP protocol defines several types of requests, each

with a different intent and characteristics.

• The most common requests are the GET and POST request.

41

Page 42: How the Web WorksA computer that is devoted to running a Database Management System (DBMS) • Mail servers. A computer creating and satisfying mail requests, typically using the Simple

Fundamentals of Web Development Randy Connolly and Ricardo Hoar

WEB SERVERS Section 8 of 8

42

Page 43: How the Web WorksA computer that is devoted to running a Database Management System (DBMS) • Mail servers. A computer creating and satisfying mail requests, typically using the Simple

Fundamentals of Web Development Randy Connolly and Ricardo Hoar

Web Servers

• A web server is, at a fundamental level, nothing more

than a computer that responds to HTTP requests.

• Regardless of the physical characteristics of the server,

one must choose an application stack to run a website.

• This stack will include an operating system, web server

software, a database and a scripting language to process

dynamic requests.

& Web Stacks

43

Page 44: How the Web WorksA computer that is devoted to running a Database Management System (DBMS) • Mail servers. A computer creating and satisfying mail requests, typically using the Simple

Fundamentals of Web Development Randy Connolly and Ricardo Hoar

LAMP Software Stack

• The used textbook will rely on the LAMP software stack,

which refers to:

• Linux operating system,

• Apache web server,

• MySQL database, and

• PHP scripting language.

• Many corporations make use of the Microsoft WISA

software stack, which refers to:

• Windows operating system,

• IIS web server,

• SQL Server database,

• ASP.NET server-side development technologies

vs. WISA software stack

44

Page 45: How the Web WorksA computer that is devoted to running a Database Management System (DBMS) • Mail servers. A computer creating and satisfying mail requests, typically using the Simple

Fundamentals of Web Development Randy Connolly and Ricardo Hoar

DEFINITIONS AND HISTORY Continue Section 1 of 8

45

Page 46: How the Web WorksA computer that is devoted to running a Database Management System (DBMS) • Mail servers. A computer creating and satisfying mail requests, typically using the Simple

Fundamentals of Web Development Randy Connolly and Ricardo Hoar

Web Apps Compared to Desktop Apps

Some of the advantages of web applications include:

1. Accessible from any internet-enabled computer.

2. Usable with different operating systems and browser

platforms.

3. Easier to roll out program updates since only need to update

software on server and not on every desktop in organization.

4. Centralized storage on the server means fewer concerns

about local storage (which is important for sensitive

information such as health care data).

46

First the advantages of web apps

Page 47: How the Web WorksA computer that is devoted to running a Database Management System (DBMS) • Mail servers. A computer creating and satisfying mail requests, typically using the Simple

Fundamentals of Web Development Randy Connolly and Ricardo Hoar

Web Apps Compared to Desktop Apps

Some of the disadvantages of web applications include:

1. Requirement to have a continues active internet connection.

2. Security concerns about sensitive private data being transmitted

over the internet.

3. Concerns over the storage, licensing and use of uploaded data.

4. Problems with certain websites on certain browsers not looking

quite right.

5. Limited access to the operating system can prevent software

and hardware from being installed or accessed (like Adobe

Flash on iOS).

Now the disadvantages of web apps

47

Page 48: How the Web WorksA computer that is devoted to running a Database Management System (DBMS) • Mail servers. A computer creating and satisfying mail requests, typically using the Simple

Fundamentals of Web Development Randy Connolly and Ricardo Hoar

Static Web Sites

• In the earliest days of the web, a webmaster (the term

popular in the 1990s for the person who was responsible for

creating and supporting a web site) would publish web pages,

and periodically update them.

• In those early days, the skills needed to create a web site were

pretty basic: one needed knowledge of the HTML markup

language and perhaps familiarity with editing and creating

images.

• This type of web site is commonly referred to as a static web

site, in that it consists only of HTML pages that look

identical for all users at all times.

Partying Like It’s 1995

48

Page 49: How the Web WorksA computer that is devoted to running a Database Management System (DBMS) • Mail servers. A computer creating and satisfying mail requests, typically using the Simple

Fundamentals of Web Development Randy Connolly and Ricardo Hoar

Static Web Sites

49

Page 50: How the Web WorksA computer that is devoted to running a Database Management System (DBMS) • Mail servers. A computer creating and satisfying mail requests, typically using the Simple

Fundamentals of Web Development Randy Connolly and Ricardo Hoar

Dynamic Web Sites

• Within a few years of the invention of the web, sites

began to get more complicated as more and more sites

began to use programs running on web servers to

generate content dynamically.

50

Page 51: How the Web WorksA computer that is devoted to running a Database Management System (DBMS) • Mail servers. A computer creating and satisfying mail requests, typically using the Simple

Fundamentals of Web Development Randy Connolly and Ricardo Hoar

Dynamic Web Sites

• These server-based programs would read content from

databases, interface with existing enterprise computer

systems, communicate with financial institutions, and

then output HTML that would be sent back to the users’

browsers.

• This type of web site is called here in this book a

dynamic web site because the page content is being

created at run-time by a program created by a

programmer; this page content can vary for user to user.

What are they?

51

Page 52: How the Web WorksA computer that is devoted to running a Database Management System (DBMS) • Mail servers. A computer creating and satisfying mail requests, typically using the Simple

Fundamentals of Web Development Randy Connolly and Ricardo Hoar

Web 2.0 and Beyond

• In the mid 2000s, a new buzz-word entered the

computer lexicon: web 2.0.

• This term had two meanings, one for users and

one for developers.

• For the users, Web 2.0 referred to an interactive

experience where users could contribute and

consume web content, thus creating a more user-

driven web experience.

52

Page 53: How the Web WorksA computer that is devoted to running a Database Management System (DBMS) • Mail servers. A computer creating and satisfying mail requests, typically using the Simple

Fundamentals of Web Development Randy Connolly and Ricardo Hoar

Web 2.0

• For software developers, Web 2.0 also referred to a

change in the paradigm of how dynamic web sites are

created.

• Programming logic, which previously existed only on

the server, began to migrate to the browser.

• This required learning Javascript, a rather tricky

programming language that runs in the browser, as well

as mastering the rather difficult programming

techniques involved in asynchronous communication.

Its meaning for developers

53

Page 54: How the Web WorksA computer that is devoted to running a Database Management System (DBMS) • Mail servers. A computer creating and satisfying mail requests, typically using the Simple

Fundamentals of Web Development Randy Connolly and Ricardo Hoar

What is an “Intranet”?

• One of the more common terms you might encounter in

web development is the term “intranet” (with an “a”),

which refers to an internet network that is local to an

organization or business.

• Intranet resources are often private, meaning that only

employees (or authorized external parties such as

customers or suppliers) have access to those resources.

• Thus Internet (with an “e”) is a broader term that

encompasses both private (intranet) and public networked

resources.

A short digression

54

Page 55: How the Web WorksA computer that is devoted to running a Database Management System (DBMS) • Mail servers. A computer creating and satisfying mail requests, typically using the Simple

Fundamentals of Web Development Randy Connolly and Ricardo Hoar

Intranet versus Internet

55

Page 56: How the Web WorksA computer that is devoted to running a Database Management System (DBMS) • Mail servers. A computer creating and satisfying mail requests, typically using the Simple

Fundamentals of Web Development Randy Connolly and Ricardo Hoar

SELF READING

56

Page 57: How the Web WorksA computer that is devoted to running a Database Management System (DBMS) • Mail servers. A computer creating and satisfying mail requests, typically using the Simple

Fundamentals of Web Development Randy Connolly and Ricardo Hoar

Communication Definitions

• Telephone networks provide a good starting place to learn

about modern digital communications.

• In the early days of telephone networks, calls were routed

through operators who physically connected caller and

receiver by connecting a wire to a switchboard to complete

the circuit.

We will begin with the telephone

57

Sec

tio

n 1

of

8

Page 58: How the Web WorksA computer that is devoted to running a Database Management System (DBMS) • Mail servers. A computer creating and satisfying mail requests, typically using the Simple

Fundamentals of Web Development Randy Connolly and Ricardo Hoar

Circuit Switching

• A circuit switching establishes an actual physical connection

between two people through a series of physical switches.

58

Sec

tio

n 1

of

8

Page 59: How the Web WorksA computer that is devoted to running a Database Management System (DBMS) • Mail servers. A computer creating and satisfying mail requests, typically using the Simple

Fundamentals of Web Development Randy Connolly and Ricardo Hoar

Circuit Switching

• Circuit Switching Weaknesses

• You must establish a link, and maintain a dedicated circuit,

for the duration of the call

• Difficult to have multiple conversations simultaneously

• Wastes bandwidth since even the silences are transmitted,

unused capacity in the network is not being used efficiently

Its Limitations

59

Sec

tio

n 1

of

8

Page 60: How the Web WorksA computer that is devoted to running a Database Management System (DBMS) • Mail servers. A computer creating and satisfying mail requests, typically using the Simple

Fundamentals of Web Development Randy Connolly and Ricardo Hoar

Packet Switching

• While packet switching may seem a more complicated

and inefficient approach than circuit switching, it is:

• more robust as it is not reliant on a single pathway that

may fail

• a more efficient use of network resources, since a

circuit can be use to communicate and transmit data

between multiple connections

Isn’t this more complicated?

60

Sec

tio

n 1

of

8

Page 61: How the Web WorksA computer that is devoted to running a Database Management System (DBMS) • Mail servers. A computer creating and satisfying mail requests, typically using the Simple

Fundamentals of Web Development Randy Connolly and Ricardo Hoar

Packet Switching

61

Sec

tio

n 1

of

8

Page 62: How the Web WorksA computer that is devoted to running a Database Management System (DBMS) • Mail servers. A computer creating and satisfying mail requests, typically using the Simple

Fundamentals of Web Development Randy Connolly and Ricardo Hoar

TCP/IP

• In addition to ARPANET, other networks were created such as

X.25 and USENET.

• To promote the growth and unification of the disparate

networks a suite of protocols was invented to unify the

networks together.

• By 1981, new networks built in the US began to adopt the

TCP/IP (Transmission Control Protocol / Internet

Protocol) communication model while older networks were

transitioned over to it.

• Any organization, private or public, could potentially connect

to this new network so long as they adopted the TCP/IP

protocol.

62

Rides to the rescue

Sec

tio

n 1

of

8

Page 63: How the Web WorksA computer that is devoted to running a Database Management System (DBMS) • Mail servers. A computer creating and satisfying mail requests, typically using the Simple

Fundamentals of Web Development Randy Connolly and Ricardo Hoar

Tim Berners-Lee

• The invention of the WWW is usually attributed to the British

Tim Berners-Lee, who, along with the Belgian Robert Cailliau,

published a proposal in 1990 for a hypertext system while both

were working at CERN in Switzerland.

I meant Sir Tim Berners-Lee

"Sir Tim Berners-Lee" by Paul Clarke - Own work. Licensed

under CC BY-SA 4.0 via Commons -

https://commons.wikimedia.org/wiki/File:Sir_Tim_Berners-

Lee.jpg#/media/File:Sir_Tim_Berners-Lee.jpg

63

First WWW Web Page http://info.cern.ch/

Sec

tio

n 1

of

8

Page 64: How the Web WorksA computer that is devoted to running a Database Management System (DBMS) • Mail servers. A computer creating and satisfying mail requests, typically using the Simple

Fundamentals of Web Development Randy Connolly and Ricardo Hoar

IP addresses and the Internet

64

Sec

tio

n 2

of

8

Page 65: How the Web WorksA computer that is devoted to running a Database Management System (DBMS) • Mail servers. A computer creating and satisfying mail requests, typically using the Simple

Fundamentals of Web Development Randy Connolly and Ricardo Hoar

IP Addresses

• IPv4 addresses are the IP addresses from the original

TCP/IP protocol.

• In IPv4, 12 numbers are used (implemented as four 8-bit

integers), written with a dot between each integer.

• Since an unsigned 8-bit integer's maximum value is 255,

four integers together can encode approximately 4.2

billion unique IP addresses.

• These range from 0.0.0.0 to 255.255.255.255, but many

are, in fact, reserved or unusable.

Two types

65

Sec

tio

n 2

of

8

Page 66: How the Web WorksA computer that is devoted to running a Database Management System (DBMS) • Mail servers. A computer creating and satisfying mail requests, typically using the Simple

Fundamentals of Web Development Randy Connolly and Ricardo Hoar

IP Addresses

• To future proof the Internet against the 4.2 billion limit, a

new version of the IP protocol was created, IPv6.

• This newer version uses eight 16-bit integers for 2128 unique

addresses, over a billion times the number in IPv4.

• These 16-bit integers are normally written in hexadecimal,

due to their longer length.

• According to Google statistics, only 10% of users access

Google over IPv6 (Jan 2016)

(https://www.google.com/intl/en/ipv6/statistics.html)

Two types

66

Sec

tio

n 2

of

8

Page 67: How the Web WorksA computer that is devoted to running a Database Management System (DBMS) • Mail servers. A computer creating and satisfying mail requests, typically using the Simple

Fundamentals of Web Development Randy Connolly and Ricardo Hoar

IP Addresses

• Your IP address will generally be assigned to you by your Internet

Service Provider (ISP).

• In organizations, large and small, purchasing extra IP addresses

from the ISP is not cost effective.

• In a local network, computers can share a single IP address

between them.

Inside of networks is different

67

Sec

tio

n 2

of

8

Page 68: How the Web WorksA computer that is devoted to running a Database Management System (DBMS) • Mail servers. A computer creating and satisfying mail requests, typically using the Simple

Fundamentals of Web Development Randy Connolly and Ricardo Hoar

TCP Packets

68

Sec

tio

n 2

of

8

Page 69: How the Web WorksA computer that is devoted to running a Database Management System (DBMS) • Mail servers. A computer creating and satisfying mail requests, typically using the Simple

Fundamentals of Web Development Randy Connolly and Ricardo Hoar

Client-Server Model

• The web is sometimes referred to as a client-server model of

communications.

• In the client-server model, there are two types of actors:

clients and servers.

• The server is a computer agent that is normally active 24/7,

listening for queries from any client who makes a request.

• A client is a computer agent that makes requests and receives

responses from the server.

What is it?

69

Sec

tio

n 3

of

8

Page 70: How the Web WorksA computer that is devoted to running a Database Management System (DBMS) • Mail servers. A computer creating and satisfying mail requests, typically using the Simple

Fundamentals of Web Development Randy Connolly and Ricardo Hoar

Request-Response Loop

• Within the client-server model, the request-response

loop is the most basic mechanism on the server for

receiving requests and transmitting data in response.

• The client initiates a request to a server and gets a

response that could include some resource like an HTML

file, an image or some other data.

70

Sec

tio

n 3

of

8

Page 71: How the Web WorksA computer that is devoted to running a Database Management System (DBMS) • Mail servers. A computer creating and satisfying mail requests, typically using the Simple

Fundamentals of Web Development Randy Connolly and Ricardo Hoar

The Peer-to-Peer Alternative

• In the peer-to-peer model

where each computer is

functionally identical, each node

is able to send and receive

directly with one another.

• In such a model each peer acts

as both a client and server able

to upload and download

information.

Not actually illegal

71

Sec

tio

n 3

of

8

Page 72: How the Web WorksA computer that is devoted to running a Database Management System (DBMS) • Mail servers. A computer creating and satisfying mail requests, typically using the Simple

Fundamentals of Web Development Randy Connolly and Ricardo Hoar

Server Types

72

Sec

tio

n 3

of

8

Page 73: How the Web WorksA computer that is devoted to running a Database Management System (DBMS) • Mail servers. A computer creating and satisfying mail requests, typically using the Simple

Fundamentals of Web Development Randy Connolly and Ricardo Hoar

Server Types

• Web servers: A computer servicing HTTP requests.

• Application servers: A server that hosts and executes web

applications.

• Database servers. A computer that is devoted to running a

Database Management System (DBMS)

• Mail servers. A computer creating and satisfying mail requests,

typically using the Simple Mail Transfer Protocol (SMTP) for

sending mail.

• Media servers (streaming server) : is a special type of server

dedicated to servicing requests for images and videos.

• Authentication servers. An authentication server handles the

most common security needs of web applications.

73

Sec

tio

n 3

of

8

Page 74: How the Web WorksA computer that is devoted to running a Database Management System (DBMS) • Mail servers. A computer creating and satisfying mail requests, typically using the Simple

Fundamentals of Web Development Randy Connolly and Ricardo Hoar

Real-World Server Installations

• There is often replication of each of the different server

types

• A busy site can receive thousands or even tens of

thousands of requests a second; globally popular sites

such as Facebook receive millions of requests a

second.

• A single web server that is also acting as an application or

database server will be hard-pressed to handle more than a

few hundred requests a second, so the usual strategy for

busier sites is to use a server farm.

74

Sec

tio

n 3

of

8

Page 75: How the Web WorksA computer that is devoted to running a Database Management System (DBMS) • Mail servers. A computer creating and satisfying mail requests, typically using the Simple

Fundamentals of Web Development Randy Connolly and Ricardo Hoar

Server Farms

• Server farms goal is to distribute incoming requests between

clusters of machines so that any given web or data server is

not excessively overloaded.

• Special routers called load balancers distribute incoming

requests to available machines.

• Even if a site can handle its load via a single server, it is not

uncommon to still use a server farm because it provides

failover redundancy.

• That is, if the hardware fails in a single server, one of the

replicated servers in the farm will maintain the site’s

availability.

75

Sec

tio

n 3

of

8

Page 76: How the Web WorksA computer that is devoted to running a Database Management System (DBMS) • Mail servers. A computer creating and satisfying mail requests, typically using the Simple

Fundamentals of Web Development Randy Connolly and Ricardo Hoar

Server Farm

76

Sec

tio

n 3

of

8

Page 77: How the Web WorksA computer that is devoted to running a Database Management System (DBMS) • Mail servers. A computer creating and satisfying mail requests, typically using the Simple

Fundamentals of Web Development Randy Connolly and Ricardo Hoar

Server Racks

• In a server farm, the computers

(servers) are staked. That is, a farm

will have its servers and hard drives

stacked on top of each other in

server racks.

• Each computer is also known as

blade computer.

• A typical server farm will consist

of many server racks, each

containing many servers.

77

Sec

tio

n 3

of

8

Page 78: How the Web WorksA computer that is devoted to running a Database Management System (DBMS) • Mail servers. A computer creating and satisfying mail requests, typically using the Simple

Fundamentals of Web Development Randy Connolly and Ricardo Hoar

Data Centers

• Most large web sites will exist in mirrored data centers in

different locations to prevent the potential for site down times.

• As a consequence, the costs for multiple redundant data centers

are quite high, and only larger web companies can afford to

create and manage their own.

• Most web companies will instead lease space from a third-

party data center.

• It is also common for the reverse to be true – that is, a single

server machine may host multiple sites.

• Large commercial web hosting companies others will

typically host hundreds or thousands of sites on a single

machine (or mirrored on several servers).

Where are they?

78

Sec

tio

n 3

of

8

Page 79: How the Web WorksA computer that is devoted to running a Database Management System (DBMS) • Mail servers. A computer creating and satisfying mail requests, typically using the Simple

Fundamentals of Web Development Randy Connolly and Ricardo Hoar

Data Centers

Server farms are typically housed in special facilities

called data centers.

Hypothetical Data Center

79

Sec

tio

n 3

of

8

Page 80: How the Web WorksA computer that is devoted to running a Database Management System (DBMS) • Mail servers. A computer creating and satisfying mail requests, typically using the Simple

Fundamentals of Web Development Randy Connolly and Ricardo Hoar

Types of TLDs

• Generic top-level domains (gTLD)

• Unrestricted: includes .com, .org, .net, .info, …

• Sponsored: .gov, .edu, .mil, .aero, …

• New: .buy, .news, .pizza, .london, …

• Country code top-level domain (ccTLD)

• .bh, .qa, .sa, .co.uk, .tv

• موقع.السعودية , امارات.دبي

• .arpa

• Used for reverse DNS lookups (i.e., finding the domain name of an IP address).

80

Sec

tio

n 5

of

8

Page 81: How the Web WorksA computer that is devoted to running a Database Management System (DBMS) • Mail servers. A computer creating and satisfying mail requests, typically using the Simple

Fundamentals of Web Development Randy Connolly and Ricardo Hoar

Name Registration

• Special organizations or companies called

domain name registrars manage the

registration of domain names.

• These domain name registrars are given

permission to do so by the appropriate generic

top-level domain (gTLD) registry and/or a

country code top-level domain (ccTLD)

registry.

81

Sec

tio

n 5

of

8

Page 82: How the Web WorksA computer that is devoted to running a Database Management System (DBMS) • Mail servers. A computer creating and satisfying mail requests, typically using the Simple

Fundamentals of Web Development Randy Connolly and Ricardo Hoar

Domain name registration process

82

Sec

tio

n 5

of

8

Page 83: How the Web WorksA computer that is devoted to running a Database Management System (DBMS) • Mail servers. A computer creating and satisfying mail requests, typically using the Simple

Fundamentals of Web Development Randy Connolly and Ricardo Hoar

HTTP Headers Common Request Headers

83

Request

Header

Description

Host it allows multiple websites to be hosted off the same IP

address.

User-Agent the most referenced header in modern web development. It

tells us what kind of operating system and browser the user

is running.

Accept It tells the server what kind of media types the client can

receive in the response.

Connection this header specifies whether the server should keep the

connection open, or close it after response.

Sec

tio

n 7

of

8

Page 84: How the Web WorksA computer that is devoted to running a Database Management System (DBMS) • Mail servers. A computer creating and satisfying mail requests, typically using the Simple

Fundamentals of Web Development Randy Connolly and Ricardo Hoar

HTTP Headers Common Response Headers

84

Response

Header

Description

Response

codes

are integer values returned by the server as part of the

response header.

Server tells the client about the server. It includes the type of

operating system the server is running as well as the web

server software that it is using.

Last-Modified contains information about when the requested resource

last changed.

Content-Type To accompany the request header Accept, it tells the

browser what type of data is attached in the body of the

message.

Content-

Length

specifies how large the response body (message) will be.

Sec

tio

n 7

of

8

Page 85: How the Web WorksA computer that is devoted to running a Database Management System (DBMS) • Mail servers. A computer creating and satisfying mail requests, typically using the Simple

Fundamentals of Web Development Randy Connolly and Ricardo Hoar

HTTP Response Codes

85

Sec

tio

n 7

of

8

Page 86: How the Web WorksA computer that is devoted to running a Database Management System (DBMS) • Mail servers. A computer creating and satisfying mail requests, typically using the Simple

Fundamentals of Web Development Randy Connolly and Ricardo Hoar

Browser Tools for HTTP

• Modern browsers provide the developer with

tools that can help us understand the HTTP

traffic for a given page.

86

Sec

tio

n 7

of

8

Page 87: How the Web WorksA computer that is devoted to running a Database Management System (DBMS) • Mail servers. A computer creating and satisfying mail requests, typically using the Simple

Fundamentals of Web Development Randy Connolly and Ricardo Hoar

What is an “Intranet”?

• Intranets are typically protected from unauthorized external

access via security features such as firewalls or private IP

ranges.

• Because intranets are private, search engines such as Google

have limited or no access to content within a private intranet.

• Due to this private nature, it is difficult to accurately gauge, for

instance, how many web pages exist within intranets, and what

technologies are more common in them.

• Some especially expansive estimates guess that almost half

of all web resources are hidden in private intranets.

87

Sec

tio

n 8

of

8

Page 88: How the Web WorksA computer that is devoted to running a Database Management System (DBMS) • Mail servers. A computer creating and satisfying mail requests, typically using the Simple

Fundamentals of Web Development Randy Connolly and Ricardo Hoar

Intranets and the Job Market

• Being aware of intranets is also important when one

considers the job market and market usage of different web

technologies.

• If one focuses just on the public internet, it will appear that,

for instance, PHP, MySQL, and WordPress, are absolutely

dominant in their market share.

• But when one adds in the private world of corporate

intranets, other technologies such as ASP.NET, JSP,

SharePoint, Oracle, SAP, and IBM WebSphere, are just as

important.

88

Sec

tio

n 8

of

8