Changeset 331

Show
Ignore:
Timestamp:
08/16/06 16:51:38 (2 years ago)
Author:
zedshaw
Message:

Added mongrel_cluster as officially part of mongrel.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/Rakefile

    r326 r331  
    8888  sub_project("mongrel_upload_progress", :install) 
    8989  sub_project("mongrel_console", :install) 
     90  sub_project("mongrel_cluster", :install) 
    9091  if RUBY_PLATFORM =~ /mswin/ 
    9192    sub_project("mongrel_service", :install) 
  • trunk/ext/http11/http11_parser.c

    r318 r331  
    181181  } 
    182182        goto st5; 
     183tr40: 
     184#line 43 "ext/http11/http11_parser.rl" 
     185        {MARK(query_start, p); } 
     186#line 44 "ext/http11/http11_parser.rl" 
     187        {  
     188    if(parser->query_string != NULL) 
     189      parser->query_string(parser->data, PTR_TO(query_start), LEN(query_start, p)); 
     190  } 
     191#line 38 "ext/http11/http11_parser.rl" 
     192        {  
     193    if(parser->request_uri != NULL) 
     194      parser->request_uri(parser->data, PTR_TO(mark), LEN(mark, p)); 
     195  } 
     196        goto st5; 
    183197st5: 
    184198        if ( ++p == pe ) 
    185199                goto _out5; 
    186200case 5: 
    187 #line 188 "ext/http11/http11_parser.c" 
     201#line 202 "ext/http11/http11_parser.c" 
    188202        if ( (*p) == 72 ) 
    189203                goto tr3; 
     
    197211                goto _out6; 
    198212case 6: 
    199 #line 200 "ext/http11/http11_parser.c" 
     213#line 214 "ext/http11/http11_parser.c" 
    200214        if ( (*p) == 84 ) 
    201215                goto st7; 
     
    273287                goto _out14; 
    274288case 14: 
    275 #line 276 "ext/http11/http11_parser.c" 
     289#line 290 "ext/http11/http11_parser.c" 
    276290        if ( (*p) == 10 ) 
    277291                goto st15; 
     
    325339                goto _out53; 
    326340case 53: 
    327 #line 328 "ext/http11/http11_parser.c" 
     341#line 342 "ext/http11/http11_parser.c" 
    328342        goto st1; 
    329343tr21: 
     
    335349                goto _out17; 
    336350case 17: 
    337 #line 338 "ext/http11/http11_parser.c" 
     351#line 352 "ext/http11/http11_parser.c" 
    338352        switch( (*p) ) { 
    339353                case 33: goto st17; 
     
    374388                goto _out18; 
    375389case 18: 
    376 #line 377 "ext/http11/http11_parser.c" 
     390#line 391 "ext/http11/http11_parser.c" 
    377391        switch( (*p) ) { 
    378392                case 13: goto tr36; 
     
    388402                goto _out19; 
    389403case 19: 
    390 #line 391 "ext/http11/http11_parser.c" 
     404#line 405 "ext/http11/http11_parser.c" 
    391405        if ( (*p) == 13 ) 
    392406                goto tr36; 
     
    400414                goto _out20; 
    401415case 20: 
    402 #line 403 "ext/http11/http11_parser.c" 
     416#line 417 "ext/http11/http11_parser.c" 
    403417        switch( (*p) ) { 
    404418                case 43: goto st20; 
     
    425439                goto _out21; 
    426440case 21: 
    427 #line 428 "ext/http11/http11_parser.c" 
     441#line 442 "ext/http11/http11_parser.c" 
    428442        switch( (*p) ) { 
    429443                case 32: goto tr19; 
     
    473487                goto _out24; 
    474488case 24: 
    475 #line 476 "ext/http11/http11_parser.c" 
     489#line 490 "ext/http11/http11_parser.c" 
    476490        switch( (*p) ) { 
    477491                case 32: goto tr31; 
     
    526540                goto _out27; 
    527541case 27: 
    528 #line 529 "ext/http11/http11_parser.c" 
     542#line 543 "ext/http11/http11_parser.c" 
    529543        switch( (*p) ) { 
    530544                case 32: goto tr19; 
     
    578592                goto _out30; 
    579593case 30: 
    580 #line 581 "ext/http11/http11_parser.c" 
    581         switch( (*p) ) { 
    582                 case 32: goto tr28
    583                 case 37: goto tr40
     594#line 595 "ext/http11/http11_parser.c" 
     595        switch( (*p) ) { 
     596                case 32: goto tr40
     597                case 37: goto tr41
    584598                case 60: goto st1; 
    585599                case 62: goto st1; 
     
    600614                goto _out31; 
    601615case 31: 
    602 #line 603 "ext/http11/http11_parser.c" 
     616#line 617 "ext/http11/http11_parser.c" 
    603617        switch( (*p) ) { 
    604618                case 32: goto tr28; 
     
    614628                goto st1; 
    615629        goto st31; 
    616 tr40
     630tr41
    617631#line 43 "ext/http11/http11_parser.rl" 
    618632        {MARK(query_start, p); } 
     
    622636                goto _out32; 
    623637case 32: 
    624 #line 625 "ext/http11/http11_parser.c" 
     638#line 639 "ext/http11/http11_parser.c" 
    625639        if ( (*p) < 65 ) { 
    626640                if ( 48 <= (*p) && (*p) <= 57 ) 
     
    10481062    /* final \r\n combo encountered so stop right here */ 
    10491063     
    1050 #line 1051 "ext/http11/http11_parser.c" 
     1064#line 1065 "ext/http11/http11_parser.c" 
    10511065#line 163 "ext/http11/http11_parser.rl" 
    10521066    parser->nread++; 
     
    10611075 
    10621076   
    1063 #line 1064 "ext/http11/http11_parser.c" 
     1077#line 1078 "ext/http11/http11_parser.c" 
    10641078#line 174 "ext/http11/http11_parser.rl" 
    10651079 
  • trunk/ext/http11/http11_parser.rl

    r312 r331  
    9090 
    9191  path = (pchar+ ( "/" pchar* )*) ; 
    92   query = ( uchar | reserved )* >start_query %query_string ; 
     92  query = ( uchar | reserved )* %query_string ; 
    9393  param = ( pchar | "/" )* ; 
    9494  params = (param ( ";" param )*) ; 
    95   rel_path = (path? %request_path (";" params)?) ("?" query)?; 
     95  rel_path = (path? %request_path (";" params)?) ("?" %start_query query)?; 
    9696  absolute_path = ("/"+ rel_path); 
    9797 
  • trunk/lib/mongrel.rb

    r329 r331  
    44# Additional work donated by contributors.  See http://mongrel.rubyforge.org/attributions.html  
    55# for more information. 
     6 
     7$mongrel_debug_client = false 
    68 
    79require 'socket' 
     
    586588      rescue HttpParserError 
    587589        STDERR.puts "#{Time.now}: BAD CLIENT (#{params[Const::HTTP_X_FORWARDED_FOR] || client.peeraddr.last}): #$!" 
     590        if $mongrel_debug_client 
     591          STDERR.puts "#{Time.now}: REQUEST DATA: #{data.inspect}\n---\nPARAMS: #{params.inspect}\n---\n" 
     592        end 
    588593      rescue Errno::EMFILE 
    589594        reap_dead_workers('too many files') 
    590595      rescue Object 
    591596        STDERR.puts "#{Time.now}: ERROR: #$!" 
    592         STDERR.puts $!.backtrace.join("\n") 
     597        STDERR.puts $!.backtrace.join("\n") if $mongrel_debug_client 
    593598      ensure 
    594599        client.close rescue Object 
  • trunk/lib/mongrel/configurator.rb

    r320 r331  
    357357        # graceful shutdown 
    358358        trap("TERM") { log "TERM signal received."; stop } 
    359  
     359        trap("USR1") { log "USR1 received, toggling $mongrel_debug_client to #{!$mongrel_debug_client}"; $mongrel_debug_client = !$mongrel_debug_client } 
    360360        # restart 
    361361        trap("USR2") { log "USR2 signal received."; stop(true) } 
  • trunk/test/test_http11.rb

    r318 r331  
    6161     
    6262    if readable 
    63       res << Digest::SHA1.hexdigest(rand(count * 1000).to_s) * (count / 40) 
     63      res << Digest::SHA1.hexdigest(rand(count * 100).to_s) * (count / 40) 
    6464    else 
    65       res << Digest::SHA1.digest(rand(count * 1000).to_s) * (count / 20) 
     65      res << Digest::SHA1.digest(rand(count * 100).to_s) * (count / 20) 
    6666    end 
    6767 
     
    7373    parser = HttpParser.new 
    7474 
    75     # first verify that large random get requests fail 
    76     100.times do |c|  
    77       get = "GET /#{rand_data(1024, 1024+(c*1024))} HTTP/1.1\r\n" 
    78       assert_raises Mongrel::HttpParserError do 
    79         parser.execute({}, get, 0) 
    80         parser.reset 
    81       end 
    82     end 
    83  
    8475    # then that large header names are caught 
    85     100.times do |c| 
     76    10.times do |c| 
    8677      get = "GET /#{rand_data(10,120)} HTTP/1.1\r\nX-#{rand_data(1024, 1024+(c*1024))}: Test\r\n\r\n" 
    8778      assert_raises Mongrel::HttpParserError do 
     
    9283 
    9384    # then that large mangled field values are caught 
    94     100.times do |c| 
     85    10.times do |c| 
    9586      get = "GET /#{rand_data(10,120)} HTTP/1.1\r\nX-Test: #{rand_data(1024, 1024+(c*1024), false)}\r\n\r\n" 
    9687      assert_raises Mongrel::HttpParserError do