⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 default.htm

📁 this gives details of the network programming
💻 HTM
字号:
<HTML><HEAD><TITLE>NetProg Homework 2</TITLE><LINK rel=stylesheet type="text/css" HREF=../../style/proj.css></HEAD><BODY BGCOLOR=WHITE MARGINHEIGHT=0 MARGINWIDTH=0 TOPMARGIN=0  LEFTMARGIN=0><TABLE bgColor=#8899aa border=0 cellPadding=4 cellSpacing=0 width="100%">  <TR>    <TD class=title>&nbsp NetProg 2002 HW2</TD> </TR><TR BGCOLOR=BLACK><TD CLASS=menu> &nbsp &nbsp<A CLASS=menu HREF=#desc>Project Description</A> &nbsp &nbsp |&nbsp &nbsp<A CLASS=menu HREF=#deliv>Deliverables</A> &nbsp &nbsp |&nbsp &nbsp<A CLASS=menu HREF=#grading>Grading</A>  &nbsp &nbsp |&nbsp &nbsp<A CLASS=menu HREF=#submitting>Submission</A> &nbsp &nbsp |&nbsp &nbsp<A CLASS=menu HREF=#notes>Notes & Hints</A></TD></TR></TABLE><DIV CLASS=page><H2 style="font-size: 16pt; color:black; text-align:center;">Homework 2: Proxy HTTP Server<BR><DIV STYLE="color:red">NOTE: Due Date has been moved!<BR><SPAN STYLE="font-size:10pt"> (due to the snow day last week, section 2missed a lecture) </SPAN></DIV><BR>Due Date for Local and live remote students: Wed, Feb 20th (by11:59PM)<BR>Due Date for Tape and Videostream Delay students: Wed, Feb 27th</H2><H4 ALIGN=CENTER>Late Penalty: 10 points per day (out of 100)</H4><H4 ALIGN=CENTER>Submit to <I>netprog-submit@cs.rpi.edu</I> with the subject line "2"<BR>Complete Submission instructions are <A HREF=#submitting>here</A></H4><A NAME=desc><HR></A><P>Your assignment is to write a Proxy HTTP Server. Your server must beable to handle GET, HEAD and POST requests (it can ignore any requestthat specifies any other HTTP request method) sent by a clientspeaking HTTP version 1.0 or 1.1. Your proxy should work with any HTTP client (browser), we will be testing it with a custom HTTP client written just to torture your server. </P><H3>What is and is not required:</H3><UL><LI><P>Your server must use a port number specified as the first command lineparameter (from argv[1]).  Your program will be run by an automatedsystem that requires that your server understand that it should usethe port number specified on the command line!</P></LI><LI><P>Your server must handle GET, HEAD and POST requestmethods.</P></LI><LI><P>Your server can ignore any other HTTP request method (treat therequest as an invalid request).</P></LI><LI><P>Your server must forward HTTP request headers to the server and responseheaders back to the client.</P></LI><LI><P>Your server does <B>not</B> need to be concurrent (although it's not hard and willmake your proxy much more <EM>usable</EM>).</P></LI><LI><P>We must not be able to kill your server simply by sending aninvalid request.<P></LI><LI><P>We must not be able to kill your server by stopping orkilling the client (this includes pressing the STOP button inNetscape or IE). </P></LI><LI><P>Your server does not need to support all the fancy features ofHTTP version 1.1, we are looking for basic functionality (by fancy, I mean things like persistent connections...). </P></LI> </UL><H3>Server Output</H3><P>To keep track of all requests, your server should print <B><I>one</B></I>line (to standard output) for each request serviced. The line shouldinclude the host name or IP address of the client, and the original request-line sent by theclient (not any of headers that accompanied the request). For example, thefollowing might be the output generated by your server if itreceived some requests from a client running on monica.cs.rpi.edu:</P><TABLE CELLPADDING=4 BGCOLOR=CYAN BORDER=1><TR><TD><PRE>&gt; hw2 1234 monica.cs.rpi.edu:  GET http://www.cs.rpi.edu/monica.cs.rpi.edu:  GET http://www.cs.rpi.edu/gfx/backg5.jpgmonica.cs.rpi.edu:  GET http://www.cs.rpi.edu/gfx/logo.jpgmonica.cs.rpi.edu:  GET http://www.yahoo.com/images/annakornikova.jpgmonica.cs.rpi.edu:  GET http://fred.com/purchase.asp?prod=17&qty=102monica.cs.rpi.edu:  HEAD http://www.slashdot.org/monica.cs.rpi.edu:  POST http://www.fbi.gov/insecuresubmission.cgi</PRE>  </TD></TR></TABLE><P>Note that it is not necessary to include the HTTP version number inthe output (but feel free to do so if you want).</P> <HR><A NAME=deliv><H3>Deliverables</H3> </A><P>You should submit all source code files necessary to build your server. If youuse a Makefile please include it, if not you need to includeinstructions on how to build your server. Your submissionmust also include a file named READMEthat includes the following: </P><UL><LI><P>Your Name</P></LI><LI><P>A list of files and a 1-line description of the contents of each file. </P></LI><LI><P>References to any borrowed code (the source code must also include this information).<P></LI><LI><P>A description of any known problems. If you think you know how to solve the problem(s) and simply didn't have time to do so - let us know how!</P></LI><LI><P>Anything else you think might be useful to us, such as what youlearned, what you had trouble with, if the project was too hard or tooeasy, etc.</P></LI></UL><A NAME=grading><H3>Grading</H3></A><P>Your server will be tested to make sure it works properly. We willuse a test client that will do it's best to mess up your server bysending nonsense, incredibly long request lines, and invalid webaddresses (yes, it will also send many valid requests).It is acceptable that your proxy respond to any nonsense request bysending back an HTTP response code that indicates an error andclosing the connection. It's not hard to send back an HTML document aswell (that describes the error), but this is not required. </P><P>Your testing should include using a real browser (you can tellNetscape or IE to use your server as a proxy), Dave will demonstrate this in class. Although using a real browser through your proxy is a great test, you need to remember that our client will send nonsenserequests to your server (and it may be hard to get a real browser todo this). You can use <CODE>telnet</CODE> to connect to your proxy andsend nonsense, or write your own test client. <B>IMPORTANT:</B> Makesure your proxy can handle images, don't rely soley on simple HTMLdocuments for all your testing!</P> <P>Points will be awarded as follows (partial credit is available foreach item): </P><TABLE BORDER=0><TR> <TH ALIGN=LEFT>GET and HEAD requests work properly with polite     clients</TH> <TD>30%</TD></TR><TR> <TH ALIGN=LEFT>POST works properly with polite     clients</TH> <TD>20%</TD></TR><TR> <TH ALIGN=LEFT>bad requests are handled without problems</TH> <TD>25%</TD></TR><TR> <TH ALIGN=LEFT>Style/readability</TH> <TD>25%</TD>  <TR> </TABLE>  <P><B>IMPORTANT NOTES ON GRADING:</B></P><DIV CLASS=in><LI><P>We will check for memory leaks and deduct points (up to 5 points)if we detect a problem. Your server should not get larger (should notrequire an endless supply of memory) as it handles each request. Makesure you clean up any dynamically allocated memory that is no longerneeded!</P><LI><P>We will also look through your source code to make sure that youhandle all possible errors (not just those that our test client canproduce). You can lose up to 10 points for not handling errors. Youdecide what to do when an error occurs, the important thing toremember is that the server should continue running if possible.Feel free to print out error messages (but it's not required).In many cases an error returned by a system call can be dealt with byterminating the connection to the client and moving on to the nextclient. Other cases are clearly fatal - for example if<CODE>bind</CODE> won'tgive you the port requested, then the server can't get started...</P></DIV><A NAME=submitting><H3>Submitting your files</H3></A><P>Submission of your homework is via email, the general idea is tosend an email message with all your files as attachments. There is an automated email submission system that will respond to yoursubmission right away, so you will have a record that we got yourfiles. </P><P>All projects must be submitted via email to <AHREF=mailto:netprog-submit@cs.rpi.edu><I>netprog-submit@cs.rpi.edu</I></A>. Thesubject line of the submission message should contain a single numberindicating the project number (2 for HW2). You mustinclude your files as attachments, feel free to send a zip-file or atar file.<P><B>Don't send compiled code!</B></P><P>You can expect a return email indicating receipt of your projectsubmission immediately. This receipt will include a list of all thefiles that were successfully extracted by the submission script -please look over the receipt carefully to make sure your submissionworked.</P><P><B>Multiple Submissions: </B> You can resubmit up to 10 times foreach project, we will always grade the last submission received unlessyou tell us otherwise.</P><A NAME=notes><H3>Notes, Hints and Links</H3></A><UL>  <LI><P>You need to have a basic understanding of HTTP! The best   places to look for information are <A  HREF=../../rfcs/rfc1945.html>RFC 1945 HTTP  1.0</A> and <A  HREF=../../rfcs/rfc2616.html>RFC 2616 HTTP  1.1</A>.</P>  <P>You may want to start with this document: <A   HREF=../../../../../www.w3.org/Protocols/HTTP/HTTP2.html> Basic HTTP (1992)   from w3.org</A>. This document is an incomplete description of HTTP   1.0 (from an early proposal, I think), but it has most of the   information you need for this project and is a much easier read   than the RFC.</P></LI>  <LI><P>We are not worried about whether your server can support     every nitty-gritty detail of HTTP 1.1, but rather that you can     write a proxy server that is usable (from a browser), robust (can     deal with nonsense requests and rude clients), and the code is     something that could be extended to support all the nitty-gritty     details of HTTP 1.1 (We expect code that has no memory leaks,     handles all errors, etc). </P></LI>     <LI><P>If a client closes a connection prematurely, your server can  receive a SIGPIPE (this happens when you call <CODE>write()</CODE>  on a socket that has been closed by the other end). By default,  a SIGPIPE will kill your process - so you need to handle this  situation. Check out section 5.13 in the text for a description  of how to handle this.</P></LI>   <LI><P>If you decide to make your server concurrent (via  <CODE>fork()</CODE>), you can't leave zombie processes around - they  must be handled by your server. If you don't know what a zombie  process is, either look it up (the book describes how to avoid  zombies) or don't use <CODE>fork()</CODE>. (You might also consider  reviewing your notes from OpSys!).</P></LI></UL></BODY></HTML>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -