250 likes | 424 Views
Internet Application —— Final Project. zhaoqin@bupt.edu.cn BUPT/QMUL 2009-11-19. Agenda. Project description Related knowledge Timesheet. Agenda. Project description Related knowledge Timesheet. Final Lab. Subject: HTTP Proxy Server Goals
E N D
Internet Application ——Final Project zhaoqin@bupt.edu.cn BUPT/QMUL 2009-11-19
Agenda • Project description • Related knowledge • Timesheet
Agenda • Project description • Related knowledge • Timesheet
Final Lab • Subject: HTTP Proxy Server • Goals • Forward HTTP data from browser to web server • Record and display related information • Forbid the access to sites in black list • Requirements • Understand HTTP • Make Socket and Web programming • Analyze network packets using wireshark
Details • Basic functions (imperative) • Support multiple browsers concurrently • URL can contain domain name and port number • If browsers access sites in your “black list” proxy server will redirect them to your page written in HTML with cautions • Display following contents as the output of proxy server: HTTP version, browser type, client OS, language, site name, web server name and web server OS. • Advanced functions (optional) • The cautions page can display picture, audio or video • Proxy server can authenticate user by name and password • Display “you are using proxy” at the top of requested pages • Display following contents as the output of proxy server: the click counts of sites visited, proxy server response timeand user network traffic through browser
Work Flow • This chart shows one available work flow of http proxy server • You should add advanced functions or your own design in the proper places
Packets without Proxy 1. telnet www.baidu.com 80 2. The results returned immediately as following picture shown:
Packets with Proxy - 1 1. Browser is configured with some proxy: proxy.bupt.edu.cn:8080 2. The IP of the proxy proxy.bupt.edu.cn is 114.255.40.66
Packets with Proxy - 2 3. Visit www.baidu.com whose IP is 202.106.196.115But the packets are sent to 114.255.40.66 as following picture shown:
What can we get from HTTP header? • You can try http://findmebyip.com/ More should be found in your own program!
Agenda • Project description • Related knowledge • Timesheet
Web Page Identifier • Known as Uniform Resource Locator (URL) • Encodes • Access protocol to use • Domain name of server • Protocol port number (optional) • Path through server’s file system (optional) • Parameters (optional) • Query (optional) • Formathttp: // hostname [: port] / path [; parameters] [? query]
Web Standards • Separate standards for • Representation • HyperText Markup Language (HTML) • Document contains text plus embedded links • HTML gives guidelines for display, not details • Consequence: two browsers may choose to display same document differently • Transfer • Used between browser and web server • Protocol is HyperText Transfer Protocol (HTTP) • Runs over TCP
HTTP Characteristics • Application level • Request / response paradigm • Stateless • Permits bi-directional transfer • Offers capability negotiation • Support for caching • Support for intermediaries
HTTP Operation • Browser sends requests to which server replies • Typical request: GET used to fetch document • ExampleGET http://www.baidu.com HTTP/1.1 • Relative URL also permittedGET / HTTP/1.1
HTTP Headers • HTTP uses MIME-like headers to carry meta information. • Both browsers and servers send headers that allow them to negotiate agreement on the document representation and encoding to be used. • If the user agent wishes to send the userid "Aladdin" and password "open sesame", it would use the following header field: Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==“QWxhZGRpbjpvcGVuIHNlc2FtZQ==” is the base64 encoding of “Aladdin:open sesame”
Connections • Persistent Connections • HTTP version 1.0 uses one TCP connection per transfer • Browser forms TCP connection to server • Browser sends GET request • Server returns header describing item • Server returns item • Server closes connection • HTTP version 1.1 permits connection to persist across multiple requests • Handing Persistence • To allow a TCP connection to persist through multiple requests and responses, HTTP sends a length before each response. • If it does not know the length, a server informs the client, sends the response, and then closes the connection.
Headers And Length Encoding • HTTP headers use same syntax as email headers • Lines of text followed by blank line • Lines of text have form keyword:information • For persistent connection header specifies length (in octets) of data item that follows
References • Online Base64 encoding http://www.ohyeal.cn/base64.jsp • RFC2616Hypertext Transfer Protocol -- HTTP/1.1 • RFC2617HTTP Authentication : Basic and Digest Access Authentication • HTML 4.01 Specificationhttp://www.w3.org/TR/html401/
Agenda • Project description • Related knowledge • Timesheet
07b07—07b10 • 完成方式 • 每两人一组,限同一个实验班内 • 今天交分组名单 • 验收截止日期 • 2009-12-31 • 报告截止日期 • 2010-01-03 • 文档内容 • 每组交一份实验报告(pdf格式),程序源码 • 压缩为.tar.gz、.tgz或者.rar、.zip格式文件 • 压缩文件命名 • 班级_学号_姓名_实验题目 • 例如:07b01_071234_李宁_http • 邮箱 • leizy@buptnet.edu.cn • zhangyin@buptnet.edu.cn
07b11—07b13 • 完成方式 • 每两人一组,限同一个实验班内 • 今天交分组名单 • 验收截止日期 • 2009-12-31 • 报告截止日期 • 2010-01-03 • 文档内容 • 每组交一份实验报告(pdf格式),程序源码 • 压缩为.tar.gz、.tgz或者.rar、.zip格式文件 • 压缩文件命名 • 班级_学号_姓名_实验题目 • 例如:07b01_071234_李宁_http • 邮箱 • leizy@buptnet.edu.cn • zhangyin@buptnet.edu.cn