stas        2004/07/02 16:18:30

  Modified:    src/docs/2.0/user/handlers protocols.pod
  Log:
  use the correct way to break the while(1) loop in protocols reading from
  the client
  
  Revision  Changes    Path
  1.25      +10 -22    modperl-docs/src/docs/2.0/user/handlers/protocols.pod
  
  Index: protocols.pod
  ===================================================================
  RCS file: /home/cvs/modperl-docs/src/docs/2.0/user/handlers/protocols.pod,v
  retrieving revision 1.24
  retrieving revision 1.25
  diff -u -u -r1.24 -r1.25
  --- protocols.pod     10 Jun 2004 15:02:21 -0000      1.24
  +++ protocols.pod     2 Jul 2004 23:18:30 -0000       1.25
  @@ -352,13 +352,8 @@
         while (1) {
             my $rc = $c->input_filters->get_brigade($bb_in,
                                                     Apache::MODE_GETLINE);
  -          if ($rc != APR::SUCCESS && $rc != APR::EOF) {
  -              my $error = APR::Error::strerror($rc);
  -              warn __PACKAGE__ . ": get_brigade: $error\n";
  -              last;
  -          }
  -  
  -          last if $bb_in->is_empty;
  +          last if $rc == APR::EOF;
  +          die APR::Error::strerror($rc) unless $rc == APR::SUCCESS;
     
             while (!$bb_in->is_empty) {
                 my $b = $bb_in->first;
  @@ -447,9 +442,10 @@
   
   If you look at the complete handler, the loop is terminated when one
   of the following conditions occurs: an error happens, the end of
  -stream bucket has been seen (no more input at the connection) or when
  -the received data contains nothing but new line characters which we
  -used to to tell the server to terminate the connection.
  +stream status code (C<APR::EOF>) has been received (no more input at
  +the connection) or when the received data contains nothing but new
  +line characters which we used to to tell the server to terminate the
  +connection.
   
   Notice that this handler could be much simpler, since we don't modify
   the data. We could simply pass the whole brigade unmodified without
  @@ -479,13 +475,8 @@
         while (1) {
             my $rc = $c->input_filters->get_brigade($bb,
                                                     Apache::MODE_GETLINE);
  -          if ($rc != APR::SUCCESS && $rc != APR::EOF) {
  -              my $error = APR::Error::strerror($rc);
  -              warn __PACKAGE__ . ": get_brigade: $error\n";
  -              last;
  -          }
  -  
  -          last if $bb->is_empty;
  +          last if $rc == APR::EOF;
  +          die APR::Error::strerror($rc) unless $rc == APR::SUCCESS;
     
             $c->output_filters->fflush($bb);
         }
  @@ -527,11 +518,8 @@
         while (1) {
             my $rc = $c->input_filters->get_brigade($bb,
                                                     Apache::MODE_GETLINE);
  -          if ($rc != APR::SUCCESS && $rc != APR::EOF) {
  -              my $error = APR::Error::strerror($rc);
  -              warn __PACKAGE__ . ": get_brigade: $error\n";
  -              last;
  -          }
  +          last if $rc == APR::EOF;
  +          die APR::Error::strerror($rc) unless $rc == APR::SUCCESS;
     
             next unless $bb->flatten(my $data);
             $bb->cleanup;
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to