03 Web Architecture & HTTP_PR_TM
-
Upload
anitkumardas -
Category
Documents
-
view
215 -
download
0
Transcript of 03 Web Architecture & HTTP_PR_TM
-
7/31/2019 03 Web Architecture & HTTP_PR_TM
1/17
www.netskills.ac.uk
Web Architecture:HTTP, URIs & URLs
-
7/31/2019 03 Web Architecture & HTTP_PR_TM
2/17
CSC1014
JISC Netskills
Some NETWORK terms
Term Definition
Host Machine connected to a networkPacket Basic unit of Internet communicationIP Internet Protocol to coordinate delivery of individual packets
between hostsIP address Numerical address for an Internet hostHostname Case-insensitive string identifier for an Internet hostDNS DistributedDomain Name System to translate between IP
addresses and hostnamesConnection Logical communication channel between hostsTCP
Transmission Control Protocol providing abstraction of a reliable,bidirectional connection
-
7/31/2019 03 Web Architecture & HTTP_PR_TM
3/17
CSC1014
JISC Netskills
Some WEB terms
Term Definition
Web Network of interlinked informationHypertext Linking related information for navigationInternet Worldwide network of networks using IPWeb page Document accessible on the Web via a URIWeb site Collection of related Web pagesBrowser/Web Client Application (user agent) to request and display Web pagesWeb server Program that receives & responds to HTTP requestOrigin server Server where requested resource residesIntermediary Web component in the request path between client and origin
server (proxies, gateways)
-
7/31/2019 03 Web Architecture & HTTP_PR_TM
4/17
CSC1014
JISC Netskills
Web architecture:Key Components
HTTP/1.1: HyperText Transfer ProtocolFormat and semantics of request/response messages
URI: Uniform Resource IdentifierFormatted string that identifies a resource
HTML/XHTML: HyperText Markup Language
Plus
DNS: Domain Name System
TCP/IP: Internet Protocol Suite
-
7/31/2019 03 Web Architecture & HTTP_PR_TM
5/17
CSC1014
JISC Netskills
URI: Anatomy
A Uniform Resource Identifier identifies a resource on theinternet and is independent of current location
Generic
Scheme Authority Path Query Fragment
http: //www.cs.ncl.ac.uk /teaching/ ?m=3504 #cwork
https://internal.cs.ncl.ac.uk/modules/2011-12/csc3504/https://internal.cs.ncl.ac.uk/modules/2011-12/modules.php?m=3504https://internal.cs.ncl.ac.uk/modules/2011-12/csc3504/index.html#cwork
Scheme specific
Scheme Scheme specific syntax Query
mailto: [email protected] ?subject=Hello
Mail me
-
7/31/2019 03 Web Architecture & HTTP_PR_TM
6/17
CSC1014
JISC Netskills
When is a URI a URL?
Uniform Resource Locator
http: is a URI schemeand
an http: URI is a URL
"...a URL is a type of URI that identifies a resource via a representation of itsprimary access mechanism (e.g., its network "location"), rather than by some
other attributes it may have."http://www.w3.org/TR/uri-clarification/#contemporary
http://www.w3.org/TR/uri-clarification/http://www.w3.org/TR/uri-clarification/http://www.w3.org/TR/uri-clarification/http://www.w3.org/TR/uri-clarification/ -
7/31/2019 03 Web Architecture & HTTP_PR_TM
7/17
CSC1014
JISC Netskills
HTTP:A request-response protocol
HyperText Transfer Protocol makes the Web work! Clientsask for resources from servers by assembling and sending an
HTTP requestmessage Serversrespond with the appropriate HTTP responsemessage, including
any content to be displayed
HTTP requests & responses travel as TCP/IP packets: Metadata in headers& content in an (optional) entity body
HTTP is stateless Each request/response pair is an independent exchange. No protocol level maintenance of state (for scalability)
-
7/31/2019 03 Web Architecture & HTTP_PR_TM
8/17
-
7/31/2019 03 Web Architecture & HTTP_PR_TM
9/17
CSC1014
JISC Netskills
HTTP methods
The operations carried out over HTTP HEAD, GET, POST, PUT, DELETE etc
HEAD and GET are mandatory (all resources support them) Others are optional (depends on what you're up to)
GET returns current state and content of resource
This is the "default" method for HTTP
HEAD just returns response metadata i.e. a GET without the body (content)
-
7/31/2019 03 Web Architecture & HTTP_PR_TM
10/17
CSC1014
JISC Netskills
HTTP headers
Headers are the metadata for the request/response exchange
Some are generic and apply to both request and response e.g.Date -> the date/time stamp for the messageCache-Control -> instructions for en-route caching (or not)
Understanding the reading, setting and manipulation HTTP
headers is very useful for managing a web site
Be aware that headers can be spoofed not good!
-
7/31/2019 03 Web Architecture & HTTP_PR_TM
11/17
CSC1014
JISC Netskills
More HTTP Headers
Request headers (19 in total in 4 classes)Response preferences -> Accept, Accept-Charsetetc
Additional request info -> Authorization, From etcConditional headers -> If-Modified-SinceetcConstrain server behaviour -> Max-Forwardsetc
Response headers (9 in total in 4 classes)Redirection -> Location
Additonal information -> Server, Retry-AfteretcAuthentication -> WWW-Authenticate, Proxy-AuthenticateCaching -> Age etc
Entity & Hop-by-hop headers Info about the resource (content) Content-Typeetc Hop-by-hops can be read, stripped or added to en-route
-
7/31/2019 03 Web Architecture & HTTP_PR_TM
12/17
CSC1014
JISC Netskills
Common HTTP methods
Method Use Safe* Idempotent** Mandatory
HEAD Exchange of request/response
headersYes Yes Yes
GETRequest and return the currentstate and content of a resource e.g.access a web page
Yes Yes Yes
POSTRequest uses entity body to updateresource or as input for processinge.g. form input
No No No
PUTServer stores entity body contentsat request URI location e.g. fileuploads
No Yes No
DELETE Deletes identified resource i.e.opposite of PUT
No Yes No
* Safe does not change state of resource
** Idempotent... the side effects of repeated, identical requests are the same as for a single request
-
7/31/2019 03 Web Architecture & HTTP_PR_TM
13/17
CSC1014
JISC Netskills
HTTP response codes
Generated by the server tell a client the status of a request 41 response codes in total (some you'll never see!)
Class Range Examples
Informational 1XX100 Continue101 Switching Protocols
Success 2XX200 OK201 Created204 NoContent
Redirection 3XX 300 MultipleChoices301 MovedPermanently
Client Error 4XX
400 BadRequest401 Unauthorized403 Forbidden404 NotFound
Server Error 5XX 500 InternalServerError
-
7/31/2019 03 Web Architecture & HTTP_PR_TM
14/17
CSC1014
JISC Netskills
Basic HTTP request structure
Request line GET /index.html HTTP/1.1
General headers Date: Mon, 11 Oct 2010 11:00:00
Request headers Host: www.internal.cs.ncl.ac.ukUser-Agent: Mozilla/5.0
Entity & Hop-by-hopheaders
CRLF
Entity body
-
7/31/2019 03 Web Architecture & HTTP_PR_TM
15/17
CSC1014
JISC Netskills
Basic HTTP response structure
Status line HTTP/1.1 200 OK
General headers Date: Mon, 11 Oct 2010 11:00:01
Response headers Server: Apache/2.2.16 (Unix)
Entity headers Content-Length: 4488Content-Type: text/html
Hop-by-hop headers
CRLF
Entity body
XHTML WEB PAGE CONTENT
-
7/31/2019 03 Web Architecture & HTTP_PR_TM
16/17
CSC1014
JISC Netskills
Proxies and caches
A proxy acts as a server to clients and as a client to other proxiesor to an origin server
Use to share access, to anonymise clients, as a gateway to othersystems, as a filter/firewall, as a cache
A cache stores HTTP messages to reduce user-perceived latency,network traffic and server load
HTTP provides extensive cache control support (what can/cannot becached, when to invalidate entries etc.)
-
7/31/2019 03 Web Architecture & HTTP_PR_TM
17/17