Project%201%20Web%20client%20and%20server - PowerPoint PPT Presentation

About This Presentation
Title:

Project%201%20Web%20client%20and%20server

Description:

Use a restricted subset of HTTP. Use socket programming ... From: neytmann_at_cybersurg.com. User-Agent: Mozilla/4.0. Example GET Request ... – PowerPoint PPT presentation

Number of Views:30
Avg rating:3.0/5.0
Slides: 14
Provided by: ashish9
Category:

less

Transcript and Presenter's Notes

Title: Project%201%20Web%20client%20and%20server


1
Project 1Web client and server
  • CS 340
  • Jan 2005

2
Project Goals
  • Implement a simple WWW client and server
  • Examples
  • Use a restricted subset of HTTP
  • Use socket programming
  • To give you experience with HTTP and sockets
    programming

3
HTTP Protocol
Sockets
4
HTTP Usage
  • HTTP is the protocol that supports communication
    between web browsers and web servers.
  • A Web Server is a HTTP server
  • Most clients/servers today speak version 1.1, but
    1.0 is also in use.

5
Request - Response
  • HTTP has a simple structure
  • client sends a request
  • server returns a reply.

6
HTTP 1.0 Request
Request-Line
Headers . . .
  • Lines of text (ASCII).
  • Lines end with CRLF \r\n
  • First line is called Request-Line

blank line
Content...
7
Request Line
  • Method URL HTTP-Version\r\n
  • The request line contains 3 tokens (words).
  • space characters separate the tokens.
  • Newline (\n) seems to work by itself (but the
    protocol requires CRLF)

8
The Header Lines
  • After the Request-Line come a number (possibly
    zero) of HTTP header lines.
  • Each header line contains an attribute name
    followed by a followed by a space and the
    attribute value.

The Name and Value are just text.
9
Headers
  • Request Headers provide information to the server
    about the client
  • what kind of client
  • what kind of content will be accepted
  • who is making the request
  • There can be 0 headers (HTTP 1.0)
  • HTTP 1.1 requires a Host header

10
Example HTTP Headers
  • Accept text/html
  • Host www.northwestern.edu
  • From neytmann_at_cybersurg.com
  • User-Agent Mozilla/4.0

11
Example GET Request
  • GET /ychen/examanswers.html HTTP/1.1
  • Accept /
  • Host www.cs.northwestern.edu
  • User-Agent Internet Explorer
  • From cheater_at_cs.northwestern.edu

There is a blank line here
12
Well Known Address
  • The well known TCP port for HTTP servers is
    port 80.
  • Other ports can be used as well...

13
Four parts
  • 0 Get build , configure and run the minet stack
  • 1 HTTP Client
  • 2 Connection-at-a-time HTTP Server
  • 3 Simple select-based Multiple-connection-at-a-ti
    me server
  • 4 Complex . ( Extra Credit )
Write a Comment
User Comments (0)
About PowerShow.com