Mailing List Archive

HTTP Programming
Hi,

How is the HTTP request prepared? Is it with a CRLF on every line or
is it just a CRLF on the request line?

GET /documentation/apache/ HTTP/1.0<crlf>
Connection: Keep-Alive<crlf>
User-Agent: Mozilla/4.01 [en] (Win95; I)<crlf>
Host: hal.etc.com.au<crlf>

If I were to prepare the above HTTP request in a text file, would I
place a "\n\r" for a CRLF or would I just place a "\n"?

Thanks,
--
Hareesh Nagarajan
WEB: http://puggy.symonds.net/~hareesh

--
gentoo-user@gentoo.org mailing list
Re: HTTP Programming [ In reply to ]
On Sat, 9 Oct 2004 12:10:15 -0500, Hareesh Nagarajan
<hareesh.nagarajan@gmail.com> wrote:
> Hi,
>
> How is the HTTP request prepared? Is it with a CRLF on every line or
> is it just a CRLF on the request line?
>
> GET /documentation/apache/ HTTP/1.0<crlf>
> Connection: Keep-Alive<crlf>
> User-Agent: Mozilla/4.01 [en] (Win95; I)<crlf>
> Host: hal.etc.com.au<crlf>
>
> If I were to prepare the above HTTP request in a text file, would I
> place a "\n\r" for a CRLF or would I just place a "\n"?
>
http://www.w3.org/Protocols/rfc2616/rfc2616-sec2.html#sec2.2
http://www.w3.org/Protocols/rfc2616/rfc2616-sec4.html#sec4
Those are the official formats, that should help you on.
--
"May the source be with you"

--
gentoo-user@gentoo.org mailing list
Re: HTTP Programming [ In reply to ]
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hareesh Nagarajan wrote:
| Hi,
|
| How is the HTTP request prepared? Is it with a CRLF on every line or
| is it just a CRLF on the request line?
|
| GET /documentation/apache/ HTTP/1.0<crlf>
| Connection: Keep-Alive<crlf>
| User-Agent: Mozilla/4.01 [en] (Win95; I)<crlf>
| Host: hal.etc.com.au<crlf>
|
| If I were to prepare the above HTTP request in a text file, would I
| place a "\n\r" for a CRLF or would I just place a "\n"?
|
| Thanks,

RFC2616 [1] is your friend.

Section 5 describes the format of a request as:

~ Request = Request-Line ; Section 5.1
~ *(( general-header ; Section 4.5
~ | request-header ; Section 5.3
~ | entity-header ) CRLF) ; Section 7.1
~ CRLF
~ [ message-body ] ; Section 4.3

Further up, in section 2.2 it describes the meaning of CRLF:

CRLF = CR LF
where CR = <US-ASCII CR, carriage return (13)>
and LF = <US-ASCII LF, linefeed (10)>

Definitely an interesting read (if you're cool like that) ; I keep mine next
to the john ;p

[1] ftp://ftp.rfc-editor.org/in-notes/rfc2616.txt
- --
A clever prophet makes sure of the event first.

Aaron Walker - Gentoo Developer [ Gentoo/BSD / forensics / cron ]
ka0ttic@gentoo.org http://dev.gentoo.org/~ka0ttic/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.6 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFBaCYXC3poscuANHARAiphAJ9MWXedBchR/QHNYQnZJ8414yiXmACg8z+x
xUEMp4Pgl3wNNnvXW4RTrmQ=
=OLhf
-----END PGP SIGNATURE-----

--
gentoo-user@gentoo.org mailing list