The Application Layer – HTTP and FTP Tahir Azim. Application Layer Protocols QoS lectures postponed to next week This week: Application Layer Protocols.

Slides:



Advertisements
Similar presentations
Hypertext Transfer PROTOCOL ----HTTP Sen Wang CSE5232 Network Programming.
Advertisements

HyperText Transfer Protocol (HTTP)
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
1 FTP: File Transfer Protocol EE 122: Intro to Communication Networks Fall 2007 (WF 4-5:30 in Cory 277) Vern Paxson TAs: Lisa Fowler, Daniel Killebrew.
File Transfer: FTP and TFTP
9/16/2003-9/18/2003 The Application Layer and Java Programming September 16-18, 2003.
Chapter 2 Application Layer Computer Networking: A Top Down Approach Featuring the Internet, 3 rd edition. Jim Kurose, Keith Ross Addison-Wesley, July.
Web, HTTP and Web Caching
Hypertext Transfer Protocol Information Systems 337 Prof. Harry Plantinga.
1 K. Salah Module 2.1: Application Layer Application-level protocols provide high-level services –Web and HTTP –DNS –Electronic mail –Remote login –FTP.
HTTP Overview Vijayan Sugumaran School of Business Administration Oakland University.
2/9/2004 Web and HTTP February 9, /9/2004 Assignments Due – Reading and Warmup Work on Message of the Day.
Hypertext Transport Protocol CS Dick Steflik.
 What is it ? What is it ?  URI,URN,URL URI,URN,URL  HTTP – methods HTTP – methods  HTTP Request Packets HTTP Request Packets  HTTP Request Headers.
PL-IV- Group A HTTP Request & Response Header
Rensselaer Polytechnic Institute CSC-432 – Operating Systems David Goldschmidt, Ph.D.
TCP/IP suit 4th Edition by Behrouz A Forouzan. 2 Internet Computing (CS-413)
John Degenhart Joseph Allen.  What is FTP?  Communication over Control connection  Communication over Data Connection  File Type  Data Structure.
File Transfer Protocol (FTP)
FTP File Transfer Protocol. Introduction transfer file to/from remote host client/server model  client: side that initiates transfer (either to/from.
HTTP Protocol Specification
FTP (File Transfer Protocol) & Telnet
Mail (smtp), VoIP (sip, rtp)
HyperText Transfer Protocol (HTTP).  HTTP is the protocol that supports communication between web browsers and web servers.  A “Web Server” is a HTTP.
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.
2: Application Layer1 CS 4244: Internet Software Development Dr. Eli Tilevich.
Application Layer 2 Figures from Kurose and Ross
Rensselaer Polytechnic Institute Shivkumar Kalvanaraman, Biplab Sikdar 1 The Web: the http protocol http: hypertext transfer protocol Web’s application.
20-1 Last time □ NAT □ Application layer ♦ Intro ♦ Web / HTTP.
2: Application Layer1 Internet apps: their protocols and transport protocols Application remote terminal access Web file transfer streaming multimedia.
Week 11: Application Layer1 Web and HTTP First some jargon r Web page consists of objects r Object can be HTML file, JPEG image, Java applet, audio file,…
Maryam Elahi University of Calgary – CPSC 441.  HTTP stands for Hypertext Transfer Protocol.  Used to deliver virtually all files and other data (collectively.
© Janice Regan, CMPT 128, Jan 2007 CMPT 371 Data Communications and Networking HTTP 0.
2: Application Layer1 Web and HTTP First some jargon Web page consists of base HTML-file which includes several referenced objects Object can be HTML file,
Sistem Jaringan dan Komunikasi Data #9. DNS The Internet Directory Service  the Domain Name Service (DNS) provides mapping between host name & IP address.
Proxy Lab Recitation I Monday Nov 20, 2006.
Data Communications and Computer Networks Chapter 2 CS 3830 Lecture 8 Omar Meqdadi Department of Computer Science and Software Engineering University of.
HTTP1 Hypertext Transfer Protocol (HTTP) After this lecture, you should be able to:  Know how Web Browsers and Web Servers communicate via HTTP Protocol.
TFTP: Trivial file transfer protocol
CIS679: Lecture 13 r Review of Last Lecture r More on HTTP.
Operating Systems Lesson 12. HTTP vs HTML HTML: hypertext markup language ◦ Definitions of tags that are added to Web documents to control their appearance.
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)
HTTP Here, we examine the hypertext transfer protocol (http) – originally introduced around 1990 but not standardized until 1997 (version 1.0) – protocol.
Tips on FTP Implementation
Web Services. 2 Internet Collection of physically interconnected computers. Messages decomposed into packets. Packets transmitted from source to destination.
Overview of Servlets and JSP
1 Tips for the assignment. 2 Socket: a door between application process and end- end-transport protocol (UDP or TCP) TCP service: reliable transfer of.
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.
EEC-484/584 Computer Networks Lecture 4 Wenbing Zhao (Part of the slides are based on Drs. Kurose & Ross ’ s slides for their Computer.
COMP2322 Lab 2 HTTP Steven Lee Jan. 29, HTTP Hypertext Transfer Protocol Web’s application layer protocol Client/server model – Client (browser):
World Wide Web r Most Web pages consist of: m base HTML page, and m several referenced objects addressed by a URL r URL has two components: host name and.
Web Caching. Why Caching? Faster browsing experience for users Cache hit rate Traffic Prioritization Reduce network bandwidth requirements significantly.
Week 11: Application Layer 1 Web and HTTP r Web page consists of objects r Object can be HTML file, JPEG image, Java applet, audio file,… r Web page consists.
1 FTP: File Transfer Protocol EE 122: Intro to Communication Networks Fall 2006 Vern Paxson TAs: Dilip Antony Joseph and Sukun Kim
Simple Web Services. Internet Basics The Internet is based on a communication protocol named TCP (Transmission Control Protocol) TCP allows programs running.
© Janice Regan, CMPT 128, Jan 2007 CMPT 371 Data Communications and Networking HTTP 0.
Network Applications: HTTP/1.0
Hypertext Transfer Protocol (HTTP) COMP6218 Web Architecture Dr Nicholas Gibbins –
Block 5: An application layer protocol: HTTP
COMP2322 Lab 2 HTTP Steven Lee Feb. 8, 2017.
Module 23 (ftp and wireshark)
Internet transport protocols services
File Transfer: FTP Objectives Chapter 19
HTTP Hypertext Transfer Protocol
File Transfer Protocol
HTTP Hypertext Transfer Protocol
File Transfer Protocol
Presentation transcript:

The Application Layer – HTTP and FTP Tahir Azim

Application Layer Protocols QoS lectures postponed to next week This week: Application Layer Protocols –FTP, HTTP, Bittorrent Materials reused from Philip Levis, David Mazieres (Stanford) and Vern Paxson (Berkeley)

File Transfer Protocol (FTP) Allows a user to copy files to/from remote hosts –Client program connects to FTP server –… provides a login id and password –… allows the user to explore the directories –… and download and upload files with the server A predecessor of the Web (RFC 959 in 1985) –Requires user to know the name of the server machine –… and have an account on the machine –… and find the directory where the files are stored –… and know whether the file is text or binary –… and know what tool to run to render and edit the file That is, no URL, hypertext, and helper applications

How Do You Transfer Files Today? HTTP - the usual Web transfer mechanism ( FTP –ftp:// links in web pages (e.g.: in sftp and scp –E.g.: to upload your project files to cms.niit.edu.pk BitTorrent and other file-sharing software Any others?

Why Study FTP? Helps cement familiarity with text/status-code based protocols Illustrates use of multiple concurrent connections –One for control (commands & replies) –Depending on command, can be additional one for data Illustrates reversal of roles –For data connection, FTP user’s process can play the server role, FTP server can play the client role

Example commands Authentication –USER: specify the user name to log in as –PASS: specify the user’s password Exploring the files –LIST: list the files for the given file specification –CWD: change to the given directory Downloading and uploading files –TYPE: set type to ASCII (A) or binary image (I) –RETR: retrieve the given file –STOR: upload the given file Closing the connection –QUIT: close the FTP connection

Server Response Codes 1xx: positive preliminary reply –The action is being started, but expect another reply before sending the next command. 2xx: positive completion reply –The action succeeded and a new command can be sent. 3xx: positive intermediate reply –The command was accepted but another command is now required. 4xx: transient negative completion reply –The command failed and should be retried later. 5xx: permanent negative completion reply –The command failed and should not be retried.

FTP Data Transfer Separate data connection –To send lists of files (LIST) –To retrieve a file (RETR) –To upload a file (STOR) control data

Creating the Data Connection Client acts like a server –Creates a socket Assigned an ephemeral port number by the kernel –Listens on socket –Waits to hear from FTP server socket

Creating Data Connection (cont.) But, the server doesn’t know the port number –So after starting to listen, client tells it to the server –Using the PORT command on the control connection –Server can tell the client a port to connect to using PASV or EPSV PORT

Why Out-of-Band Control? Avoids need to mark the end of the data transfer –Data transfer ends by closing of data connection –Yet, the control connection stays up Aborting a data transfer –Can abort a transfer without killing the control connection –… which avoids requiring the user to log in again –Done with an ABOR on the control connection Third-party file transfer between two hosts –Data connection could go to a different host –… by sending a different client IP address to the server –e.g., a user can coordinate a transfer between two servers –But: this is rarely needed, and presents security issues

Example Collected using: –tcpdump -s 0 -w ftp.trace host –ftp –Ethereal

Example blade1:~ # ftp Connected to Server sends back the following: Welcome to Pure-FTPd [privsep] [TLS] You are user number 1 of 50 allowed. 220-Local time is now 18:54. Server port: This is a private system - No anonymous login 220 You will be disconnected after 15 minutes of inactivity.

Example continued… Name ( tahir USER tahir 331 User tahir OK. Password required Password: PASS tahirazim 230-User tahir has group access to: tahir 230 OK. Current restricted directory is / SYST 215 UNIX Type: L8 FEAT 211-Extensions supported: EPRT IDLE MDTM SIZE REST STREAM MLST type*;size*;sizd*;modify*;UNIX.mode*;UNIX.uid*;UNIX.gid*;unique*; MLSD ESTP PASV EPSV SPSV ESTA AUTH TLS PBSZ PROT 211 End.

Example continued… ftp> pwd PWD 257 "/" is your current location ftp> cd public_html/tinyos CWD public_html/tinyos 250 OK. Current directory is /public_html/tinyos

Example continued… ftp> ls EPSV 229 Extended Passive mode OK (|||22710|) LIST 150 Accepted data connection 226-Options: -l matches total Received from port of the server: -rw-r--r-- 1 tahir tahir Feb 1 14:23 BVR-T2-0.1.tar.gz -rw-r--r-- 1 tahir tahir 535 Jan 18 20:03 Makefile -rw-r--r-- 1 tahir tahir 2788 Jan 18 20:03 RadioCountToLedsAppC.nc -rw-r--r-- 1 tahir tahir 5219 Jan 18 20:03 RadioCountToLedsC.nc -rw-r--r-- 1 tahir tahir Jan 18 20:03 nesC-wksp.ppt

Example continued… ftp> get Makefile TYPE I 200 TYPE is now 8-bit binary SIZE Makefile EPSV 229 Extended Passive mode OK (|||9442|) RETR Makefile 150 Accepted data connection 226-File successfully transferred seconds (measured here), 1.11 Mbytes per second MDTM Makefile From port 9442 of the server: COMPONENT=RadioCountToLedsAppC BUILD_EXTRA_DEPS = RadioCountMsg.py RadioCountMsg.class RadioCountMsg.py: RadioCountToLeds.h.mig python -target=$(PLATFORM) $(CFLAGS) -python-classname=RadioCountMsg RadioCountToLeds.h radio_count_msg -o RadioCountMsg.class: RadioCountMsg.java.javac RadioCountMsg.java RadioCountMsg.java: RadioCountToLeds.h.mig java -target=$(PLATFORM) $(CFLAGS) -java-classname=RadioCountMsg RadioCountToLeds.h radio_count_msg -o #CFLAGS += -I/home/Tahir/T2SerialT1. include $(MAKERULES)

Example continued… ftp> exit QUIT 221-Goodbye. You uploaded 0 and downloaded 1 kbytes. 221 Logout.

HTTP Server listens on a port (by default, 80) On connection, waits for a request Protocol (but not data) is in ASCII Sends response, maybe closes connection (client can ask it to stay open)

Parsing a URL Protocol Host File path on host

HTTP Request Format Request types: GET, PUT, POST, HEAD, DELETE A trivial browser request:

A trivial browser request GET / HTTP/1.1 Host: localhost:8000 User-Agent: Mozilla/5.0 (Macinto... Accept: text/xml,application/xm... Accept-Language: en-us,en;q=0.5 Accept-Encoding: gzip,deflate Accept-Charset: ISO ,utf-8;q=0.7,*;q=0.7 Keep-Alive: 300 Connection: keep-alive

Other useful header fields Range: Request a partial range of data Authorization: Present authorization credentials to a server (not HTTPS) Proxy-Authorization: Present proxy credentials to a proxy server Referer: URL of the web page the user was on, when the HTTP request was made

HTTP Response Format 1xx codes: Informational 2xx codes: Successes 3xx codes: Redirection 4xx codes: Client Error, 5xx codes: Server Error

Response from thenews.com.pk HTTP/ OK Date: Fri, 14 Mar :13:05 GMT Server: Microsoft-IIS/6.0 X-Powered-By: ASP.NET Content-Length: Content-Type: text/html Set-Cookie: ASPSESSIONIDAADTQQAR=PFKAADCBBDGBDDJLMKLFJNMI; path=/ Cache-Control: private X-Cache: MISS from micronet-proxy.niit.edu.pk X-Cache-Lookup: MISS from micronet-proxy.niit.edu.pk:8080 X-Cache: MISS from proxy-ptcl.niit.edu.pk X-Cache-Lookup: MISS from proxy-ptcl.niit.edu.pk:8080 Via: 1.0 micronet-proxy.niit.edu.pk:8080 (squid/2.6.STABLE5), 1.0 proxy- ptcl.niit.edu.pk:8080 (squid/2.6.STABLE5) Connection: keep-alive The News - International - Friday, March 14, 2008 …

HTTP Performance What matters most? Different kinds of requests –Lots of small requests (loading a web page) –Big request (fetching a download) Require different solutions

Small requests Latency matters Governed by RTT between hosts Two major causes of delay: –Opening a TCP connection –Data response-request Solutions: –Persistent connections –Pre-fetching –Others??

Browser request, revisited GET / HTTP/1.1 Host: localhost:8000 User-Agent: Mozilla/5.0 (Macinto... Accept: text/xml,application/xm... Accept-Language: en-us,en;q=0.5 Accept-Encoding: gzip,deflate Accept-Charset: ISO ,utf-8;q=0.7,*;q=0.7 Keep-Alive: 300 Connection: keep-alive

Big requests Problem is throughput on bottleneck links (usually edge links) Use an HTTP proxy cache or mirror –Can also improve latency!

Stale caches Items in the cache can go stale (you don’t want to read yesterday’s paper) Cache needs a way to conditionally ask for a document Cache can issue a conditional GET (with an If- modified-since header) –Server can reply with a 304 Not Modified GET / HTTP/1.1 Host: If-modified-since: Wed, 2 April :00:00

Client-server vs Peer-to-peer Server can be a bottleneck –Download time can scale down O(n) with n clients –Scaling up server bandwidth can be expensive (CDNs) –Slashdotting/flash crowds Peer-to-peer: get a bunch of end-hosts to collaboratively distribute content A common peer-to-peer challenge is finding whom to collaborate with

Bittorrent