Re: [PHP] Re: proc_open, fwrite, 16384 bytes magic

2005-11-02 Thread max
 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; $i10240; $i++) $text.=1;
  $text.=END\n;
  $doccmd = /usr/bin/qmail-inject;
  $res = proc_open ($doccmd, $descriptorspec, $pipes);
  fwrite ($pipes[0], TO: [EMAIL PROTECTED]);
  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.

  Any ideas?

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



Re: [PHP] Re: proc_open, fwrite, 16384 bytes magic

2005-11-02 Thread Curt Zirzow
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; $i10240; $i++) $text.=1; $text.=END\n;
   $doccmd = /usr/bin/qmail-inject;
   $res = proc_open ($doccmd, $descriptorspec, $pipes); 
   fwrite ($pipes[0],TO: [EMAIL PROTECTED]); 
   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/

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



[PHP] Re: proc_open, fwrite, 16384 bytes magic

2005-11-01 Thread Curt Zirzow
On Tue, 01 Nov 2005 19:10:31 +0100, Max Belushkin wrote:

Hi everyone,
 
   I've ran into a rather strange problem with Apache 2.0.x, PHP 4.4.0,
 FreeBSD. When I proc_open qmail-inject, the first 16384 bytes from a
 buffer are accepted perfectly, which makes it an exact 16 KB. If a buffer
 is larger, the rest is discarded. No errors appear anywhere - and I think
 I've looked just about everywhere I could think of by now. This problem
 does not manifest itself on a different installation of Apache 2.0.x, PHP
 4.3.8, SUSE Linux, but tested against postfix, up to sizes of 95 KB.

If the same test fails on qmail-inject that you used with postfix, i would
assume it is a configuration with qmail. Another test is to feed
qmail-inject the same message you are using with the proc_open() call
directly via the shell:
  qmai-inject  /path/to/somefile

or equivalent.


   I've searched Google all over, but could not find any hints. My best
 guess so far is that I'm missing something in configuration directives, or
 it's a qmail problem - although, with qmail-inject fed via cat, everything
 works just fine, regardless of size.

In this case are you sure that the file is being sent via proc_open()? can
you provide a simplified script that does this?


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

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