SE371 · Annotated SlidesChapter 1 — Introduction to the Web
Chapter 1 · Annotated slides

Introduction to the Web

A short history of the internet (circuit vs. packet switching), the birth of the web, static vs. dynamic sites and Web 2.0, the client–server model, internet protocols and the layered architecture, IP addresses and ports, DNS and domain names, URLs, HTTP requests, methods and response codes, browsers, web servers and development stacks.

Slide text Study notes Highlight: key words Tips, tricks & traps Seen again elsewhere How it can come up
Slide 1: Fundamentals of Web Development
Exam weight Low

    Course Syllabus

    Lets have a look at the Course Syllabus.

    2
    Exam weight Low

      Technical pre-requisites

      1. Using Winrar or Winzip to zip and unzip multiple files or multiple folders.
      2. Navigating a file system from a console: (cd ./dir, cd .. , cd ../dir) ...
      3. Programming: a. Conditionals (if..then..else) b. Loops (for, for each, while) c. Exception handling (try ... catch) d. Objects: someObject.myFunction
      3
      Exam weight Low

        In this chapter you will learn . . .

        • The history of the Internet and World Wide Web
        • Fundamental concepts that form the foundation of the Internet Copyright © 2021, 2018, 2015 Pearson Education, Inc. All Rights Reserved
        4
        Exam weight Low
          Slide 5: A Short History of the Internet
          Exam weight Low
            Slide 6: Circuit Switched Networks
            Exam weight Low
              Slide 7: Packet Switched Networks
              Exam weight Low
              1. Packet switching: data split into packets routed independently, sharing lines (the internet). Circuit switching: a dedicated path for the whole call (telephone).

              The Birth of the Web

              Pr. Tim Berners-Lee (Turing Award 2016) publishes the main features of the web we know today on 1992.

              • A Uniform Resource Locator (URL) to uniquely identify a resource on the WWW. example: https://www.facebook.com
              • The Hypertext Transfer Protocol (HTTP) to describe how requests and responses operate
              • A software program (web server software) that can respond to HTTP requests.
              • Hypertext Markup Language (HTML) to publish documents.
              • A program (a browser) that can make HTTP requests to URLs and that can display the HTML it receives. example: Chrome, Opera, Internet Explorer Copyright © 2021, 2018, 2015 Pearson Education, Inc. All Rights Reserved
              8
              Exam weight High
              1. The web (Tim Berners-Lee, 1989–91) = HTML + HTTP + URLs + a browser and server, built ON the internet.
              🎯 How this can come up · 1 question
              True / False

              The web and the internet are the same thing.

              Web Applications in Comparison to

              Desktop Applications (1 of 2) Advantages

              • They can be accessed from any Internet-enabled computer.
              • They can be used with different operating systems and browser applications.
              • It is easier to roll out program updates since only software on the server needs to be updated as opposed to every computer in the organization using the software.
              • They have a centralized storage on the server, which means fewer security concerns about local storage (which is important for sensitive information such as healthcare data). Copyright © 2021, 2018, 2015 Pearson Education, Inc. All Rights Reserved
              9
              Exam weight Low

                Web Applications in Comparison to

                Desktop Applications (2 of 2) Disadvantages

                • Requirement to have an active Internet connection
                • Security concerns about sensitive private data being transmitted over the Internet.
                • Concerns over the storage, licensing, and use of uploaded data.
                • Problems with certain websites not having an identical appearance across all browsers.
                • Restrictions on software from being installed and hardware from being accessed (like Adobe Flash on iOS).
                • additional plugins might interfere with JavaScript, cookies, or advertisements. Copyright © 2021, 2018, 2015 Pearson Education, Inc. All Rights Reserved
                10
                Exam weight Low

                  Personal data protection law KSA

                  https://laws.boe.gov.sa/boelaws/laws/lawdetails/b7cfae89-828e-4994-b167-adaa00e37188/1

                  Copyright © 2021, 2018, 2015 Pearson Education, Inc. All Rights Reserved

                  11
                  Exam weight Low
                    Slide 12: From Static to Dynamic
                    Exam weight Low
                    1. Static sites: the same HTML file for everyone. Dynamic sites: pages generated by server programs, often from a database.
                    Slide 13: From Static to Dynamic ii
                    Exam weight Low

                      Web 2.0

                      • Web 2.0 refers to an interactive experience where users can contribute and consume web content, thus creating a more user-driven web experience.
                      • For software developers, Web 2.0 also refers to a change in the paradigm. Programming logic, which previously existed only on the server, began to migrate more and more to the browser, which requires learning JavaScript Copyright © 2021, 2018, 2015 Pearson Education, Inc. All Rights Reserved
                      14
                      Exam weight Low
                        Slide 15: Why are programs needed? (1 of 2)
                        Exam weight Low
                          Slide 16: Why are programs needed? (2 of 2)
                          Exam weight Low
                            Slide 17: The Client-Server Model
                            Exam weight Low
                            1. Client–server: the browser (client) sends a request; the server sends a response.

                            Where Is the Internet?

                            It is quite common for the Internet to be visually represented as a cloud Actually implemented via millions of miles of copper (

                            ) wires

                            and fiber optic cables connecting millions of server computers and other networked devices!

                            Copyright © 2021, 2018, 2015 Pearson Education, Inc. All Rights Reserved

                            18
                            Exam weight Low
                              Slide 19: From the Home to the Ocean s Edge ’
                              Exam weight Low
                                Slide 20: From the Home to the Ocean s Edge ’
                                Exam weight Low
                                  Slide 21: How the Internet Is Organized Today
                                  Exam weight Low
                                    Slide 22: Fundamentals of Web Development
                                    Exam weight Low

                                      In this chapter you will learn . . .

                                      • The fundamental protocols that make the web possible
                                      • How the domain name system works
                                      • What HTTP is
                                      • How browsers and servers work to exchange and interpret HTML Copyright © 2021, 2018, 2015 Pearson Education, Inc. All Rights Reserved
                                      23
                                      Exam weight Low

                                        Internet protocols

                                        • A protocol is a set of rules that partners use when they communicate.
                                        • TCP/IP is an essential internet protocol!
                                        • These protocols have been implemented in every operating system and make fast web development possible. If web developers had to keep track of packet routing, transmission details, domain resolution, checksums, and more, it would be hard to build websites. Copyright © 2021, 2018, 2015 Pearson Education, Inc. All Rights Reserved
                                        24
                                        Exam weight Low
                                          Slide 25: A Layered Architecture
                                          Exam weight Low
                                          1. Four-layer TCP/IP: link → internet (IP) → transport (TCP/UDP) → application (HTTP, DNS…).

                                          Link Layer

                                          • The link layer is the lowest layer, responsible for both the physical transmission of data across media and establishing logical links.
                                          • It handles issues like packet creation, transmission, reception, error detection, collisions, line sharing, and more.
                                          • One term that is sometimes used in the Internet context is that of MAC (media access control) addresses. Copyright © 2021, 2018, 2015 Pearson Education, Inc. All Rights Reserved
                                          26
                                          Exam weight Low

                                            Internet Layer

                                            • The Internet layer (sometimes also called the IP Layer) routes packets between communication partners across networks.
                                            • It provides best effort communication. It sends out a message to its “ ” destination but expects no reply and provides no guarantee the message will arrive intact, or at all.
                                            • The Internet uses the Internet Protocol (IP) addresses, which are numeric codes that uniquely identify destinations on the Internet.
                                            • Every device connected to the Internet has such an IP address. Copyright © 2021, 2018, 2015 Pearson Education, Inc. All Rights Reserved
                                            27
                                            Exam weight Low
                                              Slide 28: IP Addresses (cont)
                                              Exam weight High
                                              1. IPv4 is 32 bits (four 0–255 numbers); IPv6 is 128 bits.
                                              🎯 How this can come up · 1 question
                                              MCQ

                                              An IPv4 address is how many bits?

                                              Port Address Translation (PAT)

                                              The IPv4 address space was depleted (almost filled) in 2011, but the number of computers connected to the Internet continued to grow.

                                              • Port Address Translation (PAT), allows multiple, unrelated networks to make use of the same IP address
                                              • When you join a wireless network in a coffee shop, home, office or university, it is quite likely you are making use of PAT.
                                              • For future growth, IPv6 will be necessary. Copyright © 2021, 2018, 2015 Pearson Education, Inc. All Rights Reserved
                                              29
                                              Exam weight Low

                                                Transport Layer

                                                • The transport layer ensures transmissions arrive in order and without error.
                                                • First, the data is broken into packets formatted according to the Transmission Control Protocol (TCP).
                                                  • Each data packet has a header that includes a sequence number, so the receiver can put the original message back in order
                                                  • Each packet acknowledges its successful arrival back to the sender (ACK).
                                                  • In the event of a lost packet (since no ACK arrived for that packet the packet will be retransmitted.
                                                • This means you have a guarantee that messages sent will arrive and will be in order. Copyright © 2021, 2018, 2015 Pearson Education, Inc. All Rights Reserved
                                                30
                                                Exam weight High
                                                1. TCP: reliable, ordered, connection-based. UDP: fast, connectionless, no guarantees (video, DNS).
                                                🎯 How this can come up · 1 question
                                                MCQ

                                                Which protocol guarantees delivery and order?

                                                Slide 31: Transport Layer (example)
                                                Exam weight Low
                                                  Slide 32: User Datagram Protocol (UDP)
                                                  Exam weight Low
                                                    Slide 33: Application Layer
                                                    Exam weight Low

                                                      Domain Name System

                                                      • As elegant as IP addresses may be, human beings do not enjoy having to remember long strings of numbers.
                                                      • Even as far back as the days of ARPANET, researchers assigned domain names to IP addresses
                                                      • In those early days, the number of Internet hosts was small, so a list of a domains and associated IP addresses could be downloaded as needed as a hosts file.
                                                      • As the number of computers on the Internet grew, this hosts file had to be replaced with a better, more scalable, and distributed system. This system is called the Domain Name System (DNS) Copyright © 2021, 2018, 2015 Pearson Education, Inc. All Rights Reserved
                                                      34
                                                      Exam weight Low
                                                      1. DNS translates domain names into IP addresses.
                                                      Slide 35: DNS Overview
                                                      Exam weight Low
                                                        Slide 36: Name Levels
                                                        Exam weight Low
                                                        1. Name levels read right to left: top-level domain (.com, .sa), second-level (psu), subdomains (www).

                                                        Name Levels (Top Level)

                                                        The rightmost portion of the domain name is called the top-level domain.

                                                        TLDs limited to two broad categories, plus a third reserved for other use.

                                                        1. Generic top-level domain (gTLD) 2. Country code top-level domain (ccTLD) 3. .arpa (used for reverse DNS lookups)

                                                        Copyright © 2021, 2018, 2015 Pearson Education, Inc. All Rights Reserved

                                                        37
                                                        Exam weight Low

                                                          Generic top-level domain (gTLD)

                                                          Generic top-level domains (gTLD) include the famous .com and .org, There are 3 subtypes of gTLD.

                                                          • Unrestricted. TLDs include .com, .net, .org, and .info.
                                                          • Sponsored. TLDs including .gov, .mil, .edu, and others
                                                          • New. Starting in June 2012, ICANN invited companies to launch new TLDs in order to provide more choice. Since then over 1000 new TLD have been created including .art, .cash, .cool, .jobs, .tax and so on Copyright © 2021, 2018, 2015 Pearson Education, Inc. All Rights Reserved
                                                          38
                                                          Exam weight Low

                                                            Country code top-level domain

                                                            Country code top-level domain (ccTLD) are under the control of the countries which they represent, which is why each is administered differently.

                                                            • In the United Kingdom, for example, businesses must register subdomains to co.uk rather than second-level domains directly whereas in Canada, .ca domains can be obtained by any person, company, or organization living or doing business in Canada.
                                                            • Internationalized top-level domain name (IDN) allows domains to use non-ascii characters and has been deployed since 2009. There are over 9 million IDN domains Copyright © 2021, 2018, 2015 Pearson Education, Inc. All Rights Reserved
                                                            39
                                                            Exam weight Low

                                                              Name Registration

                                                              • Q: How then are domain names assigned?
                                                              • A: Special organizations or companies called domain name registrars manage the registration of domain names. These domain name registrars are given permission to do so by the appropriate generic top-level domain (gTLD) registry and/or a country code top-level domain (ccTLD) registry.
                                                              • The non-profit Internet Corporation for Assigned Names and Numbers (ICANN) oversees the management of top-level domains, accredits — registrars, and coordinates other aspects of DNS.
                                                              • Examples: domain.com, godaddy, hostgator, bluehost ... Copyright © 2021, 2018, 2015 Pearson Education, Inc. All Rights Reserved
                                                              40
                                                              Exam weight Low
                                                                Slide 41: Domain Name Registrars in KSA
                                                                Exam weight Low
                                                                  Slide 42: Domain name registration process
                                                                  Exam weight Low
                                                                    Slide 43: Address Resolution
                                                                    Exam weight Low
                                                                    1. Resolution: browser → local cache → resolver → root → TLD server → authoritative server → IP back to the browser.
                                                                    Slide 44: Address Resolution (cont)
                                                                    Exam weight Low

                                                                      Uniform Resource Locators

                                                                      Uniform Resource Locators (URL) allow clients to request particular resources (files) from the server.

                                                                      URL s consist of two required components:

                                                                      ’

                                                                      1. the protocol used to connect and
                                                                      2. the domain (or IP address) to connect to. Copyright © 2021, 2018, 2015 Pearson Education, Inc. All Rights Reserved
                                                                      Uniform Resource Locators
                                                                      45
                                                                      Exam weight High
                                                                      1. URL = protocol://domain:port/path?query#fragment.
                                                                      🎯 How this can come up · 1 question
                                                                      MCQ

                                                                      In https://shop.com:8080/items?id=5, the query string is:

                                                                      Port (URL)

                                                                      • A port is a type of software connection point used by the underlying TCP/IP protocol and the connecting computer.
                                                                      • Although the port attribute is not commonly used in production sites, it can be used to route requests to a test server, to perform a stress test, or even to circumvent Internet filters.
                                                                      • If no port is specified, the protocol determines which port to use. For instance, port 80 is the default port for web-related HTTP requests.
                                                                      • Syntax is to add a colon after the domain, then specify an integer port number. http://funwebdev.com:8080/ would connect on port 8080 Copyright © 2021, 2018, 2015 Pearson Education, Inc. All Rights Reserved
                                                                      46
                                                                      Exam weight Low

                                                                        Path (URL)

                                                                        • The path is an important concept to anyone who has ever used a computer file system.
                                                                        • The root of a web server corresponds to a folder somewhere on that server.On many Linux servers that path is /var/www/html/ or something similar (for Windows it is often /inetpub/wwwroot/).
                                                                        • The path is optional. However, when requesting a folder or the top-level page of a domain, the web server will decide which file to send you. Copyright © 2021, 2018, 2015 Pearson Education, Inc. All Rights Reserved
                                                                        47
                                                                        Exam weight Low
                                                                          Slide 48: Query String (URL)
                                                                          Exam weight Low
                                                                            Slide 49: Hypertext Transfer Protocol
                                                                            Exam weight Low
                                                                            1. HTTP: stateless request–response protocol; headers carry metadata (Host, User-Agent, Content-Type…).

                                                                            HTTP Headers

                                                                            Headers are sent in the request from the client and received in the response from the server. Headers are one of the most powerful aspects of HTTP.

                                                                            • Request headers include data about the client machine
                                                                              • Host, User-Agent, Cache settings and more
                                                                            • Response headers have information about the server answering the request and the data being sent
                                                                              • Server, Last Modified, Content Type, Encoding, Copyright © 2021, 2018, 2015 Pearson Education, Inc. All Rights Reserved
                                                                            50
                                                                            Exam weight Low

                                                                              HTTP Request Methods

                                                                              • The most common requests are the GET and POST request, along with the HEAD request
                                                                              • Other HTTP verbs such as CONNECT, TRACE, and OPTIONS are less commonly used and are not covered. Copyright © 2021, 2018, 2015 Pearson Education, Inc. All Rights Reserved
                                                                              51
                                                                              Exam weight High
                                                                              1. GET: data in the URL query string (bookmarkable, cached, length-limited, visible). POST: data in the request body (forms that change data).
                                                                              Exam trapGET requests should not change data; use POST (or PUT/DELETE) for changes.
                                                                              🎯 How this can come up · 1 question
                                                                              MCQ

                                                                              Which method sends form data in the request body rather than the URL?

                                                                              GET Request

                                                                              • The most common type of HTTP request is the GET request.
                                                                              • One is asking for a resource located at a specified URL to be retrieved.
                                                                              • Whenever you click on a link, type-in a URL in your browser, or click on a bookmark, you are usually making a GET request.
                                                                              • Data can be transmitted through a GET request, with a query string Copyright © 2021, 2018, 2015 Pearson Education, Inc. All Rights Reserved
                                                                              GET Request
                                                                              52
                                                                              Exam weight Low
                                                                                Slide 53: POST Request
                                                                                Exam weight Low

                                                                                  Response Codes

                                                                                  • Response codes are integer values returned by the server as part of the response header.
                                                                                  • These codes describe the state of the request, including whether it was successful, had errors, requires permission, and more.
                                                                                  • The codes use the first digit to indicate the category of response.
                                                                                    • 2## codes are for successful responses,
                                                                                    • 3## are for redirection-related responses,
                                                                                    • 4## codes are client errors.
                                                                                    • 5## codes are server errors. Copyright © 2021, 2018, 2015 Pearson Education, Inc. All Rights Reserved
                                                                                  54
                                                                                  Exam weight High
                                                                                  1. Status codes: 2xx success (200 OK), 3xx redirect (301, 304), 4xx client error (404 Not Found, 403), 5xx server error (500).
                                                                                  🎯 How this can come up · 2 questions
                                                                                  MCQ

                                                                                  HTTP 404 means:

                                                                                  MCQ

                                                                                  A 500 status code is a:

                                                                                  Slide 55: HTTP Response Codes
                                                                                  Exam weight Low

                                                                                    Web Browsers (Fetching a web page)

                                                                                    • Seeing a single web page is facilitated by the browser, which
                                                                                      • requests the initial HTML page, then
                                                                                      • parses the returned HTML to find all the resources referenced from within it (like images, style sheets, and scripts).
                                                                                    • Only when all the files have been retrieved is the page fully loaded for the user
                                                                                    • The algorithms within browsers to download, parse, layout, fetch assets, and create the final interactive page for the user are commonly referred to collectively as the rendering of the page Copyright © 2021, 2018, 2015 Pearson Education, Inc. All Rights Reserved
                                                                                    56
                                                                                    Exam weight Low

                                                                                      Web Servers

                                                                                      • A web server is, at a fundamental level, nothing more than a process that responds to HTTP requests.
                                                                                      • Real-world websites typically have many web servers configured together in web farms.
                                                                                      • Regardless of the physical characteristics of the server, one must choose an application stack to run a website. This application stack will include
                                                                                        • an operating system,
                                                                                        • web server software,
                                                                                        • a database,
                                                                                        • a backend programming language and runtime,
                                                                                        • a set of languages/framewors/libraries for the front-end. Copyright © 2021, 2018, 2015 Pearson Education, Inc. All Rights Reserved
                                                                                      57
                                                                                      Exam weight Low
                                                                                        Slide 58: Web Development stacks
                                                                                        Exam weight Low
                                                                                        1. Stacks: LAMP (Linux, Apache, MySQL, PHP), MEAN/MERN (MongoDB, Express, Angular/React, Node).

                                                                                        END

                                                                                        Copyright © 2021, 2018, 2015 Pearson Education, Inc. All Rights Reserved

                                                                                        59
                                                                                        Exam weight Low