11.6

    A.

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

    B.

    ./tiny.6 5000 run server and
    firefox visit localhost:5000

    1. GET / 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. Connection: keep-alive

    C.

    HTTP 1.1

    D.

    visit rfc
    section 14 Header Field Definitions

    Accept: 14.1

    The Accept request-header field can be used to specify certain media types which are acceptable for the response.
    Accept headers can be used to indicate that the request is specifically limited to a small set of desired types, as in
    the case of a request for an in-line image.

    Accept-Encoding: 14.3

    The Accept-Encoding request-header field is similar to Accept, but restricts the content-codings
    that are acceptable in the response.

    Accept-Language: 14.4

    The Accept-Language request-header field is similar to Accept, but restricts the set of natural languages that
    are preferred as a response to the request. Language tags are defined in section 3.10.

    Connection: 14.10

    The Connection general-header field allows the sender to specify options that are desired for that particular
    connection and MUST NOT be communicated by proxies over further connections.

    Host: 14.23

    The Host request-header field specifies the Internet host and port number of the resource being requested, as
    obtained from the original URI given by the user or referring resource.
    The Host field value MUST represent the naming authority of the origin server or gateway given by
    the original URL. This allows the origin server or gateway to differentiate between internally-ambiguous URLs, such
    as the root “/” URL of a server for multiple host names on a single IP address.

    User-Agent: 14.43

    The User-Agent request-header field contains information about the user agent originating the request. This is for
    statistical purposes, the tracing of protocol violations, and automated recognition of user agents for the sake of
    tailoring responses to avoid particular user agent limitations. User agents SHOULD include this field with requests.
    The field can contain multiple product tokens (section 3.8) and comments identifying the agent and any subproducts
    which form a significant part of the user agent. By convention, the product tokens are listed in order of their
    significance for identifying the application.