What is a Web Server - PowerPoint PPT Presentation

1 / 11
About This Presentation
Title:

What is a Web Server

Description:

What Does Connect Mean? ... Names or numbers and ports ... Last-Modified: blah-blah-blahrn rn. Raw data. What's a Minimal Response? HTTP/1.0 200 OK ... – PowerPoint PPT presentation

Number of Views:20
Avg rating:3.0/5.0
Slides: 12
Provided by: valued85
Category:
Tags: does | last | mean | my | name | server | web | what

less

Transcript and Presenter's Notes

Title: What is a Web Server


1
What is a Web Server?
  • Program that understands the HTTP protocol and
    generates appropriate responses
  • Clients connect to the machine
  • Clients send a request
  • Server reads request, generates response
  • Client interprets response appropriately

2
A Simplified Web Server
  • Client asks for file
  • Server finds appropriate file
  • Server sends back a response header followed by
    the files data
  • Server closes connection

3
What Does Connect Mean?
  • For all practical purposes, it looks like theres
    data available via a file descriptor
  • Stream of bytes
  • Can be treated like any other file descriptor
  • Not a FILE (like stdio, stderr)
  • Must use read() and write() system calls

4
How Do You Identify Machines
  • Names or numbers and ports
  • http//www.domain.com implies a machine named
    www.domain.com and a default port of 80
  • http//127.0.0.131415/index.html
  • Refers to current box (127.0.0.1 is me)
  • Port is 31415 (used for this project)
  • File is named index.html

5
How Do You Identify Files?
  • File name is specified in request
  • Server maps that name to a real file
  • Mapping can be whatever server wants
  • For example, /vivek/index.html is really
    /n/fs/fac/vivek/public_html/index.html

6
How Does a Request Look?
  • GET /index.html HTTP/1.0\r\n
  • Connection Keep-Alive\r\n
  • User-Agent Mozilla/4.72 en (X11..)\r\n
  • Host 127.0.0.131415\r\n
  • Accept image/gif, image/jpeg, /\r\n
  • Accept-Encoding gzip\r\n
  • Accept-Language en\r\n
  • Accept-Charset iso-8859-1,,utf-8\r\n
  • \r\n

7
What Do You Care About?
  • GET /index.html HTTP/1.0
  • In particular, just index.html
  • Assume / means /index.html

8
How Does a Response Look?
  • HTTP/1.0 200 OK\r\n
  • Date blah-blah-blah\r\n
  • Server blah-blah-blah\r\n
  • Content-Type important\r\n
  • Last-Modified blah-blah-blah\r\n
  • \r\n
  • Raw data

9
Whats a Minimal Response?
  • HTTP/1.0 200 OK
  • Content-Type important\r\n
  • \r\n
  • Data

10
What is Content-Type?
  • text/html
  • image/gif
  • image/jpeg
  • Others not needed

11
So Whats So Difficult?
  • Threads
  • Blocking
  • Select
Write a Comment
User Comments (0)
About PowerShow.com