Re: [squid-users] Squid & url rewriter

From: Chris Robertson <crobertson_at_gci.net>
Date: Tue, 03 Mar 2009 17:26:13 -0900

Amos Jeffries wrote:
> echo and print in PHP and perl IIRC operate slightly differently.
>
> I have found echo "blah\n"; flush(); both to be needed for PHP for
> timely results.
>
> The earlier mail was about perl print having an implicit \n already.
> echo in PHP does not.
>
> Amos

Whoops. The difference in the two scripts is the Perl one was rewriting
the string passed to it (which already had a newline at the end) and the
PHP script was outputting a completely new string. The PHP script
should probably look like:

#!/usr/bin/php
<?php

while ( fgets(STDIN) ) {
  
  echo "302:http://www.yahoo.fr/\n";
  flush;

}
?>

Chris
Received on Wed Mar 04 2009 - 02:26:18 MST

This archive was generated by hypermail 2.2.0 : Wed Mar 04 2009 - 12:00:02 MST