11.12

    run server

    1. (cd chapter11/code; make && ./tiny.12 5000)

    visit http://localhost:5000/post-home.html and submit

    POST method pass param by message-body behind Headers part.
    When we input 9 and 10 and submit, socket pass content

    1. POST /cgi-bin/post-adder HTTP/1.1
    2. Host: localhost:5000
    3. User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:53.0) Gecko/20100101 Firefox/53.0
    4. Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
    5. Accept-Language: en-US,en;q=0.5
    6. Accept-Encoding: gzip, deflate
    7. Content-Type: application/x-www-form-urlencoded
    8. Content-Length: 16
    9. Referer: http://localhost:5000/post-home.html
    10. Cookie: _ga=GA1.1.1286836072.1494744693
    11. Connection: keep-alive
    12. Upgrade-Insecure-Requests: 1
    13. (CRLF here, message-body below)
    14. first=9&second=10

    Content-Length marks the length of message-body.
    use readnb to fetch post param.

    1. !INCLUDE "./code/tiny.12.c.diff"

    post-adder code

    1. !INCLUDE "./code/cgi-bin/post-adder.c"