You are on page 1of 36

Chapter One

Internet Programming

Introduction to Web Pages

1
Chapter Objectives

 A general understanding of the fundamentals of the Internet and


WWW
 To discuss the architecture of WWW and describe the concepts of
hypertext and hypermedia.
 To describe Web clients and Web servers and their components.
 To define URL as a tool to identify a Web server.
 To discuss HTTP and its transactions.
 To define and list the fields in a request message.
 Introduction to terms and acronyms

2
Networking
• Networks are systems that are formed by links.
• People use different types of networks every day:
–Mail delivery system
–Telephone system
–Corporate computer network
–The Internet

• Computers can be linked by networks to share


data and resources.
• A network can be as simple as two computers
connected by a single cable or as complex as
hundreds of computers connected to devices that
What is the Internet
• Most people today have had exposure to the Internet at
school, in their homes, at their jobs, or at their local library.
• The Internet is a worldwide collection of computers and
computer networks that links billions of computers used by
businesses, government, educational institutions,
organizations, and individuals using modems, phone lines,
television cables, satellite links, fiber-optic connections, and
other communications devices and media
 There are, however, several major International organizations that help
manage the Internet so that everyone uses the same rules.
Internet
 In business, large networks can be used to advertise
and sell products, order supplies, and communicate
with customers.
 Communication over a network is usually more
efficient and less expensive than traditional forms of
communication, such as regular mail or long distance
phone calls.
 The Internet is considered a "network of networks"
because it is literally made up of millions of networks
that are connected to each other.
Here are other uses of a network and the Internet:
– Sharing music and video files
– Research and on-line learning
– Chatting with friends
– Planning vacations
– Purchasing gifts and supplies
Internet Service Providers (ISP)
• An Internet service provider (ISP) is a company that has a permanent
connection to the Internet backbone
• ISPs utilize high- or medium-speed data lines to allow individuals and
companies to connect to the backbone for access to the Internet.
 Any home, business or organization that wants to connect to the Internet
must use an Internet Service Provider (ISP).
 An ISP is a company that provides the connections and support to
access the Internet.
 It can also provide additional services such as Email and web hosting.
The Internet
IP Address
IP stands for “Internet protocol” which is a set of rules governing the
format of data sent via the Internet or local network.
IP addresses are the identifier that allows information to be sent
between devices on a network.
they contain location information and make devices accessible for
communication.
IP is a simple protocol for attempting to send data
between two computers
every node has a unique numeric address
IPV4 - 32bit
IPV6 - 128bit
an IP address can correspond to a domain

Internet Programming lec 7


The Internet
Transmission Control Protocol (TCP) adds multiplexing,
guaranteed message delivery on top of IP
multiplexing: multiple programs using the same IP
address
port: a number given to each program or service
port 80: web browser (port 443 for secure browsing)
port 25: email
port 22: ssh
Port 23:telnet
IP + TCP = TCP/IP
some programs (games, streaming media programs) use
simpler UDP protocol instead of TCP

Internet Programming lec 8


World Wide Web
 The World Wide Web, also called the Web, is the part
of the Internet that supports multimedia and consists of
a collection of linked documents.
 To support multimedia, the Web relies on the
Hypertext Transfer Protocol (HTTP), which is a set of
rules for exchanging text, graphic, sound, video, and
other multimedia files.
Elements of a WWW
Sever and Client
Web browser
Webpage/ website
URL
DNS 9
Internet Programming lec
Elements of a WWW
 The linked documents, or pages of information, on the Web are
known as Web pages.
 Because the Web supports text, graphics, sound, and video, a
Web page can include any of these multimedia elements.
 A Web site is a related collection of Web pages that is created
and maintained by an individual, company, educational
institution, or other organization.
 Each Web site contains a home page

10
• Web pages are stored on a Web server, or host, which is
a computer that stores and sends (serves) requested Web
pages and other files.
• Any computer that has Web server software installed and
is connected to the Internet can act as a Web server.
• Every Web site is stored on, and runs from, one or more
Web servers. A large Web site may be spread over
several servers in different geographic locations.
• In order to make the Web pages that you have developed
available to your audience, you have to publish those
pages.

11
 Publishing is copying the Web pages and
associated files such as graphics and audio to
a Web server
 Once a Web page is published, anyone who
has access to the Internet can view it,
regardless of where the Web server is located.
 Once a Web page is published, it can be read
by almost any computer: whether you use the
Mac, Windows, or Linux operating system, with
a variety of computer hardware, you have
access to billions of published Web pages
12
WWW, Cont…

 A communications protocol is simply a set of


rules that computers use to communicate over
a network
– The Hypertext Transfer Protocol (HTTP) is a
protocol that computers use to communicate on the
WWW.
– HTTPS is the secure version of HTTP, which is used
when sensitive information such as bank details are
being exchanged.

13
Web Browsers
• People access websites using software called a web
browser. Popular examples include Firefox, Internet
Explorer, Safari, Chrome, and Opera.
• A Web browser, also called a browser, is a program
that interprets and displays Web pages and enables
you to view and interact with a Web page.
 Microsoft Internet Explorer, Mozilla Firefox, and Apple
Safari are popular browsers today.
 To locate a Web page using a browser, you type the
Web page’s Uniform Resource Locator (URL) in the
browser’s Address or Location bar.

14
WWW, Cont…

 A Uniform Resource Locator (URL) is the address of


a document or other file accessible on the Internet. An
example of a URL on the Web is:
http://www.google.com

15
World Wide Web
Uniform Resource Locator (URL)

an identifier for the location of a document on a web site


a basic URL:
http://www..com/info/regesstepp/index.html
protocol host path
upon entering this URL into the browser, it would:
ask the DNS server for the IP address of www.google.com
connect to that IP address at port 80
ask the server to GET /info/regesstepp/index.html
display the resulting page on the screen

Internet Programming lec 16


Uniform Resource Locators (URLs)

 Standard way of specifying entities on networks


 First part - protocol
– terminated by colon ( : )
– common protocols are http, ftp, mailto, telnet,

 Second part - varies according to protocol


– mailto - e-mail address e.g.:
 mailto: David.Brailsford@nottingham.ac.uk

– resource-oriented protocols (http, ftp etc)


 Host name + domain names (preceded by //)
– may optionally include username, password and port

 Pathname (usually related to the path of a file on the server)


 i.e. //fully-qualified-domain-name/path-to-document

17
World Wide Web
Domain Name System (DNS)
a set of servers that map written names to IP
addresses
because names are easier to remember than IP addresses
Example: www.cps.gordon.edu → 216.236.251.139
many systems maintain a local cache called a hosts
file (looking up domain names is expensive)
Windows: C:\Windows\system32\drivers\etc\hosts
Mac: /private/etc/hosts
Linux: /etc/hosts

Internet Programming lec 18


WWW, Cont…

 Most web pages are written in a special


language called the Hypertext Markup
Language (HTML).
 HTML pages consist of text together with
formatting instructions, graphics and audio.
 XML (Extensible Markup Language) is an
alternative to HTML.
– HTML pages describe the format of the data’s
presentation, pages written in XML describe only
how the data is structured.

19
WWW, Cont…
 W3C
– The World Wide Web Consortium is a group of
experts who meet regularly to develop common
protocols for the evolution of the WWW.
– The W3C agrees on standards for HTML, XML and
other web technologies, and for how web browsers
should interpret them.
– The most essential Web standard are HTML, CSS,
and XML.
20 – The latest HTML standard is HTML 5.
Hyperlink
 Hyperlinks are an essential part of the World Wide
Web.
 A hyperlink, also called a link, is an element used to
connect one Web page to another Web page that’s
located on the same server or used to link Web pages
located on a different Web server located anywhere in
the world.
 Clicking a hyperlink allows you to move quickly from
one Web page to another, and the user does not have
to be concerned about where the Web pages reside.
 You also can click hyperlinks to move to a different
section of the same Web page

21
The client server paradigm

 A widely used form of communication


 Server application waits passively for contact from
clients
 A server provides a specific service
 Client application actively initiates contact with the
server
 Information can flow in both directions
 Typical situation is many clients interacting with
each server

22
Architecture of WWW

23
HTTP Request

• Delivered from a client to a server containing instructions for the


server
• Contains
– the method to be applied to the data resource
– the identifier of the resource
– the protocol version in use
• Most commonly used methods:
– GET - Fetch a document
– HEAD - Fetch just the header of the document
– POST - Execute the document, using the data in body
– PUT - Store a new document on the server
– DELETE - Remove a document from the server

24
Request and response messages

25
Request message

General request message structure


METHOD /path-to-resource HTTP/version-number
Header-Name-1: value
Header-Name-2: value

[optional request body]

Example
GET /index.html HTTP/1.1
Host: www.cs.nott.ac.uk
Accept: text/*
User-Agent: Mozilla/2.02Gold (Win 10)

26
HTTP Response

• Message generated by a server after receiving


and interpreting a request
• Responses contain:
– Status line with the protocol version, a status code,
and a “reason phrase”
– Response-Header (containing information about the
server)
– Entity Header (meta-information)
– Entity Body (data)

27
Response message

General response message structure


HTTP/version-number status-code message
Response-Header-Name-1: value
Response-Header-Name-2: value
Entity-Header-Name-1: value
Entity-Header-Name-2: value Example
HTTP/1.1 200 OK
[optional entity body] Server: Apache (Red-Hat/Linux)
Content-Type: text/html
Content-Length: 9934

<HTML>
<HEAD>
<TITLE>School of Computer Science</TITLE>

28
Some HTTP Status Codes

• 200 : OK
• 201 : Created
• 202 : Accepted
• 204 : No Content
• 301 : Moved Permanently
• 302 : Moved Temporarily
• 400 : Bad Request
• 401 : Unauthorized
• 403 : Forbidden
• 404 : Not Found
• 500 : Internal Server Error
• 503 : Service Unavailable

29
Multipurpose Internet Mail
Extensions (MIME)

Convention for specifying content type of a


message
In HTTP, typically used to specify content type of the
body of the response
MIME content type syntax
Top – level type / subtype
Examples: text/ html, image/ jpeg

Internet Programming lec 30


Multipurpose Internet Mail
Extensions (MIME)

sometimes when including resources in a page


(style sheet, icon, multimedia object), we
specify their type of

Internet Programming lec 31


HTTP Request

Common header fields:


Host: host name from URL (required)
User – Agent : type of browser sending request
Accept : MIME type of acceptable documents
Connection: value CLOSE tells server to close connection after single
request/response
Content-Type: MIME type of (POST) body, normally application/x-
www-form-url encoded
Content-Length: bytes in body
Referer: URL of document containing link that supplied URI for this
HTTP request

Internet Programming lec 32


HTTP Response

Very similar to requests


Structure of the response:
Status line
Header field(s)
Blank line
Optional body
Eg. http/1.1
Date Mon,24 oct 2016 15:19:10 GMT
Server Appache 13.0.4 ( Red Hat Linux )
Last_Modified Sat,14 oct 2016 04:12:00 GMT
Accept Range :byte
Content _ length 288
Connection : Close

Internet Programming lec 33


HTTP Response

Status code is a three digits number


The first digit specified the general status
1 informational 1xx request received still in process
2 Success 2xx Correct request processed correctly
3 Redirection 3xx the request must be repeated or
redirected
4 Client error 4xx the request cannot be processed
5 Server error 5xx the server has failed trying to process

Internet Programming lec 34


HTTP Response

When something goes wrong, the web server


returns a special “error code” number to the
browser, possibly followed by an HTML
document
Common error code

Internet Programming lec 35


Next Class

Web Technology and Tools

Internet Programming lec 36

You might also like