RE: [PHP] Spurious newlines when requesting empty php file

2004-12-11 Thread Carl Michael Skog
Thanks for the answer !

The URL of the file is http://www.formatemp.com/catalog/paynova-reply.php
and the file is definitely empty.
It was created by the touch(UNIX command):
-rw-r--r--   42 foo   foo  0 Dec 10 18:49 paynova-reply.php

The server is configured as follows:
Apache/1.3.33 (Unix) mod_perl/1.29 mod_auth_passthrough/1.8
mod_log_bytes/1.2 mod_bwlimited/1.4 PHP/4.3.9 mod_ssl/2.8.21 OpenSSL/0.9.6b
It is a server configured by my ISP, eXaion.com.

If I save the response of this command with lynx (lynx -dump
"http://www.formatemp.com/catalog/paynova-reply.php"; > somefile),
I will get three newlines.

If I request this file in a browser and scrutinize the response packet in a
packet analyser, I see something fishy.

After the usual header fields part are closed with the usual double "\r\n"
sequence, a "new" header is added, consisting of the character "0".
This is the then closed with the double "\r\n" sequence.
In other words, the extra hex characters 30, 0D, 0A, 0D, 0A are included in
the data part of the package.


Obviously, this is part of the data part of the package, and possibly
becomes the three newlines I am observing.

What does this "extra" header value come from ?


Regards,
Carl Michael Skog


-Original Message-
From: Richard Lynch ceo-at-l-i-e.com |PHP General user list|
[mailto:...] 
Sent: den 10 december 2004 22:40
To: .
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] Spurious newlines when requesting empty php file

Carl Michael Skog wrote:
> Some strange results with spurious newlines inserted in the response 
> when requesting a php file has led me to investigating what happens 
> when a completely empty php-file is requested.
>
> I would have thought that the response from a empty php file would 
> also be empty, but, to my surprise, they consist of 3 newlines !!!
>
> The strange thing is that I observed this behaviour on two completely 
> unrelated servers.
>
> Is this what can be expected or is it a result of misconfiguration ?

I just tried this with an empty PHP file, and got exactly what I expected.

A valid response with no content at all.

Please specify your software versions, and provide URLs and, as silly as
this sounds, an "ls -als empty.php" so we can see your empty PHP file.

Also check php.ini for auto_prepend_file and auto_append_file settings,
which might be tacking on blanks.

And, if you are using this as an "empty" file:
--- not quite empty file - 
--
then PHP is quite right to send out the newline at the end.


- really empty file - -

Note that some editors, under some configurations, will *ADD* a newline to a
file on the last line for historical reasons.

Re-configure your editor *now* if yours does that, our include files and
calls to http://php.net/header will drive you crazy, or you'll end up
mis-using output buffering to "solve" your non-problem.

--
Like Music?
http://l-i-e.com/artists.htm

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Spurious newlines when requesting empty php file

2004-12-09 Thread Carl Michael Skog
Some strange results with spurious newlines inserted in the response when 
requesting a php file has led me to investigating what happens when a 
completely empty php-file is requested.



I would have thought that the response from a empty php file would also be 
empty, but, to my surprise, they consist of 3 newlines !!!



The strange thing is that I observed this behaviour on two completely unrelated 
servers.



Is this what can be expected or is it a result of misconfiguration ?



Kind regards, 

Carl Michael Skog

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php