Note that you might have to follow several re-directs in a row in order to arrive at the actual file. Parse the response header, determine the new location, and re-request at that address. "301 Moved Permanently" - The file is no longer at the URL you specified, but the server is telling you the new URL where the file now permanently lives."200 OK" - Request succeeded! Save this page to disk with the requested file name.While there are many HTTP responses, your program only needs to support the following options and take the indicated action: When attempting to download a URL, your program must parse the HTTP response to determine if the request succeeded. Client sends a request to the server: GET /filename HTTP/1.0.Client opens TCP connection to server on port 80.swget -url= -destdir=/path/to/myhome -verbose.help Display help message (which should print this list of commands) This option should also print the headers sent by the HTTP server (see Desired Output section below) verbose Turn on verbose output for debugging. Your project should produce a single binary named "swget" that supports the following command-line arguments: (See tips section below for a standard method to parse arguments given in this format) swget After downloading the requested file, your program should exit. When saving the file to disk, do not save the HTTP header information in the file. (A common usage of the real wget utility is to mirror an entire website to local disk). Your program does not need to implement recursive downloading of all linked HTML pages. This file might be an HTML file (a web page), a binary image, a zip file containing a program, or other data. Given a target URL, your version of wget ("swget") will attempt to download that file using the HTTP 1.0 protocol over TCP/IP and save it to the desired directory on local disk. In this project, you will be implementing a simplified version of wget (called swget) in C that supports a small subset of the features of the full program. (See ) It supports HTTP, HTTPS, and FTP protocols, as well as retrieval through HTTP proxies. GNU Wget is a free utility for non-interactive download of files from the Web. To support these objectives, you are not allowed to use any pre-built HTTP, URL-parsing, or socket management libraries. Hands-on experience with C programming, including details such as file I/O, C string parsing, and command-line argument parsing.See the honor code in the syllabus for more details. You can discuss problems and potential solutions with other students, but you cannot share completed programs or significant pieces of completed code. This assignment can be completed either individually, or in groups with a maximum of 2 members.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |