Lädt...


🔧 Brief Overview of HTTP, Internet Protocols, and Web Architecture


Nachrichtenbereich: 🔧 Programmierung
🔗 Quelle: dev.to

Index

Intro
URLs
URL Components
Internet Protocol (IP) Suite
The DNS Lookup Process
TCP (Transmission Control Protocol)
The Three Way Handshake
HTTP Verbs/Methods
API Endpoints
What is HTTP (HyperText Transfer Protocol)?
Request
Response
HTTP Status Codes
HTTP is Stateless
What is the REST (REpresentational State Transfer) Architecture?
What is the Web Layers Architecture?

Intro

  • Internet existed since around 1960s
  • Usage was minimal and restricted
  • In 1989 (at CERN), Sir Tim Berners-Lee invented HTTP (Hypertext Transfer Protocol); insight was to use the existing hypertext (documents that had links to other documents) could be moved throughout the internet (linking to other documents addresses instead of another document in the same space).
  • First HTTP version was 0.9

1.0 URLs

  • Address of a resource on the internet (ex: https://example.com)
  • Basis of communication with URLs is the request and response pattern.
  • A client (maybe a web browser, maybe an app, anything that sends requests to servers) requests information to a server which sends a response

1.0.1 URL Components

For https://www.python.org/about

  • A scheme: https://
  • A hostname: www.python.org
  • A(n optional) path: /about

1.1 Internet Protocol (IP) Suite

  • In the process of sending a request and receiving a response, other tech must work together with the client and server to load the webpage
  • This is broadly referred to as the internet protocol suite.

1.1.1 The DNS Lookup Process

  • User types a TLD (Top-Level Domain) http://www.google.com into their web browser
  • Browser sends request to DNS (Domain Name System) server
  • DNS lookup occurs (usually the one provided by the user's ISP (Internet Service Provider), can also be a public DNS); human-readable name is mapped to server's IP as registered in the DNS (can be in the cache, if nothing is found then looks up authoritative nameservers)
  • DNS returns IP address to browser
  • OS that runs the browser caches the information locally and uses the IP address to connect directly to the website

Note: Most DNS problems (such as unexistent or old versions of websites) are usually on the client-side. These are usually solved by clearing the local DNS cache.

1.1.2 TCP (Transmission Control Protocol)

  • Once a client has an IP address for a domain, it sets up a consistent connection with a server
  • This happens via TCP (Transmission Control Protocol) which provides reliable, ordered and error-checked delivery of bytes between two computers
  • To Establish a TCP connection between two computers, a three-way "handshake" occurs between client and server:

1.1.2.1 The Three Way Handshake

  • Client sands a SYN asking to establish a connection
  • Server responds with a SYN-ACK acknowledging the request and passing a connection parameter
  • Client sends an ACK back to the server to confirm the connection
  • Once the TCP connection is established, the two computers can start communicating via HTTP

1.1.3 HTTP Verbs/Methods

  • Every webpage contains an address (URL) and a list of approved actions (HTTP verbs)
  • Here is a more thorough list, below are the most common ones.
CRUD HTTP Verb/Methods
Create POST
Read GET
Update PUT
Delete DELETE

1.1.4 API Endpoints

  • A traditional website consists of pages with HTML, CSS, images, javascript, etc.
  • A web API also relies on URLs but instead of serving webpages it produces API endpoints
  • An endpoint contains data (usually in JSON) and a list of available actions (HTTP Verbs)

1.1.5 What is HTTP (HyperText Transfer Protocol)?

  • HTTP is a request-response protocol between two computers that have an existing TCP connection.
  • Client makes requests, server returns responses

1.1.5.1 Request

Example request:

GET / HTTP/1.1
Host: google.com
Accept_Language: en-US
  • Line 1: request line specifies HTTP method to use, path & HTTP version
  • Two subsequent one are HTTP headers: Host is the domain name and Accept_Language is the language to use.
  • See here a more thorough list of HTTP headers Note: HTTP messages might also contain a body, only used with HTTP responses containing data.

1.1.5.2 Response

This assumes that Google's homepage only contains the HTML "Hello, world!".

HTTP/1.1 200 OK
Date: Mon, 24 Jan 2022 23:26:07 GMT
Server: gws
Accept-Ranges: bytes
Content-Length: 13
Content-Type: text/html; charset=UTF-8

Hello, world!
  • Top line is the response line, specifies HTTP version and response status code
  • Next 5 lines are HTTP header.
  • After the line break there is the body content of "Hello, world!"

Note: most web pages contain multiple resources that require multiple HTTP request/response cycles. A webpage with HTML, a linked CSS file and one image has three separate trips back-and-forth between client and server before the complete page can be rendered.

1.1.5.3 HTTP Status Codes

  • Once a client sends a request, this does not mean the request will simply proceed
  • There is a vast list of HTTP Status codes. The examples below are the most common ones.
HTTP Status Code Description
2xx Success The action requested by the client was received, understood, and accepted
3xx Redirection The requested URL has moved (usually will be followed by further action, e.g. sending a new request to a new URL returned by the server)
4xx Client Error There was an error, typically a bad URL request by the client
5xx Server Error The server failed to resolve a request

2.0 HTTP is Stateless

  • HTTP is stateless; this means each request/response pair is independent of others. There is no stored memory of past interactions.
  • This also applies to 3xx responses, as the final result is basically "instructions of what to do next"
  • This is an engineering decision due to signal loss over time, a very long communication means that everything would potentially fall apart with one error; HTTP as is means that if a single cycle does not go through, it can simply be repeated without problems for the rest of the communication chain

Note: while HTTP itself is stateless, there can be transfer of stateful data among a client and a server, such as user authentication (a browser stores an auth token as a cookie and sends to a specific IP on each request to this IP and the server checks the token validity to authenticate and authorize the user before each response).

3.0 What is the REST (REpresentational State Transfer) Architecture?

REpresentational State Transfer is an architecture proposed in 2000 by Roy Fielding in a dissertation thesis. It is an approach to build APIs on top of the HyperText Transfer Protocol.
This defines how the API will communicate externally; it does not care about internal details or separation of concerns.

Every RESTful API:

4.0 What is the Web Layers Architecture?

This broadly defines the internal composition of the web app (note that APIs will lack the Presentation Layer).
Each layer has specific responsibilities and will communicate with adjacent layers; it is used to promote separation of concerns and modular design.

Presentation Layer (PL):

  • Handles user interface and user interaction
  • Typically includes HTML, CSS, and JavaScript
  • Responsible for displaying data and capturing user input

Example: a rendered webpage with HTML, CSS and Javascript.

Business Logic Layer (BLL):

  • Contains the core functionality and business rules of the application
  • Processes data and implements application logic
  • Sits between the presentation and data layers

Example: a controller function that checks authorization for an user and schedules a particular job on the server to be completed at a later date.

Data Service Layer (DSL):

  • Acts as an intermediary between the business logic and data access layers
  • Provides an additional level of abstraction for data operations
  • Can improve security and modularity of more complex applications

Example: callbacks that perform validations at a model-level before proceeding with data-altering procedures

Data Access Layer (DAL):

  • Manages data storage and retrieval
  • Interacts with databases or other data sources
  • Abstracts data operations from the business logic layer

Example: implementation of CRUD operation functions that will alter or retrieve data from a database.

...

🔧 Brief Overview of HTTP, Internet Protocols, and Web Architecture


📈 55.91 Punkte
🔧 Programmierung

📰 A brief overview of the TCP/IP model, SSL/TLS/HTTPS protocols and SSL certificates


📈 36.99 Punkte
📰 IT Security Nachrichten

🐧 probonopd/wayland-x11-compat-protocols: The missing Wayland protocols


📈 28.86 Punkte
🐧 Linux Tipps

🔧 Comparing All-in-One Architecture, Layered Architecture, and Clean Architecture


📈 28.05 Punkte
🔧 Programmierung

📰 A brief history of Wi-Fi security protocols from “oh my, that’s bad” to WPA3


📈 25.55 Punkte
📰 IT Security Nachrichten

📰 A brief history of Wi-Fi security protocols from “oh my, that’s bad” to WPA3


📈 25.55 Punkte
📰 IT Security Nachrichten

🔧 Brief Overview of the Importance of Frontend Technologies in Modern Web Development


📈 24.6 Punkte
🔧 Programmierung

🔧 Choosing the Right API Architecture - A Deep Dive into RESTful API & gRPC Protocols


📈 23.34 Punkte
🔧 Programmierung

🔧 Detailed comparison of HTTP 1.1, HTTP 2.0, and HTTP 3.0 transmission protocols


📈 23.06 Punkte
🔧 Programmierung

📰 Internet Governance Body RIPE Opposes China's Internet Protocols Upgrade Plan


📈 22.88 Punkte
📰 IT Security Nachrichten

🔧 An Overview and Brief Explanation of Direct Preference Optimization (DPO)


📈 22.56 Punkte
🔧 Programmierung

🔧 The Prisma ORM: A Brief Overview and Introduction


📈 22.56 Punkte
🔧 Programmierung

🔧 Understanding HTTP, Cookies, Email Protocols, and DNS: A Guide to Key Internet Technologies


📈 22.4 Punkte
🔧 Programmierung

📰 A Brief Overview of the Metasploit Framework


📈 21.26 Punkte
📰 IT Security Nachrichten

🔧 Understanding SQL Subqueries: A Brief Overview


📈 21.26 Punkte
🔧 Programmierung

🔧 Python Syntax: A Brief Overview


📈 21.26 Punkte
🔧 Programmierung

🔧 Reinforcement Learning: A Brief Overview


📈 21.26 Punkte
🔧 Programmierung

🔧 Security on AWS: A Brief Overview


📈 21.26 Punkte
🔧 Programmierung

🔧 ACID in Databases: A Brief Overview


📈 21.26 Punkte
🔧 Programmierung

🔧 A Beginner's Guide to Networking Protocols: TCP, UDP, HTTP, and HTTP/3


📈 20.61 Punkte
🔧 Programmierung

🔧 Event driven architecture : Overview and comparison of AWS Messaging services


📈 20.35 Punkte
🔧 Programmierung

🔧 Three Tier Architecture. Overview and Each tier explained.


📈 20.35 Punkte
🔧 Programmierung

🔧 A brief breakdown of Kubernetes architecture


📈 20.04 Punkte
🔧 Programmierung

🔧 A Brief History Of The Internet And The World Wide Web


📈 19.99 Punkte
🔧 Programmierung

📰 Intel Unveils Roadmaps For Core Architecture and Atom Architecture


📈 19.13 Punkte
📰 IT Security Nachrichten

📰 AMD Unveils Zen 2 CPU Architecture, Navi GPU Architecture and a Slew of Products


📈 19.13 Punkte
📰 IT Security Nachrichten

🔧 What is difference between monolithic architecture and microservices architecture


📈 19.13 Punkte
🔧 Programmierung

🔧 Generative AI Architecture: A Comprehensive Guide to Its Architecture and Components in 2024


📈 19.13 Punkte
🔧 Programmierung

matomo