Forum Discussion

4 Replies

  • The Carriage Return (CR) \r and Line Feed (LF) \n line termination characters are key to the accurate construction and parsing of HTTP requests,regardless of the HTTP version. The CR and LF character sequences specified in the monitor Send String varies by version.

     

  • Hamish's avatar
    Hamish
    Icon for Cirrocumulus rankCirrocumulus

    In short...

    Monitor strings are encoded. Rather than you typing out everything and seeing it in WYSIWYG, it's entered as a single line using standard encoding for non-printable characters. As an EOL (End Of Line) in HTTP is denoted by a carriage return (\r) and a linefeed (\n), so the sequence

    GET / HTTP/1.0\r\n
    

    signifies a single line. With EOL. The complete sequence

    GET / HTTP/1.0\r\nConnection: close\r\n\r\n
    

    renders as 3 lines... 2 with content in them. One blank.

    1. 'GET / HTTP/1.0'
    2. 'Connection: close'
    3. ''
    

    The 3rd line is represented by the double EOL (\r\n\r\n), it (A blank line) signifies the end of the request (Where no content is specified) for an HTTP/1.0 (Or HTTP/1.1) request. An HTTP/0.9 request (Hopefully never actually used by anyone any more) is ended with single a single \r\n sequence.

    A better reference for HTTP requests would be the HTTP/1.0 or HTTP/1.1 RFC's (Small differences between them, mainly in the area of which headers are mandatory or optional).

    H