/csapp_webserver

csapp chapter 11 homework

Primary LanguageC

CSAPP chapter 11 homework

Answer all the homework of Chapter 11 in CSAPP 3e

contributed by < TerryShu > 、 < ofAlpaca >

Detail in Hackmd

11.6

  • A. Modify Tiny so that it echoes every request line and request header.
  • B. Use your favorite browser to make a request to Tiny for static content. Capture the output from Tiny in a file.
  • C. Inspect the output from Tiny to determine the version of HTTP your browser uses.
  • D. Consult the HTTP/1.1 standard in RFC 2616 to determine the meaning of each header in the HTTP request from your browser. You can obtain RFC 2616 from www.rfc-editor.org/rfc.html.

11.7

  • Extend Tiny so that it serves MPG video files. Check your work using a real browser.

11.8

  • Modify Tiny so that it reaps CGI children inside a SIGCHLD handler instead of explicitly waiting for them to terminate.

11.9

  • Modify Tiny so that when it serves static content, it copies the requested file to the connected descriptor using malloc , rio_readn , and rio_writen , instead of mmap and rio_writen.

11.10

  • A. Write an HTML form for the CGI adder function in Figure 11.26. Your form should include two text boxes that users fill in with the two numbers to be added together. Your form should request content using the GET method.
  • B. Check your work by using a real browser to request the form from Tiny,submit the filled-in form to Tiny, and then display the dynamic content generated by adder.

11.11

  • Extend Tiny to support the HTTP HEAD method. Check your work using telnet as a Web client.

11.12

  • Extend Tiny so that it serves dynamic content requested by the HTTP POST method. Check your work using your favorite Web browser.

11.13

  • Modify Tiny so that it deals cleanly (without terminating) with the SIGPIPE signals and EPIPE errors that occur when the write function attempts to write to a prematurely closed connection.

How to run ?

after make, you can do ./tiny [port] to run the tiny server.