Fun Fun Project One1 Building Your Very Own Web Server.

Slides:



Advertisements
Similar presentations
Fun Fun Project One1 Building Your Very Own Web Server.
Advertisements

HTTP HyperText Transfer Protocol. HTTP Uses TCP as its underlying transport protocol Uses port 80 Stateless protocol (i.e. HTTP Server maintains no information.
HTTP – HyperText Transfer Protocol
1 HTTP – HyperText Transfer Protocol Part 1. 2 Common Protocols In order for two remote machines to “ understand ” each other they should –‘‘ speak the.
16-Jun-15 HTTP Hypertext Transfer Protocol. 2 HTTP messages HTTP is the language that web clients and web servers use to talk to each other HTTP is largely.
HTTP Hypertext Transfer Protocol. HTTP messages HTTP is the language that web clients and web servers use to talk to each other –HTTP is largely “under.
How the web works: HTTP and CGI explained
Programming Project #3CS-4513, D-Term Programming Project #3 Simple Web Server CS-4513 D-Term 2007 (Slides include materials from Operating System.
1 Web Search Interfaces. 2 Web Search Interface Web search engines of course need a web-based interface. Search page must accept a query string and submit.
Chapter 2 Application Layer Computer Networking: A Top Down Approach Featuring the Internet, 3 rd edition. Jim Kurose, Keith Ross Addison-Wesley, July.
CS 142 Lecture Notes: HTTPSlide 1 HTTP Request GET /index.html HTTP/1.1 Host: User-Agent: Mozilla/5.0 Accept: text/html, */* Accept-Language:
2/9/2004 Web and HTTP February 9, /9/2004 Assignments Due – Reading and Warmup Work on Message of the Day.
Client, Server, HTTP, IP Address, Domain Name. Client-Server Model Client Bob Yahoo Server yahoo.com/finance.html A text file named finance.html.
CSC 2720 Building Web Applications Servlet – Getting and Setting HTTP Headers.
Lecture 4 Web browsers, servers and HTTP Boriana Koleva Room: C54
Rensselaer Polytechnic Institute CSC-432 – Operating Systems David Goldschmidt, Ph.D.
University of Calgary – CPSC 441 Parts of these slides are courtesy of Erich Nahum (IBM Research)
Web Hacking 1. Overview Why web HTTP Protocol HTTP Attacks 2.
Web Architecture Dr. Frank McCown Intro to Web Science Harding University This work is licensed under a Creative Commons Attribution-NonCommercial- ShareAlike.
Simple Web Services. Internet Basics The Internet is based on a communication protocol named TCP (Transmission Control Protocol) TCP allows programs running.
Web Server Design Week 5 Old Dominion University Department of Computer Science CS 495/595 Spring 2010 Martin Klein 2/10/10.
COMP3016 Web Technologies Introduction and Discussion What is the Web?
HTTP Protocol Specification
Google App Engine Chien-Chung Shen
FTP (File Transfer Protocol) & Telnet
Simple Web Services. Internet Basics The Internet is based on a communication protocol named TCP (Transmission Control Protocol) TCP allows programs running.
HyperText Transfer Protocol (HTTP).  HTTP is the protocol that supports communication between web browsers and web servers.  A “Web Server” is a HTTP.
CSC 2720 Building Web Applications Getting and Setting HTTP Headers (With PHP Examples)
CP476 Internet Computing Lecture 5 : HTTP, WWW and URL 1 Lecture 5. WWW, HTTP and URL Objective: to review the concepts of WWW to understand how HTTP works.
Application Layer 2 Figures from Kurose and Ross
Maryam Elahi University of Calgary – CPSC 441.  HTTP stands for Hypertext Transfer Protocol.  Used to deliver virtually all files and other data (collectively.
Introduction 1 Lecture 6 Application Layer (HTTP) slides are modified from J. Kurose & K. Ross University of Nevada – Reno Computer Science & Engineering.
WebServer A Web server is a program that, using the client/server model and the World Wide Web's Hypertext Transfer Protocol (HTTP), serves the files that.
1 Introductory material. This module illustrates the interactions of the protocols of the TCP/IP protocol suite with the help of an example. The example.
Proxy Lab Recitation I Monday Nov 20, 2006.
Web Spiders Dan Reeves Bill Walsh HDIW EECS February 2000.
Web Server Design Week 8 Old Dominion University Department of Computer Science CS 495/595 Spring 2010 Martin Klein 3/3/10.
1 CS 4396 Computer Networks Lab TCP/IP Networking An Example.
HTTP1 Hypertext Transfer Protocol (HTTP) After this lecture, you should be able to:  Know how Web Browsers and Web Servers communicate via HTTP Protocol.
CIS679: Lecture 13 r Review of Last Lecture r More on HTTP.
A Little Bit About Cookies Fort Collins, CO Copyright © XTR Systems, LLC A Little Bit About Cookies Instructor: Joseph DiVerdi, Ph.D., M.B.A.
1-1 HTTP request message GET /somedir/page.html HTTP/1.1 Host: User-agent: Mozilla/4.0 Connection: close Accept-language:fr request.
WWW: an Internet application Bill Chu. © Bei-Tseng Chu Aug 2000 WWW Web and HTTP WWW web is an interconnected information servers each server maintains.
Operating Systems Lesson 12. HTTP vs HTML HTML: hypertext markup language ◦ Definitions of tags that are added to Web documents to control their appearance.
WEB SERVER Mark Kimmet Shana Blair. The Project Web Server Application  Receives request for web pages or images from a client browser via the internet.
Application Layer 2-1 Lecture 4: Web and HTTP. Web and HTTP First, a review… web page consists of objects object can be HTML file, JPEG image, Java applet,
2: Application Layer 1 Chapter 2: Application layer r 2.1 Principles of network applications  app architectures  app requirements r 2.2 Web and HTTP.
CITA 310 Section 2 HTTP (Selected Topics from Textbook Chapter 6)
Advance Computer Networks Lecture#05 Instructor: Engr. Muhammad Mateen Yaqoob.
HTTP How the Internet servers and clients communicate.
HTTP Here, we examine the hypertext transfer protocol (http) – originally introduced around 1990 but not standardized until 1997 (version 1.0) – protocol.
Web Services. 2 Internet Collection of physically interconnected computers. Messages decomposed into packets. Packets transmitted from source to destination.
Overview of Servlets and JSP
HTTP protocol Java Servlets. HTTP protocol Web system communicates with end-user via HTTP protocol HTTP protocol methods: GET, POST, HEAD, PUT, OPTIONS,
LURP Details. LURP Lab Details  1.Given a GET … call a proxy CGI script in the same way you would for a normal CGI request  2.This UDP perl.
Data Communications and Computer Networks Chapter 2 CS 3830 Lecture 7 Omar Meqdadi Department of Computer Science and Software Engineering University of.
COMP2322 Lab 2 HTTP Steven Lee Jan. 29, HTTP Hypertext Transfer Protocol Web’s application layer protocol Client/server model – Client (browser):
Application Layer 2-1 Chapter 2 Application Layer Computer Networking: A Top Down Approach 6 th edition Jim Kurose, Keith Ross Addison-Wesley March 2012.
1 Introductory material. This module illustrates the interactions of the protocols of the TCP/IP protocol suite with the help of an example. The example.
WEB1P webarch1 Web architecture Dr Jim Briggs. WEB1P webarch2 What is the web? Distributed system Client-server system Characteristics of clients and.
Simple Web Services. Internet Basics The Internet is based on a communication protocol named TCP (Transmission Control Protocol) TCP allows programs running.
Web Server Design Week 5 Old Dominion University Department of Computer Science CS 495/595 Spring 2012 Michael L. Nelson 02/07/12.
REST API Design. Application API API = Application Programming Interface APIs expose functionality of an application or service that exists independently.
© Janice Regan, CMPT 128, Jan 2007 CMPT 371 Data Communications and Networking HTTP 0.
Web Server Design Week 6 Old Dominion University Department of Computer Science CS 495/595 Spring 2006 Michael L. Nelson 2/13/06.
Building Your Very Own Web Server
HTTP – An overview.
Authentication & .htaccess
HTTP Hypertext Transfer Protocol
Presentation transcript:

Fun Fun Project One1 Building Your Very Own Web Server

Fun Fun Project One2 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

Fun Fun Project One3 A Simplified Web Server Client asks for file Server finds appropriate file Server sends back a response header followed by the file’s data Server closes connection

Fun Fun Project One4 What Does Connect Mean? For all practical purposes, it looks like there’s 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

Fun Fun Project One5 How Do You Identify Machines Names or numbers and ports implies a machine named and a default port of Refers to current box ( is me) Port # is (used for this project) File is named index.html

Fun Fun Project One6 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

Fun Fun Project One7 What’s In A Request? GET /index.html HTTP/1.0\r\n Connection: Keep-Alive\r\n User-Agent: Mozilla/4.72 [en] (X11..)\r\n Host: :31415\r\n Accept: image/gif, image/jpeg, */*\r\n Accept-Encoding: gzip\r\n Accept-Language: en\r\n Accept-Charset: iso ,*,utf-8\r\n \r\n

Fun Fun Project One8 What Do You Care About? GET /index.html HTTP/1.0 In particular, just index.html Assume “/” means “/index.html”

Fun Fun Project One9 What Could They Want? An honest-to-goodness file (me.jpg) An indirect request for such a file (such as “/” meaning index.html) An implied directory with index (/home/vivek instead of /home/vivek/) Just a directory listing A query (we don’t care about these) An invalid/nonexistent file

Fun Fun Project One10 What’s In A Response? HTTP/ 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

Fun Fun Project One11 What’s a Minimal Response? HTTP/ OK\r\n Content-Type: stuff\r\n \r\n Data HTTP/ Moved\r\n Location: newurl\r\n \r\n HTTP/ Not Found\r\n \r\n But also Connection: close\r\n Content-Length: yyy\r\n

Fun Fun Project One12 How Do You Decide? File exists? Send it Directory without “/” suffix? Redirect Directory with index.html? Send it Directory with no index.html? List it For each list entry, add “/” if needed Failure? Send 404

Fun Fun Project One13 How Do You Test It? Use a browser Use “wget” or create hierarchy Include some big images

Fun Fun Project One14 What is Content-Type? text/html image/gif image/jpeg Others not needed

Fun Fun Project One15 Where Can I Find More? Google: HTTP 1.1 Specification - painful man pages man man –k blah read( ), write( ), open( ), close( )

Fun Fun Project One16 Why open instead of fopen? Compare fopen, fread, etc., with open, read, etc We’re dealing with functions closer to the OS – easier to use in some cases Practice

Fun Fun Project One17 What’s a File Descriptor? Sort of like a FILE * It’s an integer provided by OS Used to represent a stream of bytes Can represent file or network connection Behavior is slightly different Especially when reading/writing network

Fun Fun Project One18 General Steps Setup, and then Get next connection If file, read from disk If directory, generate listing Send all to client Close connection, wait for next one

Fun Fun Project One19 What Am I Given? Setup function Makes server available for connections Accept function Gets a connection from a client File type function Tells you what kind of file, if it exists Tells you how many bytes if a regular file Directory listing functions Gives you the file names one at a time

Fun Fun Project One20 Help! I’m Lost! Don’t know HTML? Use Netscape composer to see what to do View page source for various pages Do “telnet 80” and issue the GET manually (need to add “Host: header) Ask

Fun Fun Project One21 Why Are We Doing This? Infrastructure for future projects Some OS/Networking interaction It’s fun, and not too bad