You are here: Re: [PHP] Re: proc_open, fwrite, 16384 bytes magic « PHP « IT news, forums, messages
Re: [PHP] Re: proc_open, fwrite, 16384 bytes magic

Posted by Curt Zirzow on 11/02/05 23:48

On Wed, 02 Nov 2005 10:38:15 +0100, max wrote:

>> In this case are you sure that the file is being sent via proc_open()?
>> can you provide a simplified script that does this?
>
> Sure, here's a test script, the output from it, and a few words on the
> email I receive:
> <?php
> $descriptorspec = array(
> 0 => array("pipe", "r"),
> 1 => array("pipe", "w"),
> 2 => array("file", "/tmp/error-output.txt", "a")
> );
> $text = "";
> for ($i=0; $i<10240; $i++) $text.="1"; $text.="END\n";
> $doccmd = "/usr/bin/qmail-inject";
> $res = proc_open ($doccmd, $descriptorspec, $pipes);
> fwrite ($pipes[0],"TO: somemailaddress@some.host\n\n");
> echo fwrite ($pipes[0], $text)."\n";
> echo fwrite ($pipes[0], $text)."\n";
> fclose ($pipes[0]);
> ?>
>
> The output is:
> 10244
> 6109
>
> Now, that's not counting the first TO: plus two \n's. Altogether it
> always
> sums up to 16384 bytes.
>
> In the email I receive, it honestly shows exactly the amount of data
> fwrite() claimed to have written, and not a symbol more.

My guess is that qmail-inject has a limitation on the line length
that it can use. A couple tests I can suggest:

1. try to seperate the string with some line endings so the line sent
isnt over 16kb.

2. try to proc_open a transparent application that doesn't do any sort
sort of parsing. like '/bin/cat' and see what the output is.


HTH,

Curt.
--
http://news.zirzow.dyndns.org/

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация