php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #22772 Linefeed prepended to start of http-body
Submitted: 2003-03-18 14:10 UTC Modified: 2003-03-24 04:19 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:1 (100.0%)
From: c938264 at student dot dtu dot dk Assigned:
Status: No Feedback Package: Output Control
PHP Version: 4.3.0 OS: freeBSD 4.3, Apache/1.3.27
Private report: No CVE-ID: None
 [2003-03-18 14:10 UTC] c938264 at student dot dtu dot dk
I found this problem trying to serve a binary file.
The basic structure of this part of my script is:

header('Content-Type: ..');
header('Content-Length: ..');
<output file contents>

where <output file contents> would be readfile or similar. However I learned that the first byte of the served file was always a 0x0a (linefeed). I have used telnet to create  requests and log responses, and I have found that the response has the following structure:

<header><cr><lf>
..
<header><cr><lf>
<cr><lf>
<lf><body-part>

i.e. and extra <lf> prepended to the body part of the response. I have tested several different scenarios:

* no headers, echo some text
* set chunked transfer encoding, do a readfile
* set chunked transfer encoding, echo some text
* set chunked transfer encoding, use fwrite on php://stdout

All methods prepend the linefeed. The telnet dump verify that the headers are set correctly, so this should rule-out the possibility that the linefeed stems from any text before the <? -tag.

PHP is build with the following configuration line:

'./configure' '--with-apache=../apache_1.3.27' '--enable-safe-mode' '--with-mhash' '--enable-xslt' '--with-xslt-sablot' '--enable-sablot-errors-descriptive' '--with-pdflib' '--with-imap=/usr/local/imap' '--with-mcrypt' '--with-pspell' '--with-gettext' '--with-mysql=/usr/local' '--with-pgsql' '--with-gd' '--with-ttf' '--with-t1lib' '--with-png-dir' '--with-zlib-dir=/usr/local/zlib' '--enable-memory-limit' '--with-jpeg-dir' '--with-freetype-dir' '--enable-freetype-4bit-antialias-hack' '--with-tiff-dir' '--enable-exif' '--enable-calendar'

I think this problem may be related to #18740..

/David Holdt

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-03-24 04:19 UTC] sniper@php.net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Open". Thank you.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 13:01:31 2024 UTC