----- Original Message -----
From: Richard Levitte - VMS Whacker <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Friday, March 16, 2001 5:49 AM
Subject: Re: Problems with SSL_write ..


> From: Peter Sylvester <[EMAIL PROTECTED]>
>
> Peter.Sylvester> >
> Peter.Sylvester> > sprintf(szBuf,
> Peter.Sylvester> >   "POST %s HTTP/1.0\r\nContent-Type: %sContent-Length:
%d\r\n",
> Peter.Sylvester> > m_szURL, "text/html\r\n\r\n", nBytesToWrite);
> Peter.Sylvester>
> Peter.Sylvester> Due to the "text/html\r\n\r\n" the Content-length is
already outside the header
> Peter.Sylvester>
> Peter.Sylvester> > sprintf(szBuf,
> Peter.Sylvester> >   "POST %s HTTP/1.0\r\nContent-Length:
%d\r\nContent-Type: %s",
> Peter.Sylvester> > m_szURL, "text/html\r\n\r\n", nBytesToWrite);
>
> The best is probably to make all line-ends part of the format string:
>
> sprintf(szBuf,
>   "POST %s HTTP/1.0\r\nContent-Type: %s\r\nContent-Length:
%d\r\n\r\n",m_szURL, "text/html", nBytesToWrite);
>

Yes, that's the way I do it in my code as well. When your code is parsing
HTTP and your functions
expect HTTP header data as parameters it's best to pass in strings not
containing any "\r\n" newline chars.
That way, you only have one line of code, the sprintf() call, responsible
for properly formatting the
HTTP headers prior to transmission...



______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
Development Mailing List                       [EMAIL PROTECTED]
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to