Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 425196 | Differences between
and this patch

Collapse All | Expand All

(-)adzap-orig/scripts/squid_redirect (-12 / +18 lines)
Lines 31-37 Link Here
31
31
32
use POSIX ":sys_wait_h";
32
use POSIX ":sys_wait_h";
33
use Socket;
33
use Socket;
34
require 'flush.pl';
34
use IO::Handle;
35
35
36
$::IOSIZE=1024;
36
$::IOSIZE=1024;
37
37
Lines 232-238 Link Here
232
{
232
{
233
  if (defined $::LogFile)
233
  if (defined $::LogFile)
234
  { print LOGFILE $_;
234
  { print LOGFILE $_;
235
    flush(LOGFILE);
235
    LOGFILE->flush();;
236
  }
236
  }
237
  chomp;
237
  chomp;
238
  
238
  
Lines 259-265 Link Here
259
    }
259
    }
260
  }
260
  }
261
261
262
  flush(STDOUT);
262
  STDOUT->flush();
263
}
263
}
264
264
265
exit 0;
265
exit 0;
Lines 789-802 Link Here
789
      }
789
      }
790
790
791
      # dispatch request and headers
791
      # dispatch request and headers
792
      printflush(GCHILD_WRITE,"$method $uri $v1 $v2\n")
792
      print GCHILD_WRITE "$method $uri $v1 $v2\n"
793
	|| die "tell grandchild the request: $!";
793
	|| die "tell grandchild the request: $!";
794
      GCHILD_WRITE->flush();
794
795
795
      print PROXY "$method $uri HTTP/$v1.$v2\r\n";
796
      print PROXY "$method $uri HTTP/$v1.$v2\r\n";
796
      for my $H (@hdrs)
797
      for my $H (@hdrs)
797
      { print PROXY $H->[0], ":", $H->[1], "\r\n";
798
      { print PROXY $H->[0], ":", $H->[1], "\r\n";
798
      }
799
      }
799
      printflush(PROXY,"\r\n");
800
      print PROXY "\r\n";
801
      PROXY->flush();
800
      ##warn "[$$]: sent rq to proxy\n";
802
      ##warn "[$$]: sent rq to proxy\n";
801
803
802
      proxy_copybody(CONN,PROXY,$method,$persist,\@hdrs)
804
      proxy_copybody(CONN,PROXY,$method,$persist,\@hdrs)
Lines 965-972 Link Here
965
    }
967
    }
966
968
967
    warn "[$child:$$]: pass response to parent\n";
969
    warn "[$child:$$]: pass response to parent\n";
968
    printflush(TOCHILD,($persist ? PERSIST : CLOSE)." $code $info")
970
    print TOCHILD ($persist ? PERSIST : CLOSE)." $code $info"
969
	|| die "[$child:$$]: print(TOCHILD) fails: $!";
971
	|| die "[$child:$$]: print(TOCHILD) fails: $!";
972
    TOCHILD->flush();
970
    warn "[$child:$$]: told parent, passing response to client\n";
973
    warn "[$child:$$]: told parent, passing response to client\n";
971
974
972
    # copy to child
975
    # copy to child
Lines 974-980 Link Here
974
    for my $H (@hdrs)
977
    for my $H (@hdrs)
975
    { print CONN $H->[0], ":", $H->[1], "\r\n";
978
    { print CONN $H->[0], ":", $H->[1], "\r\n";
976
    }
979
    }
977
    printflush(CONN,"\r\n");
980
    print CONN "\r\n";
981
    CONN->flush();
978
982
979
    # see RFC2616 section 10
983
    # see RFC2616 section 10
980
    if (
984
    if (
Lines 1050-1060 Link Here
1050
	)
1054
	)
1051
  {
1055
  {
1052
    ##warn "[$$]: read ".length($_)." bytes of request body\n";
1056
    ##warn "[$$]: read ".length($_)." bytes of request body\n";
1053
    if (! printflush($to,$_))
1057
    $to->autoflush(1);
1054
    { warn "$::cmd: [$$]: printflush($to,..): $!";
1058
    if (! print $to $_)
1059
    { warn "$::cmd: [$$]: print $to ..): $!";
1055
      $ok=0;
1060
      $ok=0;
1056
      last COPY;
1061
      last COPY;
1057
    }
1062
    }
1063
    $to->autoflush(0);
1058
    $cl-=length if defined $cl;
1064
    $cl-=length if defined $cl;
1059
  }
1065
  }
1060
  warn "[$$]: finished unchunked body, ok=$ok";
1066
  warn "[$$]: finished unchunked body, ok=$ok";
Lines 1083-1092 Link Here
1083
    { print $to $_;
1089
    { print $to $_;
1084
      $chunksize-=length;
1090
      $chunksize-=length;
1085
    }
1091
    }
1086
    flush($to);
1092
    $to->flush();
1087
  }
1093
  }
1088
1094
1089
  flush($to);
1095
  $to->flush();
1090
1096
1091
  # pass trailer headers
1097
  # pass trailer headers
1092
  while (defined($_=<$from>) && !/^\r?\n/)
1098
  while (defined($_=<$from>) && !/^\r?\n/)
Lines 1096-1102 Link Here
1096
  { ##warn "[$$]: final trailer: $_";
1102
  { ##warn "[$$]: final trailer: $_";
1097
    print $to $_;
1103
    print $to $_;
1098
  }
1104
  }
1099
  flush($to);
1105
  $to->flush();
1100
1106
1101
  return (1,"");
1107
  return (1,"");
1102
}
1108
}

Return to bug 425196