Uploaded by Egorespawn

iwp

advertisement
IWP
HTML and HTTP
HTML5 - Define semantics of content and structure of a hypertext document
Markup
<!DOCTYPE> - Defines the document type
<html> - Elementet er rodelementet i en html-side.
<head> - Contains metadata/information for the document
<input> - Defines an input control
<meta> - Defines metadata about an HTML document
<script> - Defines a client-side script
<!--...--> - Defines a comment
Attributes
name - bruges til at henvise til form data, efter at formen er blevet sendt, eller til
at henvise til elementet i et script.
HTTP Header.
Efter \r\n Er det hvad der bliver sendt.
Request Header
Name
Description
Host
The domain server
Connection
Control options for the current connection and list of hop-by-hop
request fields.
ContentLength
The length of the request body in octets
Name
Description
Accept
Media Types that is/are acceptable for the response. (text/html,
Json, e.t.c)
Authorization
Authentication credentials for HTTP Authentication
User-Agent
The user agent : Browser
ContentType
Origin
Referer
AcceptEncoding
AcceptLanguage
The Media Type of the body request (Used with POST or PUT)
Initiates a request for cross-origin resoruces sharing (Asks server
for Access-Control-* response)
This is the address of the previous web page from which a link to
the currently requested page was followed
List of acceptable encodings, gzip, deflate
List of acceptable human languages for response
Response Header
Name
CacheControl
Description
Tells all caching mechanisms from server to client
whether they may cache this object. It is measured in
seconds
Server
A name for the server
Date
The date and time that the message was sent
ContentType
The MIME Type of the content
TransferEncoding
The form of encoding used to safely transfer the entity
to the user
Connection
Control options for the current connection and list of
hop-by-hop response fields.
Example
Name
Description
Expires
Gives the date/time after which the response is
considered stale
X-XSSProtection
Cross-Site-Scripting (XSS) filter
AccessControlAllow-Origin
Example
Specifying which web sites can participate in crossorigin resource sharing
StrictTransport-
A HSTS Policy informing the HTTP client how long to
cache the HTTPS only policy and whether this applies
Security
to subdomains.
X-PoweredBy
Specifies the technology supporting the web
technology, PHP/7.0, ASP.NET .. e.t.c.
HTTP Stateless Protocol:
Web Sockets
REST
Computer Networks and the Application layer
Internet protocol stack
Number
Name
Inside
5
Application layer
HTTP, DNS, SSH, TLS
4
Transport Layer
UDP / TCP
3
Network layer
IP (IPv4, IPv6), IPsec
2
Link layer
Ethernet & WiFi
1
Physical layer
Ethernet Cable
Device
Layer
End-system
Application, Transport
Device
Layer
Router
Network
Switch
Network
Client Server Paradigm
Server
Always-on host
Permanent IP Address
Often in data centers, for scaling
Client
Contact, communicate with server (Doesn't run all the time)
May be intermittently connected
May have dynamic IP addresses
Do not communicate directly with each other
Application Layer
In the application layer we have HTTP, DNS, SSH and TLS....
HTTP
HTTP uses TCP:
Client initates TCP connection (creats socket) to server, port 80.
Server accepets TCP connection from client
HTTP messages (application-layer protocol messages) exchanged between
browser (HTTP client) and web server (HTTP server)
TCP connection closed
HTTP is "sateless"
Server maintains no information about past client requests.
HTTP connection: Two types
Non-persistent
Persistent
Non-persistent HTTP
TCP connection opended
At most one object sent over TCP connection
TCP connection closed
Persistent HTTP
TCP connection opened to a server
Multiple objects can be sent over single TCP connection between client and that
server
TCP connection closed
DNS
DNS hierachial database.
Name
Order
Root
1
TLD (Top Level Domain)
2
Authoriative
3
There are DNS lookup recursive and iterative.
Iterative
Client will ask the Local name server, if the local name server does not know it,
it will ask in a hierachial order. And the asked servers will respond to the local
name server.
Recursive
Burden of name resolution on contacted name server
DNS Records
Type = A
Name is hostname
value is IP Adress
Type = CNAME
Name is alias name for some real name.
google.com might be server510.google.com
Type = NS
Name is domain
Value is hostname of authoriative name server for this domain
Type MX
Value is name of mailserver associated with name
Reliable Data Transfer and the Transport Layer
Reliable Data Transfer
Noiseless Channelse
Stop-And-Wait
Noisy Channels
Stop and Wait ARQ (Automatic repeat query)
Go Back N ARQ
Selective Repeat ARQ
Transport layer
TCP (Transmission Control Protocol)
A TCP socket is identified by the source IP address, the source port, destination
address, and the destination port, TCP establishes bi-directional full-duplex session
between the sender and the receiver.
TCP Header: 20 bytes
Three-Way-Handshake
Point-to-point
One sender, one reciever
reliable transport between sending and receiving process
flow control - Sender won't overwelm receiver
Congestion control - Throttle sender when network overloaded
Does not provide: timing, minimum throughput guarantee, security
Connetion-oriented: Setup required between client and server processes
Full-duplex
Bi-directional data flow in same connection
MSS: maximum segment size.
TCP Segment structure.
TCP Sender
TCP Receiver
TCP Retransmission scenarios
TCP Flow control
Three way handshake
Congestion Control
UDP (User Datagram Protocol)
A UDP socket is fully identified by the destination IP adress and the destination port.
UDP Header: 8 bytes
No connection to create and maintain
Packet can arrive out of order
Unreliable data transfer - between sending and receiving process
Does not provide: reliability, flow control, congestion control, timing, throughput
gurantee, security or connection setup.
Network Security
Cryptography
Plaintext -> encryption algorithm (and Alices key) -> Cipher text ->
decryption algorithm (and bobs decryption key) -> plaintext
Symmetric Key Cryptography
Encryption & Decryption key is the same.
Public Key Cryptography / Asymetric
Public key bliver brugt til at kryptere med.
Private key bliver brugt til at dekryptere med
Download