OpenHPI Web Technologies Week 2
OpenHPI Web Technologies Week 2
com/photos/jmt/3838802631
openHPI Web Technologies 2015
Week 2
Prof. Dr. Christoph Meinel
Hasso Plattner Institute
University of Potsdam, Germany
Photo by jmtosses CC BY-NC 2.0 https://www.flickr.com/photos/jmt/3838802631
openHPI
URI – Uniform Resource Identifier
Prof. Dr. Christoph Meinel
Hasso Plattner Institute
University of Potsdam, Germany
Introduction: URI (1/3)
URI syntax
■ URI are standardized by IETF and W3C in RFC 1630
■ Syntax of a URI: prefix : suffix
Prefix Suffix
Many RFCs deal with the definition of URL schemes and partly contradict
or deprecate prior versions (or even definitions in the same RFC)
Example 1 (1/4): user-part of a URL
■ RFC 1738, p.4 defines a common pattern for the scheme-specific part
of URLs
■ In summary:
□ Username, password, port and path are optional components
□ URLs starting with “//” follow a “common Internet scheme syntax”
■ …
HTTP
Client server
Browser requests
hypermedia document
Proxy server
Browser requests
hypermedia document
Cache
Answer to web browser
storage
WWW browser
Request ...
Origin server
Gateways
■ … work like proxy servers, but without the client‘s knowledge
■ … are located upstream WWW servers and ease their load or
implement security-related access restrictions
■ Well-known example of HTTP gateways are load balancers
Along with the URL addressing concept and the markup language HTML,
HTTP is a cornerstone of the World Wide Web
■ First HTTP version – HTTP/0.9 – originated in 1989/90
and was developed at CERN together with URL
■ First sophisticated version – HTTP/1.0 – was introduced in 1992
(RFC 1945)
□ Developmental goal: simple and fast communication protocol
□ HTTP/1.0 offers the following methods:
– GET – for the delivery of a requested document
– POST – for information transfer from client to server
In March 2012, the IETF working group responsible for HTTP officially
began work on HTTP/2 13 years (1) after adoption of HTTP/1.1 …
■ First proposals were already presented in May 2012, among them:
□ Google’s SPDY 3.0 (“Speedy”) and
□ Microsoft’s HTTP Speed+Mobility
■ August 2012:
□ IETF Working Group HTTPbis took SPDY as starting point for
discussion on the draft for HTTP/2
■ September 2014:
□ “Last Call for HTTP/2” (published by the Working Group HTTPbis)
■ December 16, 2014:
□ Working Group submitted HTTP/2 as Proposed Standard to IESG
■ …
History of HTTP | openHPI | Prof. Dr. Christoph Meinel 32
The Future (2/2): HTTP/2
HTTP – Message Format and Status Codes | openHPI | Prof. Dr. Christoph Meinel 1
HTTP: Generic Message Format
HTTP – Message Format and Status Codes | openHPI | Prof. Dr. Christoph Meinel 2
HTTP: Request Message Format (1/3)
entity headers
empty line Content Negotiation
message body
HTTP – Message Format and Status Codes | openHPI | Prof. Dr. Christoph Meinel 4
HTTP: Request Message Format (3/3)
HTTP – Message Format and Status Codes | openHPI | Prof. Dr. Christoph Meinel 6
Response Message Format (2/4)
HTTP – Message Format and Status Codes | openHPI | Prof. Dr. Christoph Meinel 7
Response Message Format (3/4)
HTTP – Message Format and Status Codes | openHPI | Prof. Dr. Christoph Meinel 8
Response Message Format (4/4)
HTTP – Message Format and Status Codes | openHPI | Prof. Dr. Christoph Meinel 9
HTTP Status Codes (1/2)
HTTP – Message Format and Status Codes | openHPI | Prof. Dr. Christoph Meinel 10
HTTP Status Codes (2/2)
HTTP – Message Format and Status Codes | openHPI | Prof. Dr. Christoph Meinel 11
Photo by jmtosses CC BY-NC 2.0 https://www.flickr.com/photos/jmt/3838802631
openHPI
HTTP Transfer Speed Optimization
Prof. Dr. Christoph Meinel
Hasso Plattner Institute
University of Potsdam, Germany
Plain HTTP is Inefficient
HTTP allows multiple request / response cycles within one HTTP session:
Persistent Connections
■ A maximum of two persistent connections should be established
between client and server (to avoid to TCP congestion)
■ Persistent connections are established by setting the connection
header field:
□ Connection: keep-alive
■ If the server supports persistent connections, it also adds
□ Connection: keep-alive to the response
■ Client terminates the session by setting the option "close" in the
connection header field with the last HTTP request
□ If the client misbehaves, the connection will be kept open at
the server (until timeout), leading to possible overload
close
close
Content Revalidation
■ Client must revalidate a cached resource if
□ max-age is reached
□ cache-control header is set no-cache or must-revalidate
■ Client sends the timestamp when it last accessed the resource
in the if-modified-since header
□ If the resource has been updated on the server since then,
the server answers with a 200 OK and the updated resource
□ Otherwise, it sends a 304 Not Modified status in the response
and no resource in the message body (will be served from cache)
Client Webserver
HTTP CGI
Procedure (1/2):
■ Client sends request for protected resource
■ Server checks availability of the resource and responds with
status code 401 Unauthorized together with
WWW-Authenticate response header field
□ Header determines the authentication type, i.e.
WWW-Authenticate: Basic
□ Header value also contains realm name – a name for
the protected resources area, e.g.
– WWW-Authenticate: Basic realm="Restricted Area"
■ Client displays a login form and asks the user for credentials
■ ...
Procedure (2/2):
■ Client concatenates username and password strings with a colon
(username:password) and encodes this string with Base64, e.g.
□ user:EMBn-4J&dtA dXNlcjpFTUJuLTRKJmR0QQ==
■ Client sends new request for the protected resource with the
Authorization request header field set
□ Header field contains the auth method and the base64 string, e.g.
– Authorization: Basic dXNlcjpFTUJuLTRKJmR0QQ==
■ Server checks the credentials and delivers the protected resource
Potential pitfall:
■ Base64 is a (reversible) encoding, not an encryption
■ transmitting the encoded string is no more secure than plain text
Transport channel security must be ensured for Basic Auth
certificate-based authentication
■ With HTTPS, passwords and other confidential data can no longer be
intercepted easily by unauthorized third parties