Request-Response Model (request–reply, synchronous)
frontend
html / css / js / etc
backend
database / server / data ops / cache / etc
describes how devices can communicate,
and defines the format of data beign exchanged
The pen
The pen in box
The pen in box with declaration
The pen in box with declaration is delivering to receiver
The pen in box with declaration is delivered to receiver.
The pen in box with declaration is delivered to receiver.
He got it, confirmed that he is receiver and got the box.
The pen in box with declaration is delivered to receiver.
He got it & confirmed personality, unboxed and got the pen.
(sender) | sender (pen) -> |
(sender) | sender (pen + box) -> |
(provider) | sender (pen + box + declaration) -> |
(delivery service) | sender (pen + box + declaration + delivering) -> |
(delivery service) | receiver (delivering + declaration + box + pen) -> |
(provider) | receiver (declaration + box + pen) -> |
(receiver) | receiver (box + pen) -> |
(receiver) | receiver (pen) |
TCP - Connection-oriented (3-way handshake)
UDP - Connectionless
TCP - Connection-oriented (3-way handshake)
UDP - Connectionless
All People Seem To Need Data Processing
Internet Protocol version 4
Subnetwork | Purpose |
---|---|
0.0.0.0/8 | Current network |
10.0.0.0/8 | Private network |
100.64.0.0/10 | Shared Address Space |
127.0.0.0/8 | Loopback |
169.254.0.0/16 | Link-local |
172.16.0.0/12 | Private network |
192.0.0.0/24 | IETF Protocol Assignments |
192.168.0.0/16 | Private network |
Internet Protocol version 6
2001:0db8:11a3:09d7:1f34:8a2e:07a0:765d
http://[2001:0db8:11a3:09d7:1f34:8a2e:07a0:765d]:8080/
0000:0000:0000:0000:0000:0000:ae21:ad12 => ::ae21:ad12
IPv6 address | IPv4 alias |
---|---|
:: | 0.0.0.0 |
::1 | 127.0.0.1 |
::xx.xx.xx.xx | in-box IPv4 |
::ffff:xx.xx.xx.xx | IPv4 for servers without IPv6 support |
fe80:: — febf:: | 169.254.0.0/16 |
fec0:: — feff:: | site-local |
16-bit number
google "well-known ports"
Network Address Translation
IP Masquerading, Network Masquerading и Native Address Translation
Domain Name System
lowest = 5 min
default = 24 hours
A (map IP to Host)
CNAME (alias with different A record)
MX (for sending an email)
Lookup Hosts on specific IP
➜ ✗ host cursor.education
cursor.education has address 91.194.250.152
cursor.education mail is handled by 10 mx.yandex.ru.
➜ ✗ host -a cursor.education
Trying "cursor.education"
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 43851
;; flags: qr rd ra; QUERY: 1, ANSWER: 6, AUTHORITY: 0, ADDITIONAL: 0
;; ANSWER SECTION:
cursor.education. 14399 IN SOA ns7.rehost.com.ua. hostmaster.redo.com.ua. 2016021502 10200 3600 1209600 86400
cursor.education. 14399 IN NS ns8.rehost.com.ua.
cursor.education. 14399 IN NS ns7.rehost.com.ua.
cursor.education. 14399 IN A 91.194.250.152
cursor.education. 14399 IN TXT "v=spf1 a mx ip4:91.194.250.152 ~all"
cursor.education. 14399 IN MX 10 mx.yandex.ru.
Received 227 bytes from 8.8.8.8#53 in 128 ms
Field | Description |
---|---|
A | Address |
AAAA / A6 | Address IPv6 |
CNAME | Canonical name |
MX | Mail Exchanger |
NS | Authoritative name server (DNS) |
SOA | Start of Authority |
TXT | Text string |
Uniform Resource Locator
Uniform Resource Identifier
https://www.example.com
Absolute URLs:
➜ ✗ traceroute cursor.education
traceroute to cursor.education (91.194.250.152), 64 hops max, 52 byte packets
1 192.168.0.1 (192.168.0.1) 1.946 ms 5.349 ms 0.761 ms
2 77-123-168-1-ptr.volia-lviv.com (77.123.168.1) 17.323 ms 13.195 ms 37.056 ms
3 unknown.volia-lviv.com (77.120.32.202) 12.616 ms 11.017 ms 11.824 ms
4 v973.tengig3-2.diamond.volia.net (77.120.0.73) 32.960 ms 21.498 ms 39.309 ms
5 * * *
6 176.241.108.214 (176.241.108.214) 18.866 ms 19.270 ms 19.739 ms
7 * * *
8 dd.rehost.com.ua (91.194.250.152) 22.207 ms 20.224 ms 22.833 ms
$ telnet smtp.gmail.com 587
EHLO localhost
STARTTLS
MAIL FROM: <support@gmail.com>
HyperText Transfer Protocol
$ telnet google.com 80
GET / HTTP/1.1
Host: google.com
<protocol>://<server>/<path>
(request line) GET /index.html HTTP/1.0
(headers lines) Host: www.site.com
Date: 123
User-Agent: Mozilla/1.0 (Chrome v0.5)
Accept-Language: ru, en
*Content-Length: message-payload
(carriage line feed)
(message body)
(method) (resource-url) HTTP/(version)
GET /index.html HTTP/1.0
GET http://ya.ru/index.html HTTP/1.1
POST http://olx.ua/post HTTP/1.1
HEAD /ping HTTP/1.0
GET /wiki/HTTP HTTP/1.0
Host: ru.wikipedia.org
User-Agent: HTTPTool/1.0
idempotent: a=4;
non-idempotent: a++;
Method | Idempotent | Safe |
---|---|---|
OPTIONS | yes | yes |
GET | yes | yes |
HEAD | yes | yes |
PUT | yes | no |
POST | no | no |
DELETE | yes | no |
(status line) HTTP/1.0 200 OK
(header lines) Data: 123
Server: Apache/1.3.12 (Unix)
Last-Modified: (data)
Content-Type: text/html
Content-Length: (message-payload)
(carriage line feed)
(message body)
HTTP/(version) (status-code) (status-message)
HTTP/1.0 200 OK
HTTP/1.1 403 Forbidden
HTTP/1.1 404 Not Found
1xx: Informational - not done yet
2xx: Success - you win
3xx: Redirection - you lose but try again
4xx: Client Error - you lose, your fault
5xx: Server Error - you lose, my bad
Examples:
http allows servers to redirect a client request to a different location
HTTP/1.1 302 Found
Location: ...
Name, Value, Expires, Path, Domain
Cache-Control, Last-Modified and Expires
Cache-Control: no-cache
Pragma: no-cache
Cache-Control: private/public
Cache-Control: max-age=31536000
Last-Modified: Wed, 25 Feb 2015 12:00:00 GMT
Expires: Thu, 25 Feb 2016 12:00:00 GMT
If-Modified-Since: Wed, 25 Feb 2015 17:42:04 GMT
Accept-Encoding: gzip, deflate
Content-Encoding: gzip
Content-Length: 1253
Response:
HTTP/1.1 401 Access Denied
WWW-Authenticate: Basic realm="My Server"
Content-Length: 0
GET /securefiles/ HTTP/1.1
Host: www.httpwatch.com
Authorization: Basic aHR0cHdhdGNoOmY=
example
port = 21
active & passive
Secury Shell, remote console access
Auth by PKI, credentials
PuTTY
Remote Desktop Protocol, for remote graphical access
So, what are the steps to get the Google's page?
connection, DNS, HTTP request, HTTP response, parse URL, render the page?
(draw restful approach, frontend & backend separation via API)
Resource naming:
google "swagger online example"
Request every n seconds
Request every n seconds \w wait-delay
caniuse.com 89.42%
tbd
Content Delivery Network
https://www.srihash.org/