Web Protocols and Practice

Slides:



Advertisements
Similar presentations
TCP/IP Protocol Suite 1 Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Chapter 22 World Wide Web and HTTP.
Advertisements

How does the server format the information it gives to the appln program? As environment variables and in standard input.
Web Servers How do our requests for resources on the Internet get handled? Can they be located anywhere? Global?
Definitions, Definitions, Definitions Lead to Understanding.
2/9/2004 Web and HTTP February 9, /9/2004 Assignments Due – Reading and Warmup Work on Message of the Day.
1 Web Servers Web Protocols and Practice Chapter 4.
Web Client/Server Communication A290/A590, Fall /09/2014.
Christopher M. Pascucci Basic Structural Concepts of.NET Browser – Server Interaction.
Linux Operations and Administration
1 Web Servers (IIS and Apache) Outline 9.1 Introduction 9.2 HTTP Request Types 9.3 System Architecture 9.4 Client-Side Scripting versus Server-Side Scripting.
INTRODUCTION TO WEB DATABASE PROGRAMMING
Overview A plain HTML document is static A CGI program is executed in real-time, so that it can output dynamic information. CGI (Common Gateway Interface)
FALL 2005CSI 4118 – UNIVERSITY OF OTTAWA1 Part 4 Web technologies: HTTP, CGI, PHP,Java applets)
Comp2513 Forms and CGI Server Applications Daniel L. Silver, Ph.D.
Chapter 33 CGI Technology for Dynamic Web Documents There are two alternative forms of retrieving web documents. Instead of retrieving static HTML documents,
FTP (File Transfer Protocol) & Telnet
TCP/IP Protocol Suite 1 Chapter 22 Upon completion you will be able to: World Wide Web: HTTP Understand the components of a browser and a server Understand.
Rensselaer Polytechnic Institute Shivkumar Kalvanaraman, Biplab Sikdar 1 The Web: the http protocol http: hypertext transfer protocol Web’s application.
1 Chapter 6: Proxy Server in Internet and Intranet Designs Designs That Include Proxy Server Essential Proxy Server Design Concepts Data Protection in.
ITIS 1210 Introduction to Web-Based Information Systems Chapter 23 How Web Host Servers Work.
1 Welcome to CSC 301 Web Programming Charles Frank.
Web Technologies Interactive Responsiveness Function Hypertext Web E-Publishing Simple Response Web Fill-in Forms Object Web « Full-Blown » Client/Server.
Form Data Encoding GET – URL encoded POST – URL encoded
ECMM6018 Enterprise Networking for Electronic Commerce Tutorial 7
Web Server.
27.1 Chapter 27 WWW and HTTP Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
27.1 Chapter 27 WWW and HTTP Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
8 Chapter Eight Server-side Scripts. 8 Chapter Objectives Create dynamic Web pages that retrieve and display database data using Active Server Pages Process.
CSI 3125, Preliminaries, page 1 Networking. CSI 3125, Preliminaries, page 2 Networking A network represents interconnection of computers that is capable.
Java Web Server Presented by- Sapna Bansode-03 Nutan Mote-15 Poonam Mote-16.
27.1 Chapter 27 WWW and HTTP Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
1 Chapter 22 World Wide Web (HTTP) Chapter 22 World Wide Web (HTTP) Mi-Jung Choi Dept. of Computer Science and Engineering
TCP/IP Protocol Suite 1 Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Chapter 22 World Wide Web and HTTP.
Web Servers & CGI. World Wide Web (www) w3 The World Wide Web (abbreviated as WWW or W3, commonly known as the web) is a system of interlinked hypertext.
The Common Gateway Interface (CGI) Pat Morin COMP2405.
1 Chapter 1 INTRODUCTION TO WEB. 2 Objectives In this chapter, you will: Become familiar with the architecture of the World Wide Web Learn about communication.
4.01 How Web Pages Work.
From infra admin's point of view
4.01 How Web Pages Work.
Distributed Control and Measurement via the Internet
Managing State Chapter 13.
Apache Web Server v. 2.2 Reference Manual
WWW and HTTP King Fahd University of Petroleum & Minerals
Technologies and Applications
Web Development Web Servers.
Chapter 27 WWW and HTTP Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
E-commerce | WWW World Wide Web - Concepts
E-commerce | WWW World Wide Web - Concepts
Processes The most important processes used in Web-based systems and their internal organization.
PHP / MySQL Introduction
File Transfer and access
Tutorial (4): HTTP Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Chapter 27 WWW and HTTP.
Application layer Lecture 7.
Multimedia and Networks
PHP and Forms.
Web Page Concept and Design :
HyperText Transfer Protocol
EE 122: HyperText Transfer Protocol (HTTP)
Lecture 5: Functions and Parameters
Chapter 27 WWW and HTTP Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
The HTTP Protocol COSC 2206 Internet Tools The HTTP Protocol
Environment Variables
APACHE WEB SERVER.
4.01 How Web Pages Work.
Web Servers (IIS and Apache)
Message Passing Systems Version 2
Web Application Development Using PHP
Message Passing Systems
Presentation transcript:

Web Protocols and Practice Web Servers Chapter 4 Web Protocols and Practice

Web Protocols and Practice WEB SERVERS Topics Web Server Definition Web Site versus Web Server Steps in Handling a Client Request Access Control Dynamically Generated Responses Passing Data to/from the Script Creating and Using Cookies Sharing Information Across Requests Server Architecture Server Hosting Case Study of the Apache Web Server Web Protocols and Practice

Web Protocols and Practice WEB SERVERS Web Server Definition A Web server is a program that generates and transmits responses to client requests for Web resources. Handling a client request consists of several key steps: Parsing the request message Checking that the request is authorized Associating the URL in the request with a file name Constructing the response message Transmitting the response message to the requesting client Web Protocols and Practice

Web Protocols and Practice WEB SERVERS Web Server Definition The server can generate the response message in a variety of ways: The server simply retrieves the file associated with the URL and returns the contents to the client. The server may invoke a script that communicates with other servers or a back-end database to construct the response message. Web Protocols and Practice

Web Site versus Web Server WEB SERVERS Web Site versus Web Server Web site and Web server are different: A Web site consists of a collection of Web pages associated with a particular hostname. A Web server is a program to satisfy client requests for Web resources. Web Protocols and Practice

Steps in Handling a Client Request WEB SERVERS Steps in Handling a Client Request A Web server proceeds through the following steps in handling an HTTP request: Read and parse the HTTP request message for example GET the resource /foo.htm Translate the URL to a file name for example the resource be located in the base directory such as /www, where the URL http://www.bar.com/foo/index.html corresponds to the file of www/foo/index.html Determine whether the request is authorized Generate and transmit the response that includes header to show the status information Web Protocols and Practice

Web Protocols and Practice WEB SERVERS Access Control A Web server may limit which users can access certain resources. Access control requires a combination of authentication and authorization. Authentication identifies the user who originated the request. Authorization determines which users have access to a particular resource. Web Protocols and Practice

Web Protocols and Practice WEB SERVERS AUTHENTICATION Most client-server systems authenticate a user by asking for a name and password. Web server must perform authentication for every request for a resource that has access restrictions. The server returns an HTTP response that indicates that the request requires authorization. The response also identifies what kind of authentication is required. The response also identifies the realm a string that associates a collection of resources at the server Web Protocols and Practice

Web Protocols and Practice WEB SERVERS AUTHORIZATION To control access to Web resources, the server must employ an authorization policy. A policy typically expressed in terms of an access control list that enumerates the users who are granted or denied access to the resources. In addition to checking the user name, the server may allow or deny access to the resource based on other information associated with the HTTP request, such as the host name or IP address of the requesting client. Authenticating HTTP requests can impose a heavy load on the Web server. Web Protocols and Practice

Dynamically Generated Responses WEB SERVERS Dynamically Generated Responses This feature differentiates the Web from earlier file transfer services on the Internet. Dynamically generated responses are created in a variety of ways: Server-side include Server script Web Protocols and Practice

Web Protocols and Practice WEB SERVERS Server-Side Include A server-side include instructs the Web server to customize a static resource based on directives in an HTML-like file. Web Protocols and Practice

Web Protocols and Practice WEB SERVERS Server Script A server script is a separate program that generates the request resource. The program may run as Part of the server A separate process The main role of the Web server is To associate the requested URL with the appropriate script To pass data to/from the script The main role of the script is To process the input from the server To generate the content to the client Web Protocols and Practice

Web Protocols and Practice WEB SERVERS Server Script The server can interact with the script in several different ways: Separate process invoked by the server Software module in the same process Persistent process contacted by the server Web Protocols and Practice

Passing Data to/from the Script WEB SERVERS Passing Data to/from the Script Decoupling the scripts from the Web server requires a well-defined interface for passing data between the two pieces of software. Common Gateway Interface (CGI) defines interfaces for a variety of operating system platforms. Table 4.1 Web Protocols and Practice

Table 4.1. Example CGI environment variables WEB SERVERS Table 4.1. Example CGI environment variables Example Variable Type www.bar.com Apache/10206 HTTP/1.0 80 /www CGI/2.0 SERVER_NAME SERVER_SOFTWARE SERVER_PROTOCOL SERVER_PORT DOCUMENT_ROOT GATEWAY_INTERFACE Server 10.9.57.188 users.berkeley.edu REMOTE_ADDR REMOTE_HOST Client Text/html 158 GET NAME=Noam+Chomsky De-CH Mozilla/2.0 CONTENT_TYPE CONTENT_LENGTH REQUEST_METHOD QUERY_STRING ACCEPT_LANGUAGE HTTP_USER_AGENT Request Web Protocols and Practice

Creating and Using Cookies WEB SERVERS Creating and Using Cookies Cookies are typically created, used, and modified by scripts invoked to generate dynamic responses, rather than by the Web server. The browser can be instructed to include a unique cookie in each HTTP request. If the request does not include cookie, the script create a new cookie and include the cookie in the header of the response message Set-Cookie: Customer="user17"; Version="1"; Path="/book" Subsequent requests from the user would include the cookie Cookie: Customer="user17"; Version="1"; Path="/book" Web Protocols and Practice

Creating and Using Cookies WEB SERVERS Creating and Using Cookies A script can use a cookie as a user identifier in interacting with a back-end database. Storing history information in the cookie may obviate the need to retain information about the user in a back-end database. Web Protocols and Practice

Sharing Information Across Requests WEB SERVERS Sharing Information Across Requests A Web server may retain some information to reduce the overhead of handling future requests by: Sharing HTTP responses across requests Sharing metadata across requests Web Protocols and Practice

Sharing HTTP Responses Across Requests WEB SERVERS Sharing HTTP Responses Across Requests In server-side caching, data from the disk is cached in main memory at the server. A Web server cache can be Static files Dynamically generated responses the server would need to ensure that the cached result is consistent with the primary copy of the information. Web Protocols and Practice

Sharing Metadata Across Requests WEB SERVERS Sharing Metadata Across Requests The server could store the information generated in the process such as: Translation of URL to file name Control information about the resource HTTP response headers The server could cache certain information across requests for different resources: Current date/time Client name Web Protocols and Practice

Web Protocols and Practice WEB SERVERS Server Architecture Some techniques for allocating system resources among competing client requests are : Event-driven server architecture Process-driven server architecture Hybrid server architecture Web Protocols and Practice

Event-Driven Server Architecture WEB SERVERS Event-Driven Server Architecture An event-driven server Has a single process that alternates between servicing different requests Allows the server to serialize operations that modify the same data Performs nonblocking system calls Not used in Most high-end Web servers Web Protocols and Practice

Process-Driven Server Architecture WEB SERVERS Process-Driven Server Architecture A process-driven server Allocates each request to a separate process One master process listens for new connection The master process creates, or forks, a separate process for each new connection Terminates the process after parsing the client request and transmitting the response To prevent memory leak Introduces overhead for switching from one process to another Web Protocols and Practice

Hybrid Server Architecture WEB SERVERS Hybrid Server Architecture In Hybrid server architectures The strengths of the event-driven and process-driven models are combined Each process would become an event-driven server that alternates between a small collection of requests A single process has multiple independent threads Main process instructs a separate helper process to perform time-consuming operations Web Protocols and Practice

Web Protocols and Practice WEB SERVERS Server Hosting Multiple Web sites on a single machine Multiple machine for a single Web site Figure 4.1. Web Protocols and Practice

Web Protocols and Practice WEB CLIENTS 1 www.foo.com www.bar.com 2 www.big.com Surrogate 3 To/From Internet www.big.com 4 www.mid.com Figure 4.1. Hosting complex with surrogate in front of four server machines Web Protocols and Practice

Web Protocols and Practice WEB SERVERS Apache Web Server The Apache server follows the process-driven model, with a parent process that assigns a process to each new connection. Web Protocols and Practice

Definition (default value in Apache 1.3.3) WEB CLIENTS Table 4.2 Key configuration directives for child processes and network connection Definition (default value in Apache 1.3.3) Directive Initial number of child processes (5) Maximum number of child processes (256) Target Minimum number of idle children (5) Target Maximum number of idle children (10) Maximum number of requests per child (30) Maximum number of pending connections (511) Size of the TCP send buffer (OS default) Max number of requests per connection (100) Maximum idle time for connection (15 sec) StartServers MaxClients MinSpareServers MaxSpareServers MaxRequestsPerChild ListenBacklog SendBufferSize MaxKeepAliveRequests KeepAliveTimeout Web Protocols and Practice

Web Protocols and Practice WEB SERVERS Apache Web Server Apache has a collection of handlers that perform an action using the requested file, as shown in Table 4.3. Web Protocols and Practice

Purpose (file extension) WEB CLIENTS Table 4.3 Built-in handlers in Apache server and default file extension Purpose (file extension) Handler Send the file as static content Send the file as an HTTP response message (.asis) Invoke the file as a CGI script (.cgi) Treat the file as a server-side include (.shtml) Treat the file as an imagemap rule file (.imap) Treat the file as a map for content negotiation (.var) Get the server’s configuration information Get the server’s status report Default-handler Send-as-is Cgi-script Server-parsed Imap-file Type-map Server-info Server-status Web Protocols and Practice