networks, www, http - iit
TRANSCRIPT
Networks, WWW, HTTPWeb Technologies I.
Zsolt Tóth
University of Miskolc
2018
Zsolt Tóth (University of Miskolc) Networks, WWW, HTTP 2018 1 / 35
Networks Internet
Table of Contents
1 NetworksInternetResourcesClient–Server Model
2 World Wide WebOverviewHTTP Protocol
HTTP CommandsHTTP Status Codes
Zsolt Tóth (University of Miskolc) Networks, WWW, HTTP 2018 2 / 35
Networks Internet
Open Systems Interconnection Model
Conceptual modelnot realized directlyvarious implementations
Layered structureEach layer
uses below layersserves above layershas well–defined function
Zsolt Tóth (University of Miskolc) Networks, WWW, HTTP 2018 3 / 35
Networks Internet
Internet Protocol Suite
Zsolt Tóth (University of Miskolc) Networks, WWW, HTTP 2018 4 / 35
Networks Internet
Transmission Control Protocol / IP
packet–switchingreliableorderederror–checking
ApplicationsWorld Wide Web (HTTP)email (POP, IMAP, SMTP)FTPSSHDHCPDNS
Zsolt Tóth (University of Miskolc) Networks, WWW, HTTP 2018 5 / 35
Networks Resources
Resource
Static contentTextHTMLimageaudio / videobinary file (pdf, doc, etc.). . .
Dynamic contentService
SSHFTPHTTP
Generated contentCGIPHP, PythonJSP, ASPREST / JSON
Zsolt Tóth (University of Miskolc) Networks, WWW, HTTP 2018 6 / 35
Networks Resources
Unified Resource Identifier
scheme:[//[user:password\@]host[:port]][/]path[?query][\#fragment]
Unified Resource LocatorLocation based identificationFits to computer networksUsage
web addressfile transferremote logindatabase access
Unified Resource NameName based identification
ISBN booksISSN journalsISAN audiovisual works
Zsolt Tóth (University of Miskolc) Networks, WWW, HTTP 2018 7 / 35
Networks Resources
URL Examples
http://www.origo.hu/index.htmlhttp://www.w3schools.com/http://localhost:8080/myApp/loginhttp://localhost:8080/calculator/add?a=5&b=3imap://imap.iit.uni-miskolc.hu:143imaps://imap.iit.uni-miskolc.hu:993smtp://smtp.iit.uni-miskolc.hu:25ftp://ftp.iit.uni-miskolc.hujdbc:mysql://localhost:3306/sakila?profileSQL=true
Zsolt Tóth (University of Miskolc) Networks, WWW, HTTP 2018 8 / 35
Networks Resources
Hosts Address
IPv432bit = 4 bytexxx.xxx.xxx.xxxUnique address (NAT)
IPv6Compatibility with IPv4128bit = 16byteUnique address
SubnetsNet Mask32 bit255.255.255.0192.168.2.1/24
Network Address TranslationHide subnetsRequest from the Internet XService to the Internet X
Zsolt Tóth (University of Miskolc) Networks, WWW, HTTP 2018 9 / 35
Networks Resources
Domain Name System
IP address↔ domain nameHierarchical structure"." is the rootworld–widedecentralizedDNS ServersHosts belongs to one domainDomains contains multiplehosts
Internet Assigned NumbersAgencyTop Level Domain
Generic TLDgov, edu, net,com, org, mil
Country Code TLDhu, es, ru,au, gb, us
www.iit.uni-miskolc.hu.www.abc.net.au.
Zsolt Tóth (University of Miskolc) Networks, WWW, HTTP 2018 10 / 35
Networks Client–Server Model
Client–Server Model
SimpleCentralizedServer
provides service orresourceruns on a publicly availablecomputerwaits for requests fromarbitrary clients
Clientrequests resources fromserverruns locally
Zsolt Tóth (University of Miskolc) Networks, WWW, HTTP 2018 11 / 35
Networks Client–Server Model
Client–Server Model
Zsolt Tóth (University of Miskolc) Networks, WWW, HTTP 2018 12 / 35
Networks Client–Server Model
Client
Thin clientSimple application
Browser
Representation, visualizationNo business logic
Check values
Low hardware requirementsWeb applications
Thick (fat, rich) clientsComplex applicationsLot of functionalitiesIndependent from the serverHigher hardwarerequirementsOff–line workInstallation
for each clients¿ Versioning ?
Zsolt Tóth (University of Miskolc) Networks, WWW, HTTP 2018 13 / 35
Networks Client–Server Model
Server – Application
Application not computer!Waits for requestsSpecific purpose
Web serversMail serversApplication serversAuthentication serversFTP serversetc.
a computer – many serverapplications
Zsolt Tóth (University of Miskolc) Networks, WWW, HTTP 2018 14 / 35
Networks Client–Server Model
Server – Computer
Executes server applicationFix IP AddressHigh performance
Expensive hardwareHigh upkeepCustom OS
One or multiple computersGRIDCloud Computing
Server room, data centers
As a developer,you will run a web/applicationserver and a database serverlocally.you will use various servers(SCM, CI, Issue tracker, etc.)you may deploy yourapplication to test and demoservers for presentationpurposes.you will never want to operateserver. That is the job ofsystem administrators!
Zsolt Tóth (University of Miskolc) Networks, WWW, HTTP 2018 15 / 35
World Wide Web Overview
Table of Contents
1 NetworksInternetResourcesClient–Server Model
2 World Wide WebOverviewHTTP Protocol
HTTP CommandsHTTP Status Codes
Zsolt Tóth (University of Miskolc) Networks, WWW, HTTP 2018 16 / 35
World Wide Web Overview
History
Hypertext system1990-91 First web serverExpansion (’91-’95)Commercialization (’95-2000)Dot–com bubble (’97-2000)Present (since 2000)
UbiquitousSocial networkMultimediaSemantic web
Zsolt Tóth (University of Miskolc) Networks, WWW, HTTP 2018 17 / 35
World Wide Web Overview
Architecture
Zsolt Tóth (University of Miskolc) Networks, WWW, HTTP 2018 18 / 35
World Wide Web Overview
Web Server
ApplicationStatic IPListen on port (80,8080,. . . )Communicate via HTTP
Major providersMarket share of active sites(Netcraft Sept 2015)
1 Apache (≈50.5%)2 nginx (≈14.3%)3 Microsoft (≈10.2%)4 Google (≈7.8%)
Zsolt Tóth (University of Miskolc) Networks, WWW, HTTP 2018 19 / 35
World Wide Web Overview
HyperText Transfer Protocol
Application LayerInformation SystemsRequests and responsesDefines
Methods / verbsStatus codes
Designed to exchange HTMLdocuments
HTTPSis not a standalone protocoluses secure communication
Secure Socket LayerTransport Layer Security
Zsolt Tóth (University of Miskolc) Networks, WWW, HTTP 2018 20 / 35
World Wide Web Overview
HTML
Plain TextTagsStandardBrowsers
visualizeinterpret
1 <html><head>
3 <!-- Meta data --></head>
5 <body><!-- Content -->
7 </body></html>
Zsolt Tóth (University of Miskolc) Networks, WWW, HTTP 2018 21 / 35
World Wide Web Overview
Browser
ChallengesBrowsers visualize the sameHTML standardizeddifferently.So sites have to be optimizedto browser (IE)Customers have specialneeds:
we want to include videosso please use HTML 5the site has to becompatible with InternetExplorer 7
Zsolt Tóth (University of Miskolc) Networks, WWW, HTTP 2018 22 / 35
World Wide Web Overview
Browser
Zsolt Tóth (University of Miskolc) Networks, WWW, HTTP 2018 23 / 35
World Wide Web HTTP Protocol
HTTP Protocol
Application protocolData communicationVersions
HTTP/0.9HTTP/1.0HTTP/1.1HTTP 2.0
DefinesMethodsStatus codes
Typical clientsBrowsersWeb robotsMobil applications
Zsolt Tóth (University of Miskolc) Networks, WWW, HTTP 2018 24 / 35
World Wide Web HTTP Protocol
HTTP Methods
HEADGETPOSTPUTDELETE
TRACEOPTIONSCONNNECTPATCH
Zsolt Tóth (University of Miskolc) Networks, WWW, HTTP 2018 25 / 35
World Wide Web HTTP Protocol
GET, HEAD
GETsafeidempotentRequest a pageURL encoding
GET path HTTP/1.1
HEADsafeidempotentRequest the head part onlyRetrieve meta–information
HEAD path HTTP/1.1
Zsolt Tóth (University of Miskolc) Networks, WWW, HTTP 2018 26 / 35
World Wide Web HTTP Protocol
POST, PUT, DELETE, PATCH
POSTRequest a pageParameters are encoded inthe requestCan send more data than GET
Form dataFile upload
PUTStore an entity.IdempotentFile upload
DELETERemoves an entity.Idempotent
PATCHPartial modification of anentity.
Zsolt Tóth (University of Miskolc) Networks, WWW, HTTP 2018 27 / 35
World Wide Web HTTP Protocol
CONNECT, OPTIONS, TRACE
CONNECTuse tunnel such as SSL
OPTIONSQuery HTTP methodssupported.
TRACEEcho HTTP request.
Web servers not alwayssupports all of these methods!You can check them withtelnet or netcat.
Zsolt Tóth (University of Miskolc) Networks, WWW, HTTP 2018 28 / 35
World Wide Web HTTP Protocol
HTTP Status Codes
Part of the responseSent by the serverClients computesImportant for AJAX, REST
Categories1XX Informational2XX Successful3XX Redirection4XX Bad Request5XX Sever Error
Zsolt Tóth (University of Miskolc) Networks, WWW, HTTP 2018 29 / 35
World Wide Web HTTP Protocol
1XX
HTTP/1.1to switch from HTTP/1.0 toHTTP/1.1Unknown 1XX→ Ignore
100 Continue101 Switching Protocols
HTTP/1.0↓
HTTP/1.1
102 Processing
Zsolt Tóth (University of Miskolc) Networks, WWW, HTTP 2018 30 / 35
World Wide Web HTTP Protocol
2XX
Requestreceivedunderstoodacceptedprocessed
200 OKGET HEADPOST TRACE
201 Created202 Accepted203 Non–Authoritative
Information204 No Content205 Reset content206 Partial cntent
Zsolt Tóth (University of Miskolc) Networks, WWW, HTTP 2018 31 / 35
World Wide Web HTTP Protocol
3XX
for the User AgentBrowser modifies therequest automatically.Caused by
site moved.usage of proxyredirection
300 Multiple chices301 Moved Permanently302 Found303 See Other304 Not Modified305 Use Proxy306 Unused307 Temporary Redirect
Zsolt Tóth (University of Miskolc) Networks, WWW, HTTP 2018 32 / 35
World Wide Web HTTP Protocol
4XX
Zsolt Tóth (University of Miskolc) Networks, WWW, HTTP 2018 33 / 35
World Wide Web HTTP Protocol
4XX
Bad RequestClient–side problemAny request can cause it.Examples:
bad web addressauthentication required
400 Bad Request401 Unauthorized402 Payment Required403 Forbidden404405 Method Not Allowed406 Not Acceptable. . .
Zsolt Tóth (University of Miskolc) Networks, WWW, HTTP 2018 34 / 35
World Wide Web HTTP Protocol
5XX
Server ErrorCan be caused by anyrequest.There is a problem at theserver side.All users, who use thesystem, will get the errorcode.For example,
exception do not handleddatabase unavailable
It can show the poor job of thedevelopers.
501 Not Implemented502 Bad Gateway503 Servie Unavailable504 Gateway Timeout505 HTTP Version Not
Supported
Zsolt Tóth (University of Miskolc) Networks, WWW, HTTP 2018 35 / 35