In the second example I have already appended "\r\n" to the write buffer.

So it really is:
$write_buffer .= "\r\n";
$r->print($write_buffer);
$r->print($jpeg);
$r->print("\r\n\r\n");

I try to write the same data to the client. In one case I write it as one big buffer, in the other case I write the header, then the JPEG, then the footer.

I can use print and $r->print to write the unified buffer if the Content-Disposition tag is not added or if it does not have the "; filename=.*" substring as part of the value

Works:
""
"Content-Disposition: attachment"

$r->print failes on the unified buffer if it contains the full Content-Disposition value:
"Content-Disposition: attachment; filename=\"$snapshot_filename\"\r\n"

The standalone print works and I can get $r->print to work if I split the printing into the three chunks I mentioned.

$r->print on the unified buffer returns that it sent more bytes than were even in the buffer (Example: bytes sent=10882 and length($write_buffer)=7647).

So, the two big questions are:
1) why is $r->print returning more bytes sent than are in the buffer
2) why does print work but $r->print does not on this case

sorry about the confusion,
Christopher

Larry Leszczynski wrote:
Hi Christopher -

I don't know if it's a typo but this:

$write_buffer .= "\r\n" . $jpeg . "\r\n\r\n";
$r->print($write_buffer);


is not the same as this:

$r->print($write_buffer);
$r->print($jpeg);
$r->print("\r\n\r\n");


since the latter does not insert "\r\n" between $write_buffer and $jpeg...


Larry

Reply via email to