Web and Server Concepts

Contents

  • General Web Concepts
  • DNS
  • Client - Server Architecture
  • Ports and Sockets
  • Web vs Application Server
  • Network Protocols
  • HTTP protocol & status codes
  • Session and cookies
  • CORS

General Concepts

  • URL (UNIFORM RESOURCE LOCATOR) - The address of a World Wide Web page
  • WWW - the universe of network-accessible information, an embodiment of human knowledge.
  • Internet - A global collection of computer networks that are linked together by routers and use a common set of protocols for data transmission known as TCP/IP
    • ​How does it work?
  • Browser - A software on your computer that allows you to access the World Wide Web
    • ​How does it work?

How does A Browser work?

  1. Resource Gathering - fetching all the assets
  2. Parse HTML & Create DOM tree
  3. Create Render Tree from DOM Tree - applying styles
  4. Layout - Position and give size (boxes)
  5. Painting - using UI backend - (overlapping happens here)

Client Server Architecture

DNS

  • The Domain Name System
  • Used to resolve human-readable hostnames like www.example.com into machine-readable IP addresses like 93.184.216.34
  • When you visit a domain, your computer follows a series of steps to turn the human-readable web address into a machine-readable IP address.
  • Steps
    • Step 1: Request information
    • Step 2: Ask the recursive DNS servers
    • Step 3: Ask the root nameservers
    • Step 4: Ask the TLD nameservers

    • Step 5: Ask the authoritative DNS servers

    • Step 6: Retrieve the record

    • Step 7: Receive the answer

Ports & Sockets

  • The network port identifies the application or service running on the computer.
  • A port number is a 16-bit unsigned integer, thus ranging from 0 to 65535.
  • The use of ports allows computers/devices to run multiple services/applications.
  • A socket is the combination of IP address plus port. A connection between two computers uses a socket.​ 

Network Protocols

Web Vs Application Server

  • A Web server exclusively handles HTTP requests, whereas an application server serves business logic to application programs through any number of protocols.
  • Web Server is mostly designed to serve static content, though most Web Servers have plugins to support scripting languages like Perl, PHP, ASP, JSP etc.

HTTP

  • Follows Client-server Model
  • It's an Application layer protocol - HTTP uses TCP as its transport layer protocol
  • Stateless protocol - one request is not dependent on any other request
  • HTTP methods - GET / POST
  • Supports Headers (Request and Response Headers)
    • Content-Type​ - text, image etc.
    • Cache-Control
    • WWW-Authenticate
  • Status Codes
    • OK - 200
    • Not Found - 404
    • Unauthorised - 401
    • Unprocessable Entity - 422
    • Internal Server Error - 500

Session & Cookies

  • A cookie is a small piece of text stored on a user's computer by their browser. Common uses for cookies are authentication, storing of site preferences, shopping cart items, and server session identification.
  • A cookie is a great way of linking one page to the next for a user's interaction with a web site or web application.
  • A session can be defined as a server-side storage of information that is desired to persist throughout the user's interaction with the web site or web application.
  • A session id is passed to the web server every time the browser makes an HTTP request (ie a page link or AJAX request).

CORS

  • Cross Origin Resource Sharing

  • Access-Control-Allow-Origin headers

Questions?

Thank You

Web and server concepts

By Datt Dongare

Web and server concepts

Web and server concepts which every developer must know.

  • 767