Branch: Tag:

2003-10-28

2003-10-28 21:24:44 by Martin Stjernholm <mast@lysator.liu.se>

Remove the accept callback for ssl connection so that the fd leaves callback
mode before handing it over to the handler thread.

Fixed a couple of those hideous catches to at least write backtraces in the
debug log when running in debug mode.

Rev: server/protocols/http.pike:1.406

2:   // Modified by Francesco Chemolli to add throttling capabilities.   // Copyright © 1996 - 2001, Roxen IS.    - constant cvs_version = "$Id: http.pike,v 1.405 2003/09/17 10:53:19 grubba Exp $"; + constant cvs_version = "$Id: http.pike,v 1.406 2003/10/28 21:24:44 mast Exp $";   // #define REQUEST_DEBUG   #define MAGIC_ERROR   
562:    if( !method )    {    array res; -  if( catch( res = hpf( new_data ) ) ) +  if( mixed err = catch( res = hpf( new_data ) ) ) { + #ifdef DEBUG +  report_debug ("Got bad request, HeaderParser error: " + describe_error (err)); + #endif    return 1; -  +  }    if( !res )    {    TIMER_END(parse_got);
842: Inside #if constant(Parser.XML.Tree.XMLNSParser)
     #if constant(Parser.XML.Tree.XMLNSParser)    if (xml_data) { -  catch { +  mixed err = catch {    // Disconnect the XML graph to make it easier on the gc.    xml_data->walk_postorder(lambda(Parser.XML.Tree.AbstractNode node) {    node->mParent = 0;    });    xml_data = 0;    }; -  + #ifdef DEBUG +  if (err) +  report_debug ("Failed to disconnect XML tree: " + describe_backtrace (err)); + #endif    }   #endif /* Parser.XML.Tree.XMLNSParser */   
884:    if(objectp(my_fd))    {    MARK_FD("HTTP closed"); -  catch +  mixed err = catch    {    // Don't set to blocking mode if SSL.    if (!my_fd->CipherSpec) {
893:    my_fd->close();    destruct(my_fd);    }; -  catch { + #ifdef DEBUG +  if (err) report_debug ("Close failure (1): %s", describe_backtrace (err)); + #endif +  err = catch {    my_fd = 0;    }; -  + #ifdef DEBUG +  if (err) report_debug ("Close failure (2): %s", describe_backtrace (err)); + #endif    }    disconnect();   }
1200:    MERGE_TIMERS(conf);    if( conf )    conf->connection_drop( this_object() ); -  catch // paranoia +  mixed err = catch // paranoia    {    my_fd->close();    destruct( my_fd );    destruct( );    }; -  + #ifdef DEBUG +  if (err) report_debug ("Close failure (3): %s", describe_backtrace (err)); + #endif    return;    }    TIMER_END(do_log);
1581:       if( stringp(file->data) )    { -  if ((file["type"][0..4] == "text/") || +  if (sizeof (output_charset) || +  has_prefix (file->type, "text/") ||    (String.width(file->data) > 8))    {    int allow_entities =
1679:    heads->Connection = "close";    misc->connection = "close";    } -  if( catch( head_string += Roxen.make_http_headers( heads ) ) ) +  if( mixed err = catch( head_string += Roxen.make_http_headers( heads ) ) )    { -  + #ifdef DEBUG +  report_debug ("Roxen.make_http_headers failed: " + describe_error (err)); + #endif    foreach( indices( heads ), string x )    if( stringp( heads[x] ) )    head_string += x+": "+heads[x]+"\r\n";
1937:    {    if( conf )    conf->connection_drop( this_object() ); -  catch // paranoia +  mixed err = catch // paranoia    {    my_fd->set_blocking();    my_fd->close();    destruct( my_fd );    destruct( );    }; -  + #ifdef DEBUG +  if (err) report_debug ("Close failure (4): %s", describe_backtrace (err)); + #endif    return;    }   
2048:    conf->requests++;    my_fd->set_close_callback(0);    my_fd->set_read_callback(0); +  if (my_fd->set_accept_callback) my_fd->set_accept_callback (0);    processed=1;       remove_call_out(do_timeout);