<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>mongrel.gemspec</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -1,4 +1,10 @@
 
+v1.1.5. Fix bug where num_processors is not actually set from mongrel_rails.
+
+v1.1.4. Fix camping handler. Correct treatment of @throttle parameter.
+
+v1.1.3. Fix security flaw of DirHandler; reported on mailing list.
+
 v1.1.2. Fix worker termination bug; fix JRuby 1.0.3 load order issue; fix require issue on systems without Rubygems.
 
 v1.1.1. Fix mongrel_rails restart bug; fix bug with Rack status codes.</diff>
      <filename>CHANGELOG</filename>
    </modified>
    <modified>
      <diff>@@ -37,7 +37,6 @@ lib/mongrel/header_out.rb
 lib/mongrel/http_request.rb
 lib/mongrel/http_response.rb
 lib/mongrel/init.rb
-lib/mongrel/logger.rb
 lib/mongrel/mime_types.yml
 lib/mongrel/rails.rb
 lib/mongrel/stats.rb</diff>
      <filename>Manifest</filename>
    </modified>
    <modified>
      <diff>@@ -1,4 +1,5 @@
 
-* Rewrite and merge mongrel cluster and mongrel_rails into something small and maintainable.
-* Initial 1.9 compatibility.
-* 1.9 performance (requires removing the thread queue).
+v1.2. Rewrite and merge mongrel cluster and mongrel_rails into something small and maintainable. Remove gem_plugin entirely.
+
+v1.1.1. See if Java is setting the server version string in the request properly.
+</diff>
      <filename>TODO</filename>
    </modified>
    <modified>
      <diff>@@ -28,7 +28,7 @@ module Mongrel
         ['-a', '--address ADDR', &quot;Address to bind to&quot;, :@address, &quot;0.0.0.0&quot;],
         ['-l', '--log FILE', &quot;Where to write log messages&quot;, :@log_file, &quot;log/mongrel.log&quot;],
         ['-P', '--pid FILE', &quot;Where to write the PID&quot;, :@pid_file, &quot;log/mongrel.pid&quot;],
-        ['-n', '--num-procs INT', &quot;Number of processors active before clients denied&quot;, :@num_processors, 1024],
+        ['-n', '--num-processors INT', &quot;Number of processors active before clients denied&quot;, :@num_processors, 1024],
         ['-o', '--timeout TIME', &quot;Time to wait (in seconds) before killing a stalled thread&quot;, :@timeout, 60],
         ['-t', '--throttle TIME', &quot;Time to pause (in hundredths of a second) between accepting clients&quot;, :@throttle, 0],
         ['-m', '--mime PATH', &quot;A YAML file that lists additional MIME types&quot;, :@mime_map, nil],
@@ -74,51 +74,50 @@ module Mongrel
 
     def run
       if @generate
-        @generate = File.expand_path(@generate)
-        Mongrel.log(:error, &quot;** Writing config to \&quot;#@generate\&quot;.&quot;)
+	@generate = File.expand_path(@generate)
+        STDERR.puts &quot;** Writing config to \&quot;#@generate\&quot;.&quot;
         open(@generate, &quot;w&quot;) {|f| f.write(settings.to_yaml) }
-        Mongrel.log(:error, &quot;** Finished.  Run \&quot;mongrel_rails start -C #@generate\&quot; to use the config file.&quot;)
+        STDERR.puts &quot;** Finished.  Run \&quot;mongrel_rails start -C #@generate\&quot; to use the config file.&quot;
         exit 0
       end
 
       config = Mongrel::Rails::RailsConfigurator.new(settings) do
         if defaults[:daemon]
           if File.exist? defaults[:pid_file]
-            Mongrel.log(:error, &quot;!!! PID file #{defaults[:pid_file]} already exists.  Mongrel could be running already.  Check your #{defaults[:log_file]} for errors.&quot;)
-            Mongrel.log(:error, &quot;!!! Exiting with error.  You must stop mongrel and clear the .pid before I'll attempt a start.&quot;)
+            log &quot;!!! PID file #{defaults[:pid_file]} already exists.  Mongrel could be running already.  Check your #{defaults[:log_file]} for errors.&quot;
+            log &quot;!!! Exiting with error.  You must stop mongrel and clear the .pid before I'll attempt a start.&quot;
             exit 1
           end
 
           daemonize
-          write_pid_file
-          Mongrel.log(&quot;Daemonized, any open files are closed.  Look at #{defaults[:pid_file]} and #{defaults[:log_file]} for info.&quot;)
-          Mongrel.log(&quot;Settings loaded from #{@config_file} (they override command line).&quot;) if @config_file
+          log &quot;Daemonized, any open files are closed.  Look at #{defaults[:pid_file]} and #{defaults[:log_file]} for info.&quot;
+          log &quot;Settings loaded from #{@config_file} (they override command line).&quot; if @config_file
         end
 
-        Mongrel.log(&quot;Starting Mongrel listening at #{defaults[:host]}:#{defaults[:port]}, further information can be found in log/mongrel-#{defaults[:host]}-#{defaults[:port]}.log&quot;)
+        log &quot;Starting Mongrel listening at #{defaults[:host]}:#{defaults[:port]}&quot;
 
         listener do
           mime = {}
           if defaults[:mime_map]
-            Mongrel.log(&quot;Loading additional MIME types from #{defaults[:mime_map]}&quot;)
+            log &quot;Loading additional MIME types from #{defaults[:mime_map]}&quot;
             mime = load_mime_map(defaults[:mime_map], mime)
           end
 
           if defaults[:debug]
-            Mongrel.log(&quot;Installing debugging prefixed filters. Look in log/mongrel_debug for the files.&quot;)
+            log &quot;Installing debugging prefixed filters. Look in log/mongrel_debug for the files.&quot;
             debug &quot;/&quot;
           end
 
-          Mongrel.log(&quot;Starting Rails with #{defaults[:environment]} environment...&quot;)
-          Mongrel.log(&quot;Mounting Rails at #{defaults[:prefix]}...&quot;) if defaults[:prefix]
+          log &quot;Starting Rails with #{defaults[:environment]} environment...&quot;
+          log &quot;Mounting Rails at #{defaults[:prefix]}...&quot; if defaults[:prefix]
           uri defaults[:prefix] || &quot;/&quot;, :handler =&gt; rails(:mime =&gt; mime, :prefix =&gt; defaults[:prefix])
-          Mongrel.log(&quot;Rails loaded.&quot;)
+          log &quot;Rails loaded.&quot;
 
-          Mongrel.log(&quot;Loading any Rails specific GemPlugins&quot; )
+          log &quot;Loading any Rails specific GemPlugins&quot;
           load_plugins
 
           if defaults[:config_script]
-            Mongrel.log(&quot;Loading #{defaults[:config_script]} external config script&quot;)
+            log &quot;Loading #{defaults[:config_script]} external config script&quot;
             run_config(defaults[:config_script])
           end
 
@@ -127,29 +126,31 @@ module Mongrel
       end
 
       config.run
-      Mongrel.log(&quot;Mongrel #{Mongrel::Const::MONGREL_VERSION} available at #{@address}:#{@port}&quot;)
+      config.log &quot;Mongrel #{Mongrel::Const::MONGREL_VERSION} available at #{@address}:#{@port}&quot;
 
-      unless config.defaults[:daemon]
-        Mongrel.log(&quot;Use CTRL-C to stop.&quot;)
+      if config.defaults[:daemon]
+        config.write_pid_file
+      else
+        config.log &quot;Use CTRL-C to stop.&quot; 
       end
 
       config.join
 
       if config.needs_restart
-        unless RUBY_PLATFORM =~ /djgpp|(cyg|ms|bcc)win|mingw/
+        if RUBY_PLATFORM !~ /mswin/
           cmd = &quot;ruby #{__FILE__} start #{original_args.join(' ')}&quot;
-          Mongrel.log(&quot;Restarting with arguments:  #{cmd}&quot;)
+          config.log &quot;Restarting with arguments:  #{cmd}&quot;
           config.stop(false, true)
           config.remove_pid_file
 
           if config.defaults[:daemon]
             system cmd
           else
-            Mongrel.log(:error, &quot;Can't restart unless in daemon mode.&quot;)
+            STDERR.puts &quot;Can't restart unless in daemon mode.&quot;
             exit 1
           end
         else
-          Mongrel.log(&quot;Win32 does not support restarts. Exiting.&quot;)
+          config.log &quot;Win32 does not support restarts. Exiting.&quot;
         end
       end
     end
@@ -159,7 +160,7 @@ module Mongrel
       begin
         settings = YAML.load_file(@config_file)
       ensure
-        Mongrel.log(:error, &quot;** Loading settings from #{@config_file} (they override command line).&quot;) unless @daemon || settings[:daemon]
+        STDERR.puts &quot;** Loading settings from #{@config_file} (they override command line).&quot; unless @daemon || settings[:daemon] 
       end
 
       settings[:includes] ||= [&quot;mongrel&quot;]
@@ -169,7 +170,6 @@ module Mongrel
         key = key.to_s
         if config_keys.include?(key)
           key = 'address' if key == 'host'
-          key = 'num_processors' if key == 'num_procs'
           self.instance_variable_set(&quot;@#{key}&quot;, value)
         else
           failure &quot;Unknown configuration setting: #{key}&quot;  
@@ -180,14 +180,13 @@ module Mongrel
 
     def config_keys
       @config_keys ||=
-        %w(address host port cwd log_file pid_file environment docroot mime_map daemon debug includes config_script num_processors num_procs timeout throttle user group prefix)
+        %w(address host port cwd log_file pid_file environment docroot mime_map daemon debug includes config_script num_processors timeout throttle user group prefix)
     end
 
     def settings
       config_keys.inject({}) do |hash, key|
         value = self.instance_variable_get(&quot;@#{key}&quot;)
         key = 'host' if key == 'address'
-        key = 'num_processors' if key == 'num_procs'
         hash[key.to_sym] ||= value
         hash
       end</diff>
      <filename>bin/mongrel_rails</filename>
    </modified>
    <modified>
      <diff>@@ -4,9 +4,9 @@ class TestPlugin &lt; GemPlugin::Plugin &quot;/handlers&quot;
   include Mongrel::HttpHandlerPlugin
 
   def process(request, response)
-    Mongrel.log(:error, &quot;My options are: #{options.inspect}&quot;)
-    Mongrel.log(:error, &quot;Request Was:&quot;)
-    Mongrel.log(:error, request.params.to_yaml)
+    STDERR.puts &quot;My options are: #{options.inspect}&quot;
+    STDERR.puts &quot;Request Was:&quot;
+    STDERR.puts request.params.to_yaml
   end
 end
 </diff>
      <filename>examples/builder.rb</filename>
    </modified>
    <modified>
      <diff>@@ -4,7 +4,6 @@
 #define RAISE_NOT_NULL(T) if(T == NULL) rb_raise(rb_eArgError, &quot;NULL found for &quot; # T &quot; when shouldn't be.&quot;);
 #define DATA_GET(from,type,name) Data_Get_Struct(from,type,name); RAISE_NOT_NULL(name);
 #define REQUIRE_TYPE(V, T) if(TYPE(V) != T) rb_raise(rb_eTypeError, &quot;Wrong argument type for &quot; # V &quot; required &quot; # T);
-#define ARRAY_SIZE(x) (sizeof(x)/sizeof(x[0]))
 
 #ifdef DEBUG
 #define TRACE()  fprintf(stderr, &quot;&gt; %s:%d:%s\n&quot;, __FILE__, __LINE__, __FUNCTION__)</diff>
      <filename>ext/http11/ext_help.h</filename>
    </modified>
    <modified>
      <diff>@@ -7,13 +7,7 @@
 #include &lt;assert.h&gt;
 #include &lt;string.h&gt;
 #include &quot;http11_parser.h&quot;
-
-#ifndef RSTRING_PTR
-#define RSTRING_PTR(s) (RSTRING(s)-&gt;ptr)
-#endif
-#ifndef RSTRING_LEN
-#define RSTRING_LEN(s) (RSTRING(s)-&gt;len)
-#endif
+#include &lt;ctype.h&gt;
 
 static VALUE mMongrel;
 static VALUE cHttpParser;
@@ -21,9 +15,8 @@ static VALUE eHttpParserError;
 
 #define id_handler_map rb_intern(&quot;@handler_map&quot;)
 #define id_http_body rb_intern(&quot;@http_body&quot;)
-#define HTTP_PREFIX &quot;HTTP_&quot;
-#define HTTP_PREFIX_LEN (sizeof(HTTP_PREFIX) - 1)
 
+static VALUE global_http_prefix;
 static VALUE global_request_method;
 static VALUE global_request_uri;
 static VALUE global_fragment;
@@ -66,119 +59,10 @@ DEF_MAX_LENGTH(REQUEST_PATH, 1024);
 DEF_MAX_LENGTH(QUERY_STRING, (1024 * 10));
 DEF_MAX_LENGTH(HEADER, (1024 * (80 + 32)));
 
-struct common_field {
-	const signed long len;
-	const char *name;
-	VALUE value;
-};
-
-/*
- * A list of common HTTP headers we expect to receive.
- * This allows us to avoid repeatedly creating identical string
- * objects to be used with rb_hash_aset().
- */
-static struct common_field common_http_fields[] = {
-# define f(N) { (sizeof(N) - 1), N, Qnil }
-	f(&quot;ACCEPT&quot;),
-	f(&quot;ACCEPT_CHARSET&quot;),
-	f(&quot;ACCEPT_ENCODING&quot;),
-	f(&quot;ACCEPT_LANGUAGE&quot;),
-	f(&quot;ALLOW&quot;),
-	f(&quot;AUTHORIZATION&quot;),
-	f(&quot;CACHE_CONTROL&quot;),
-	f(&quot;CONNECTION&quot;),
-	f(&quot;CONTENT_ENCODING&quot;),
-	f(&quot;CONTENT_LENGTH&quot;),
-	f(&quot;CONTENT_TYPE&quot;),
-	f(&quot;COOKIE&quot;),
-	f(&quot;DATE&quot;),
-	f(&quot;EXPECT&quot;),
-	f(&quot;FROM&quot;),
-	f(&quot;HOST&quot;),
-	f(&quot;IF_MATCH&quot;),
-	f(&quot;IF_MODIFIED_SINCE&quot;),
-	f(&quot;IF_NONE_MATCH&quot;),
-	f(&quot;IF_RANGE&quot;),
-	f(&quot;IF_UNMODIFIED_SINCE&quot;),
-	f(&quot;KEEP_ALIVE&quot;), /* Firefox sends this */
-	f(&quot;MAX_FORWARDS&quot;),
-	f(&quot;PRAGMA&quot;),
-	f(&quot;PROXY_AUTHORIZATION&quot;),
-	f(&quot;RANGE&quot;),
-	f(&quot;REFERER&quot;),
-	f(&quot;TE&quot;),
-	f(&quot;TRAILER&quot;),
-	f(&quot;TRANSFER_ENCODING&quot;),
-	f(&quot;UPGRADE&quot;),
-	f(&quot;USER_AGENT&quot;),
-	f(&quot;VIA&quot;),
-	f(&quot;X_FORWARDED_FOR&quot;), /* common for proxies */
-	f(&quot;X_REAL_IP&quot;), /* common for proxies */
-	f(&quot;WARNING&quot;)
-# undef f
-};
-
-/*
- * qsort(3) and bsearch(3) improve average performance slightly, but may
- * not be worth it for lack of portability to certain platforms...
- */
-#if defined(HAVE_QSORT_BSEARCH)
-/* sort by length, then by name if there's a tie */
-static int common_field_cmp(const void *a, const void *b)
-{
-  struct common_field *cfa = (struct common_field *)a;
-  struct common_field *cfb = (struct common_field *)b;
-  signed long diff = cfa-&gt;len - cfb-&gt;len;
-  return diff ? diff : memcmp(cfa-&gt;name, cfb-&gt;name, cfa-&gt;len);
-}
-#endif /* HAVE_QSORT_BSEARCH */
-
-static void init_common_fields(void)
-{
-  int i;
-  struct common_field *cf = common_http_fields;
-  char tmp[256]; /* MAX_FIELD_NAME_LENGTH */
-  memcpy(tmp, HTTP_PREFIX, HTTP_PREFIX_LEN);
-
-  for(i = 0; i &lt; ARRAY_SIZE(common_http_fields); cf++, i++) {
-    memcpy(tmp + HTTP_PREFIX_LEN, cf-&gt;name, cf-&gt;len + 1);
-    cf-&gt;value = rb_obj_freeze(rb_str_new(tmp, HTTP_PREFIX_LEN + cf-&gt;len));
-    rb_global_variable(&amp;cf-&gt;value);
-  }
-
-#if defined(HAVE_QSORT_BSEARCH)
-  qsort(common_http_fields,
-        ARRAY_SIZE(common_http_fields),
-        sizeof(struct common_field),
-        common_field_cmp);
-#endif /* HAVE_QSORT_BSEARCH */
-}
-
-static VALUE find_common_field_value(const char *field, size_t flen)
-{
-#if defined(HAVE_QSORT_BSEARCH)
-  struct common_field key;
-  struct common_field *found;
-  key.name = field;
-  key.len = (signed long)flen;
-  found = (struct common_field *)bsearch(&amp;key, common_http_fields,
-                                         ARRAY_SIZE(common_http_fields),
-                                         sizeof(struct common_field),
-                                         common_field_cmp);
-  return found ? found-&gt;value : Qnil;
-#else /* !HAVE_QSORT_BSEARCH */
-  int i;
-  struct common_field *cf = common_http_fields;
-  for(i = 0; i &lt; ARRAY_SIZE(common_http_fields); i++, cf++) {
-    if (cf-&gt;len == flen &amp;&amp; !memcmp(cf-&gt;name, field, flen))
-      return cf-&gt;value;
-  }
-  return Qnil;
-#endif /* !HAVE_QSORT_BSEARCH */
-}
 
 void http_field(void *data, const char *field, size_t flen, const char *value, size_t vlen)
 {
+  char *ch, *end;
   VALUE req = (VALUE)data;
   VALUE v = Qnil;
   VALUE f = Qnil;
@@ -187,25 +71,15 @@ void http_field(void *data, const char *field, size_t flen, const char *value, s
   VALIDATE_MAX_LENGTH(vlen, FIELD_VALUE);
 
   v = rb_str_new(value, vlen);
+  f = rb_str_dup(global_http_prefix);
+  f = rb_str_buf_cat(f, field, flen); 
 
-  f = find_common_field_value(field, flen);
-
-  if (f == Qnil) {
-    /*
-     * We got a strange header that we don't have a memoized value for.
-     * Fallback to creating a new string to use as a hash key.
-     *
-     * using rb_str_new(NULL, len) here is faster than rb_str_buf_new(len)
-     * in my testing, because: there's no minimum allocation length (and
-     * no check for it, either), RSTRING_LEN(f) does not need to be
-     * written twice, and and RSTRING_PTR(f) will already be
-     * null-terminated for us.
-     */
-    f = rb_str_new(NULL, HTTP_PREFIX_LEN + flen);
-    memcpy(RSTRING_PTR(f), HTTP_PREFIX, HTTP_PREFIX_LEN);
-    memcpy(RSTRING_PTR(f) + HTTP_PREFIX_LEN, field, flen);
-    assert(*(RSTRING_PTR(f) + RSTRING_LEN(f)) == '\0'); /* paranoia */
-    /* fprintf(stderr, &quot;UNKNOWN HEADER &lt;%s&gt;\n&quot;, RSTRING_PTR(f)); */
+  for(ch = RSTRING(f)-&gt;ptr, end = ch + RSTRING(f)-&gt;len; ch &lt; end; ch++) {
+    if(*ch == '-') {
+      *ch = '_';
+    } else {
+      *ch = toupper(*ch);
+    }
   }
 
   rb_hash_aset(req, f, v);
@@ -294,12 +168,13 @@ void header_done(void *data, const char *at, size_t length)
 
   rb_hash_aset(req, global_gateway_interface, global_gateway_interface_value);
   if((temp = rb_hash_aref(req, global_http_host)) != Qnil) {
-    colon = memchr(RSTRING_PTR(temp), ':', RSTRING_LEN(temp));
+    /* ruby better close strings off with a '\0' dammit */
+    colon = strchr(RSTRING(temp)-&gt;ptr, ':');
     if(colon != NULL) {
-      rb_hash_aset(req, global_server_name, rb_str_substr(temp, 0, colon - RSTRING_PTR(temp)));
+      rb_hash_aset(req, global_server_name, rb_str_substr(temp, 0, colon - RSTRING(temp)-&gt;ptr));
       rb_hash_aset(req, global_server_port, 
-          rb_str_substr(temp, colon - RSTRING_PTR(temp)+1, 
-            RSTRING_LEN(temp)));
+          rb_str_substr(temp, colon - RSTRING(temp)-&gt;ptr+1, 
+            RSTRING(temp)-&gt;len));
     } else {
       rb_hash_aset(req, global_server_name, temp);
       rb_hash_aset(req, global_server_port, global_port_80);
@@ -420,8 +295,8 @@ VALUE HttpParser_execute(VALUE self, VALUE req_hash, VALUE data, VALUE start)
   DATA_GET(self, http_parser, http);
 
   from = FIX2INT(start);
-  dptr = RSTRING_PTR(data);
-  dlen = RSTRING_LEN(data);
+  dptr = RSTRING(data)-&gt;ptr;
+  dlen = RSTRING(data)-&gt;len;
 
   if(from &gt;= dlen) {
     rb_raise(eHttpParserError, &quot;Requested start is after data buffer end.&quot;);
@@ -491,6 +366,7 @@ void Init_http11()
 
   mMongrel = rb_define_module(&quot;Mongrel&quot;);
 
+  DEF_GLOBAL(http_prefix, &quot;HTTP_&quot;);
   DEF_GLOBAL(request_method, &quot;REQUEST_METHOD&quot;);
   DEF_GLOBAL(request_uri, &quot;REQUEST_URI&quot;);
   DEF_GLOBAL(fragment, &quot;FRAGMENT&quot;);
@@ -508,7 +384,7 @@ void Init_http11()
   DEF_GLOBAL(server_protocol, &quot;SERVER_PROTOCOL&quot;);
   DEF_GLOBAL(server_protocol_value, &quot;HTTP/1.1&quot;);
   DEF_GLOBAL(http_host, &quot;HTTP_HOST&quot;);
-  DEF_GLOBAL(mongrel_version, &quot;Mongrel 1.2&quot;); /* XXX Why is this defined here? */
+  DEF_GLOBAL(mongrel_version, &quot;Mongrel 1.1.5&quot;); /* XXX Why is this defined here? */
   DEF_GLOBAL(server_software, &quot;SERVER_SOFTWARE&quot;);
   DEF_GLOBAL(port_80, &quot;80&quot;);
 
@@ -523,5 +399,4 @@ void Init_http11()
   rb_define_method(cHttpParser, &quot;error?&quot;, HttpParser_has_error,0);
   rb_define_method(cHttpParser, &quot;finished?&quot;, HttpParser_is_finished,0);
   rb_define_method(cHttpParser, &quot;nread&quot;, HttpParser_nread,0);
-  init_common_fields();
 }</diff>
      <filename>ext/http11/http11.c</filename>
    </modified>
    <modified>
      <diff>@@ -10,46 +10,34 @@
 #include &lt;ctype.h&gt;
 #include &lt;string.h&gt;
 
-/*
- * capitalizes all lower-case ASCII characters,
- * converts dashes to underscores.
- */
-static void snake_upcase_char(char *c)
-{
-    if (*c &gt;= 'a' &amp;&amp; *c &lt;= 'z')
-      *c &amp;= ~0x20;
-    else if (*c == '-')
-      *c = '_';
-}
-
 #define LEN(AT, FPC) (FPC - buffer - parser-&gt;AT)
 #define MARK(M,FPC) (parser-&gt;M = (FPC) - buffer)
 #define PTR_TO(F) (buffer + parser-&gt;F)
 
 /** Machine **/
 
-#line 87 &quot;http11_parser.rl&quot;
+#line 74 &quot;http11_parser.rl&quot;
 
 
 /** Data **/
 
-#line 37 &quot;http11_parser.c&quot;
+#line 25 &quot;http11_parser.c&quot;
 static const int http_parser_start = 1;
 static const int http_parser_first_final = 57;
 static const int http_parser_error = 0;
 
 static const int http_parser_en_main = 1;
 
-#line 91 &quot;http11_parser.rl&quot;
+#line 78 &quot;http11_parser.rl&quot;
 
 int http_parser_init(http_parser *parser)  {
   int cs = 0;
   
-#line 49 &quot;http11_parser.c&quot;
+#line 37 &quot;http11_parser.c&quot;
 	{
 	cs = http_parser_start;
 	}
-#line 95 &quot;http11_parser.rl&quot;
+#line 82 &quot;http11_parser.rl&quot;
   parser-&gt;cs = cs;
   parser-&gt;body_start = 0;
   parser-&gt;content_len = 0;
@@ -77,7 +65,7 @@ size_t http_parser_execute(http_parser *parser, const char *buffer, size_t len,
 
 
   
-#line 81 &quot;http11_parser.c&quot;
+#line 69 &quot;http11_parser.c&quot;
 	{
 	if ( p == pe )
 		goto _out;
@@ -100,14 +88,14 @@ case 1:
 st0:
 	goto _out0;
 tr0:
-#line 34 &quot;http11_parser.rl&quot;
+#line 22 &quot;http11_parser.rl&quot;
 	{MARK(mark, p); }
 	goto st2;
 st2:
 	if ( ++p == pe )
 		goto _out2;
 case 2:
-#line 111 &quot;http11_parser.c&quot;
+#line 99 &quot;http11_parser.c&quot;
 	switch( (*p) ) {
 		case 32: goto tr2;
 		case 36: goto st38;
@@ -123,7 +111,7 @@ case 2:
 		goto st38;
 	goto st0;
 tr2:
-#line 49 &quot;http11_parser.rl&quot;
+#line 36 &quot;http11_parser.rl&quot;
 	{ 
     if(parser-&gt;request_method != NULL) 
       parser-&gt;request_method(parser-&gt;data, PTR_TO(mark), LEN(mark, p));
@@ -133,7 +121,7 @@ st3:
 	if ( ++p == pe )
 		goto _out3;
 case 3:
-#line 137 &quot;http11_parser.c&quot;
+#line 125 &quot;http11_parser.c&quot;
 	switch( (*p) ) {
 		case 42: goto tr4;
 		case 43: goto tr5;
@@ -150,66 +138,66 @@ case 3:
 		goto tr5;
 	goto st0;
 tr4:
-#line 34 &quot;http11_parser.rl&quot;
+#line 22 &quot;http11_parser.rl&quot;
 	{MARK(mark, p); }
 	goto st4;
 st4:
 	if ( ++p == pe )
 		goto _out4;
 case 4:
-#line 161 &quot;http11_parser.c&quot;
+#line 149 &quot;http11_parser.c&quot;
 	switch( (*p) ) {
 		case 32: goto tr8;
 		case 35: goto tr9;
 	}
 	goto st0;
 tr8:
-#line 53 &quot;http11_parser.rl&quot;
+#line 40 &quot;http11_parser.rl&quot;
 	{ 
     if(parser-&gt;request_uri != NULL)
       parser-&gt;request_uri(parser-&gt;data, PTR_TO(mark), LEN(mark, p));
   }
 	goto st5;
 tr30:
-#line 57 &quot;http11_parser.rl&quot;
+#line 44 &quot;http11_parser.rl&quot;
 	{ 
     if(parser-&gt;fragment != NULL)
       parser-&gt;fragment(parser-&gt;data, PTR_TO(mark), LEN(mark, p));
   }
 	goto st5;
 tr40:
-#line 73 &quot;http11_parser.rl&quot;
+#line 60 &quot;http11_parser.rl&quot;
 	{
     if(parser-&gt;request_path != NULL)
       parser-&gt;request_path(parser-&gt;data, PTR_TO(mark), LEN(mark,p));
   }
-#line 53 &quot;http11_parser.rl&quot;
+#line 40 &quot;http11_parser.rl&quot;
 	{ 
     if(parser-&gt;request_uri != NULL)
       parser-&gt;request_uri(parser-&gt;data, PTR_TO(mark), LEN(mark, p));
   }
 	goto st5;
 tr51:
-#line 62 &quot;http11_parser.rl&quot;
+#line 49 &quot;http11_parser.rl&quot;
 	{MARK(query_start, p); }
-#line 63 &quot;http11_parser.rl&quot;
+#line 50 &quot;http11_parser.rl&quot;
 	{ 
     if(parser-&gt;query_string != NULL)
       parser-&gt;query_string(parser-&gt;data, PTR_TO(query_start), LEN(query_start, p));
   }
-#line 53 &quot;http11_parser.rl&quot;
+#line 40 &quot;http11_parser.rl&quot;
 	{ 
     if(parser-&gt;request_uri != NULL)
       parser-&gt;request_uri(parser-&gt;data, PTR_TO(mark), LEN(mark, p));
   }
 	goto st5;
 tr55:
-#line 63 &quot;http11_parser.rl&quot;
+#line 50 &quot;http11_parser.rl&quot;
 	{ 
     if(parser-&gt;query_string != NULL)
       parser-&gt;query_string(parser-&gt;data, PTR_TO(query_start), LEN(query_start, p));
   }
-#line 53 &quot;http11_parser.rl&quot;
+#line 40 &quot;http11_parser.rl&quot;
 	{ 
     if(parser-&gt;request_uri != NULL)
       parser-&gt;request_uri(parser-&gt;data, PTR_TO(mark), LEN(mark, p));
@@ -219,19 +207,19 @@ st5:
 	if ( ++p == pe )
 		goto _out5;
 case 5:
-#line 223 &quot;http11_parser.c&quot;
+#line 211 &quot;http11_parser.c&quot;
 	if ( (*p) == 72 )
 		goto tr10;
 	goto st0;
 tr10:
-#line 34 &quot;http11_parser.rl&quot;
+#line 22 &quot;http11_parser.rl&quot;
 	{MARK(mark, p); }
 	goto st6;
 st6:
 	if ( ++p == pe )
 		goto _out6;
 case 6:
-#line 235 &quot;http11_parser.c&quot;
+#line 223 &quot;http11_parser.c&quot;
 	if ( (*p) == 84 )
 		goto st7;
 	goto st0;
@@ -289,14 +277,14 @@ case 13:
 		goto st13;
 	goto st0;
 tr18:
-#line 68 &quot;http11_parser.rl&quot;
+#line 55 &quot;http11_parser.rl&quot;
 	{	
     if(parser-&gt;http_version != NULL)
       parser-&gt;http_version(parser-&gt;data, PTR_TO(mark), LEN(mark, p));
   }
 	goto st14;
 tr26:
-#line 44 &quot;http11_parser.rl&quot;
+#line 31 &quot;http11_parser.rl&quot;
 	{ 
     if(parser-&gt;http_field != NULL) {
       parser-&gt;http_field(parser-&gt;data, PTR_TO(field_start), parser-&gt;field_len, PTR_TO(mark), LEN(mark, p));
@@ -307,7 +295,7 @@ st14:
 	if ( ++p == pe )
 		goto _out14;
 case 14:
-#line 311 &quot;http11_parser.c&quot;
+#line 299 &quot;http11_parser.c&quot;
 	if ( (*p) == 10 )
 		goto st15;
 	goto st0;
@@ -347,7 +335,7 @@ case 16:
 		goto tr22;
 	goto st0;
 tr22:
-#line 78 &quot;http11_parser.rl&quot;
+#line 65 &quot;http11_parser.rl&quot;
 	{ 
     parser-&gt;body_start = p - buffer + 1; 
     if(parser-&gt;header_done != NULL)
@@ -359,119 +347,113 @@ st57:
 	if ( ++p == pe )
 		goto _out57;
 case 57:
-#line 363 &quot;http11_parser.c&quot;
+#line 351 &quot;http11_parser.c&quot;
 	goto st0;
 tr21:
-#line 37 &quot;http11_parser.rl&quot;
+#line 25 &quot;http11_parser.rl&quot;
 	{ MARK(field_start, p); }
-#line 38 &quot;http11_parser.rl&quot;
-	{ snake_upcase_char((char *)p); }
-	goto st17;
-tr23:
-#line 38 &quot;http11_parser.rl&quot;
-	{ snake_upcase_char((char *)p); }
 	goto st17;
 st17:
 	if ( ++p == pe )
 		goto _out17;
 case 17:
-#line 379 &quot;http11_parser.c&quot;
+#line 361 &quot;http11_parser.c&quot;
 	switch( (*p) ) {
-		case 33: goto tr23;
+		case 33: goto st17;
 		case 58: goto tr24;
-		case 124: goto tr23;
-		case 126: goto tr23;
+		case 124: goto st17;
+		case 126: goto st17;
 	}
 	if ( (*p) &lt; 45 ) {
 		if ( (*p) &gt; 39 ) {
 			if ( 42 &lt;= (*p) &amp;&amp; (*p) &lt;= 43 )
-				goto tr23;
+				goto st17;
 		} else if ( (*p) &gt;= 35 )
-			goto tr23;
+			goto st17;
 	} else if ( (*p) &gt; 46 ) {
 		if ( (*p) &lt; 65 ) {
 			if ( 48 &lt;= (*p) &amp;&amp; (*p) &lt;= 57 )
-				goto tr23;
+				goto st17;
 		} else if ( (*p) &gt; 90 ) {
 			if ( 94 &lt;= (*p) &amp;&amp; (*p) &lt;= 122 )
-				goto tr23;
+				goto st17;
 		} else
-			goto tr23;
+			goto st17;
 	} else
-		goto tr23;
+		goto st17;
 	goto st0;
 tr24:
-#line 39 &quot;http11_parser.rl&quot;
+#line 26 &quot;http11_parser.rl&quot;
 	{ 
     parser-&gt;field_len = LEN(field_start, p);
   }
 	goto st18;
 tr27:
-#line 43 &quot;http11_parser.rl&quot;
+#line 30 &quot;http11_parser.rl&quot;
 	{ MARK(mark, p); }
 	goto st18;
 st18:
 	if ( ++p == pe )
 		goto _out18;
 case 18:
-#line 418 &quot;http11_parser.c&quot;
+#line 400 &quot;http11_parser.c&quot;
 	switch( (*p) ) {
 		case 13: goto tr26;
 		case 32: goto tr27;
 	}
 	goto tr25;
 tr25:
-#line 43 &quot;http11_parser.rl&quot;
+#line 30 &quot;http11_parser.rl&quot;
 	{ MARK(mark, p); }
 	goto st19;
 st19:
 	if ( ++p == pe )
 		goto _out19;
 case 19:
-#line 432 &quot;http11_parser.c&quot;
+#line 414 &quot;http11_parser.c&quot;
 	if ( (*p) == 13 )
 		goto tr26;
 	goto st19;
 tr9:
-#line 53 &quot;http11_parser.rl&quot;
+#line 40 &quot;http11_parser.rl&quot;
 	{ 
     if(parser-&gt;request_uri != NULL)
       parser-&gt;request_uri(parser-&gt;data, PTR_TO(mark), LEN(mark, p));
   }
 	goto st20;
 tr41:
-#line 73 &quot;http11_parser.rl&quot;
+#line 60 &quot;http11_parser.rl&quot;
 	{
     if(parser-&gt;request_path != NULL)
       parser-&gt;request_path(parser-&gt;data, PTR_TO(mark), LEN(mark,p));
   }
-#line 53 &quot;http11_parser.rl&quot;
+#line 40 &quot;http11_parser.rl&quot;
 	{ 
     if(parser-&gt;request_uri != NULL)
       parser-&gt;request_uri(parser-&gt;data, PTR_TO(mark), LEN(mark, p));
   }
 	goto st20;
 tr52:
-#line 62 &quot;http11_parser.rl&quot;
+#line 49 &quot;http11_parser.rl&quot;
 	{MARK(query_start, p); }
-#line 63 &quot;http11_parser.rl&quot;
+#line 50 &quot;http11_parser.rl&quot;
 	{ 
     if(parser-&gt;query_string != NULL)
       parser-&gt;query_string(parser-&gt;data, PTR_TO(query_start), LEN(query_start, p));
   }
-#line 53 &quot;http11_parser.rl&quot;
+#line 40 &quot;http11_parser.rl&quot;
 	{ 
     if(parser-&gt;request_uri != NULL)
       parser-&gt;request_uri(parser-&gt;data, PTR_TO(mark), LEN(mark, p));
   }
 	goto st20;
 tr56:
-#line 63 &quot;http11_parser.rl&quot;
+#line 50 &quot;http11_parser.rl&quot;
 	{ 
     if(parser-&gt;query_string != NULL)
       parser-&gt;query_string(parser-&gt;data, PTR_TO(query_start), LEN(query_start, p));
   }
-#line 53 &quot;http11_parser.rl&quot;
+#line 40 &quot;http11_parser.rl&quot;
 	{ 
     if(parser-&gt;request_uri != NULL)
       parser-&gt;request_uri(parser-&gt;data, PTR_TO(mark), LEN(mark, p));
@@ -481,43 +463,51 @@ st20:
 	if ( ++p == pe )
 		goto _out20;
 case 20:
-#line 485 &quot;http11_parser.c&quot;
+#line 467 &quot;http11_parser.c&quot;
 	switch( (*p) ) {
 		case 32: goto tr30;
-		case 35: goto st0;
 		case 37: goto tr31;
+		case 60: goto st0;
+		case 62: goto st0;
 		case 127: goto st0;
 	}
-	if ( 0 &lt;= (*p) &amp;&amp; (*p) &lt;= 31 )
+	if ( (*p) &gt; 31 ) {
+		if ( 34 &lt;= (*p) &amp;&amp; (*p) &lt;= 35 )
+			goto st0;
+	} else if ( (*p) &gt;= 0 )
 		goto st0;
 	goto tr29;
 tr29:
-#line 34 &quot;http11_parser.rl&quot;
+#line 22 &quot;http11_parser.rl&quot;
 	{MARK(mark, p); }
 	goto st21;
 st21:
 	if ( ++p == pe )
 		goto _out21;
 case 21:
-#line 503 &quot;http11_parser.c&quot;
+#line 489 &quot;http11_parser.c&quot;
 	switch( (*p) ) {
 		case 32: goto tr30;
-		case 35: goto st0;
 		case 37: goto st22;
+		case 60: goto st0;
+		case 62: goto st0;
 		case 127: goto st0;
 	}
-	if ( 0 &lt;= (*p) &amp;&amp; (*p) &lt;= 31 )
+	if ( (*p) &gt; 31 ) {
+		if ( 34 &lt;= (*p) &amp;&amp; (*p) &lt;= 35 )
+			goto st0;
+	} else if ( (*p) &gt;= 0 )
 		goto st0;
 	goto st21;
 tr31:
-#line 34 &quot;http11_parser.rl&quot;
+#line 22 &quot;http11_parser.rl&quot;
 	{MARK(mark, p); }
 	goto st22;
 st22:
 	if ( ++p == pe )
 		goto _out22;
 case 22:
-#line 521 &quot;http11_parser.c&quot;
+#line 511 &quot;http11_parser.c&quot;
 	if ( (*p) &lt; 65 ) {
 		if ( 48 &lt;= (*p) &amp;&amp; (*p) &lt;= 57 )
 			goto st23;
@@ -541,14 +531,14 @@ case 23:
 		goto st21;
 	goto st0;
 tr5:
-#line 34 &quot;http11_parser.rl&quot;
+#line 22 &quot;http11_parser.rl&quot;
 	{MARK(mark, p); }
 	goto st24;
 st24:
 	if ( ++p == pe )
 		goto _out24;
 case 24:
-#line 552 &quot;http11_parser.c&quot;
+#line 542 &quot;http11_parser.c&quot;
 	switch( (*p) ) {
 		case 43: goto st24;
 		case 58: goto st25;
@@ -566,18 +556,21 @@ case 24:
 		goto st24;
 	goto st0;
 tr7:
-#line 34 &quot;http11_parser.rl&quot;
+#line 22 &quot;http11_parser.rl&quot;
 	{MARK(mark, p); }
 	goto st25;
 st25:
 	if ( ++p == pe )
 		goto _out25;
 case 25:
-#line 577 &quot;http11_parser.c&quot;
+#line 567 &quot;http11_parser.c&quot;
 	switch( (*p) ) {
 		case 32: goto tr8;
+		case 34: goto st0;
 		case 35: goto tr9;
 		case 37: goto st26;
+		case 60: goto st0;
+		case 62: goto st0;
 		case 127: goto st0;
 	}
 	if ( 0 &lt;= (*p) &amp;&amp; (*p) &lt;= 31 )
@@ -610,19 +603,22 @@ case 27:
 		goto st25;
 	goto st0;
 tr6:
-#line 34 &quot;http11_parser.rl&quot;
+#line 22 &quot;http11_parser.rl&quot;
 	{MARK(mark, p); }
 	goto st28;
 st28:
 	if ( ++p == pe )
 		goto _out28;
 case 28:
-#line 621 &quot;http11_parser.c&quot;
+#line 614 &quot;http11_parser.c&quot;
 	switch( (*p) ) {
 		case 32: goto tr40;
+		case 34: goto st0;
 		case 35: goto tr41;
 		case 37: goto st29;
 		case 59: goto tr43;
+		case 60: goto st0;
+		case 62: goto st0;
 		case 63: goto tr44;
 		case 127: goto st0;
 	}
@@ -656,7 +652,7 @@ case 30:
 		goto st28;
 	goto st0;
 tr43:
-#line 73 &quot;http11_parser.rl&quot;
+#line 60 &quot;http11_parser.rl&quot;
 	{
     if(parser-&gt;request_path != NULL)
       parser-&gt;request_path(parser-&gt;data, PTR_TO(mark), LEN(mark,p));
@@ -666,11 +662,14 @@ st31:
 	if ( ++p == pe )
 		goto _out31;
 case 31:
-#line 670 &quot;http11_parser.c&quot;
+#line 666 &quot;http11_parser.c&quot;
 	switch( (*p) ) {
 		case 32: goto tr8;
+		case 34: goto st0;
 		case 35: goto tr9;
 		case 37: goto st32;
+		case 60: goto st0;
+		case 62: goto st0;
 		case 63: goto st34;
 		case 127: goto st0;
 	}
@@ -704,7 +703,7 @@ case 33:
 		goto st31;
 	goto st0;
 tr44:
-#line 73 &quot;http11_parser.rl&quot;
+#line 60 &quot;http11_parser.rl&quot;
 	{
     if(parser-&gt;request_path != NULL)
       parser-&gt;request_path(parser-&gt;data, PTR_TO(mark), LEN(mark,p));
@@ -714,43 +713,49 @@ st34:
 	if ( ++p == pe )
 		goto _out34;
 case 34:
-#line 718 &quot;http11_parser.c&quot;
+#line 717 &quot;http11_parser.c&quot;
 	switch( (*p) ) {
 		case 32: goto tr51;
+		case 34: goto st0;
 		case 35: goto tr52;
 		case 37: goto tr53;
+		case 60: goto st0;
+		case 62: goto st0;
 		case 127: goto st0;
 	}
 	if ( 0 &lt;= (*p) &amp;&amp; (*p) &lt;= 31 )
 		goto st0;
 	goto tr50;
 tr50:
-#line 62 &quot;http11_parser.rl&quot;
+#line 49 &quot;http11_parser.rl&quot;
 	{MARK(query_start, p); }
 	goto st35;
 st35:
 	if ( ++p == pe )
 		goto _out35;
 case 35:
-#line 736 &quot;http11_parser.c&quot;
+#line 738 &quot;http11_parser.c&quot;
 	switch( (*p) ) {
 		case 32: goto tr55;
+		case 34: goto st0;
 		case 35: goto tr56;
 		case 37: goto st36;
+		case 60: goto st0;
+		case 62: goto st0;
 		case 127: goto st0;
 	}
 	if ( 0 &lt;= (*p) &amp;&amp; (*p) &lt;= 31 )
 		goto st0;
 	goto st35;
 tr53:
-#line 62 &quot;http11_parser.rl&quot;
+#line 49 &quot;http11_parser.rl&quot;
 	{MARK(query_start, p); }
 	goto st36;
 st36:
 	if ( ++p == pe )
 		goto _out36;
 case 36:
-#line 754 &quot;http11_parser.c&quot;
+#line 759 &quot;http11_parser.c&quot;
 	if ( (*p) &lt; 65 ) {
 		if ( 48 &lt;= (*p) &amp;&amp; (*p) &lt;= 57 )
 			goto st37;
@@ -1165,7 +1170,7 @@ case 56:
 
 	_out: {}
 	}
-#line 122 &quot;http11_parser.rl&quot;
+#line 109 &quot;http11_parser.rl&quot;
 
   parser-&gt;cs = cs;
   parser-&gt;nread += p - (buffer + off);
@@ -1180,8 +1185,8 @@ case 56:
   if(parser-&gt;body_start) {
     /* final \r\n combo encountered so stop right here */
     
-#line 1184 &quot;http11_parser.c&quot;
-#line 136 &quot;http11_parser.rl&quot;
+#line 1189 &quot;http11_parser.c&quot;
+#line 123 &quot;http11_parser.rl&quot;
     parser-&gt;nread++;
   }
 
@@ -1193,8 +1198,8 @@ int http_parser_finish(http_parser *parser)
   int cs = parser-&gt;cs;
 
   
-#line 1197 &quot;http11_parser.c&quot;
-#line 147 &quot;http11_parser.rl&quot;
+#line 1202 &quot;http11_parser.c&quot;
+#line 134 &quot;http11_parser.rl&quot;
 
   parser-&gt;cs = cs;
 </diff>
      <filename>ext/http11/http11_parser.c</filename>
    </modified>
    <modified>
      <diff>@@ -13,7 +13,6 @@ public class Http11Parser {
   action mark {parser.mark = fpc; }
 
   action start_field { parser.field_start = fpc; }
-  action snake_upcase_field { /* FIXME stub */ }
   action write_field { 
     parser.field_len = fpc-parser.field_start;
   }</diff>
      <filename>ext/http11/http11_parser.java.rl</filename>
    </modified>
    <modified>
      <diff>@@ -9,18 +9,6 @@
 #include &lt;ctype.h&gt;
 #include &lt;string.h&gt;
 
-/*
- * capitalizes all lower-case ASCII characters,
- * converts dashes to underscores.
- */
-static void snake_upcase_char(char *c)
-{
-    if (*c &gt;= 'a' &amp;&amp; *c &lt;= 'z')
-      *c &amp;= ~0x20;
-    else if (*c == '-')
-      *c = '_';
-}
-
 #define LEN(AT, FPC) (FPC - buffer - parser-&gt;AT)
 #define MARK(M,FPC) (parser-&gt;M = (FPC) - buffer)
 #define PTR_TO(F) (buffer + parser-&gt;F)
@@ -35,7 +23,6 @@ static void snake_upcase_char(char *c)
 
 
   action start_field { MARK(field_start, fpc); }
-  action snake_upcase_field { snake_upcase_char((char *)fpc); }
   action write_field { 
     parser-&gt;field_len = LEN(field_start, fpc);
   }</diff>
      <filename>ext/http11/http11_parser.rl</filename>
    </modified>
    <modified>
      <diff>@@ -11,12 +11,11 @@
   safe = (&quot;$&quot; | &quot;-&quot; | &quot;_&quot; | &quot;.&quot;);
   extra = (&quot;!&quot; | &quot;*&quot; | &quot;'&quot; | &quot;(&quot; | &quot;)&quot; | &quot;,&quot;);
   reserved = (&quot;;&quot; | &quot;/&quot; | &quot;?&quot; | &quot;:&quot; | &quot;@&quot; | &quot;&amp;&quot; | &quot;=&quot; | &quot;+&quot;);
-  sorta_safe = (&quot;\&quot;&quot; | &quot;&lt;&quot; | &quot;&gt;&quot;);
-  unsafe = (CTL | &quot; &quot; | &quot;#&quot; | &quot;%&quot; | sorta_safe);
+  unsafe = (CTL | &quot; &quot; | &quot;\&quot;&quot; | &quot;#&quot; | &quot;%&quot; | &quot;&lt;&quot; | &quot;&gt;&quot;);
   national = any -- (alpha | digit | reserved | extra | safe | unsafe);
   unreserved = (alpha | digit | safe | extra | national);
   escape = (&quot;%&quot; xdigit xdigit);
-  uchar = (unreserved | escape | sorta_safe);
+  uchar = (unreserved | escape);
   pchar = (uchar | &quot;:&quot; | &quot;@&quot; | &quot;&amp;&quot; | &quot;=&quot; | &quot;+&quot;);
   tspecials = (&quot;(&quot; | &quot;)&quot; | &quot;&lt;&quot; | &quot;&gt;&quot; | &quot;@&quot; | &quot;,&quot; | &quot;;&quot; | &quot;:&quot; | &quot;\\&quot; | &quot;\&quot;&quot; | &quot;/&quot; | &quot;[&quot; | &quot;]&quot; | &quot;?&quot; | &quot;=&quot; | &quot;{&quot; | &quot;}&quot; | &quot; &quot; | &quot;\t&quot;);
 
@@ -42,7 +41,7 @@
   HTTP_Version = ( &quot;HTTP/&quot; http_number ) &gt;mark %http_version ;
   Request_Line = ( Method &quot; &quot; Request_URI (&quot;#&quot; Fragment){0,1} &quot; &quot; HTTP_Version CRLF ) ;
 
-  field_name = ( token -- &quot;:&quot; )+ &gt;start_field $snake_upcase_field %write_field;
+  field_name = ( token -- &quot;:&quot; )+ &gt;start_field %write_field;
 
   field_value = any* &gt;start_value %write_value;
 </diff>
      <filename>ext/http11/http11_parser_common.rl</filename>
    </modified>
    <modified>
      <diff>@@ -215,7 +215,7 @@ public class Http11 extends RubyObject {
 
                 req.setInstanceVariable(&quot;@http_body&quot;, RubyString.newString(runtime, new ByteList(hp.parser.buffer, at, length)));
                 req.aset(runtime.newString(&quot;SERVER_PROTOCOL&quot;),runtime.newString(&quot;HTTP/1.1&quot;));
-                req.aset(runtime.newString(&quot;SERVER_SOFTWARE&quot;),runtime.newString(&quot;Mongrel 1.2&quot;));
+                req.aset(runtime.newString(&quot;SERVER_SOFTWARE&quot;),runtime.newString(&quot;Mongrel 1.1.5&quot;));
             }
         };
 </diff>
      <filename>ext/http11_java/org/jruby/mongrel/Http11.java</filename>
    </modified>
    <modified>
      <diff>@@ -1,4 +1,5 @@
-# Ruby
+
+# Standard libraries
 require 'socket'
 require 'tempfile'
 require 'yaml'
@@ -7,19 +8,16 @@ require 'etc'
 require 'uri'
 require 'stringio'
 
-# Ensure working require
-require 'mongrel/gems'
+# Compiled Mongrel extension
+require 'http11'
 
-# TODO: Only require these for RUBY_VERSION &lt;= 1.8.6 
-#       and only for platforms that require it, exclusive matching
-if !RUBY_PLATFORM.match(/java|mswin/) &amp;&amp; !RUBY_VERSION.match(/1\.8\.\d/)
+# Gem conditional loader
+require 'mongrel/gems'
 Mongrel::Gems.require 'cgi_multipart_eof_fix'
 Mongrel::Gems.require 'fastthread'
-end
 require 'thread'
 
-require 'http11'
-require 'mongrel/logger'
+# Ruby Mongrel
 require 'mongrel/cgi'
 require 'mongrel/handlers'
 require 'mongrel/command'
@@ -47,6 +45,7 @@ module Mongrel
     attr_accessor :http_body
   end
 
+
   # This is the main driver of Mongrel, while the Mongrel::HttpParser and Mongrel::URIClassifier
   # make up the majority of how the server functions.  It's a very simple class that just
   # has a thread accepting connections and a simple HttpServer.process_client function
@@ -54,7 +53,7 @@ module Mongrel
   #
   # You use it by doing the following:
   #
-  #   server = 2(&quot;0.0.0.0&quot;, 3000)
+  #   server = HttpServer.new(&quot;0.0.0.0&quot;, 3000)
   #   server.register(&quot;/stuff&quot;, MyNiftyHandler.new)
   #   server.run.join
   #
@@ -75,8 +74,6 @@ module Mongrel
     attr_reader :timeout
     attr_reader :num_processors
 
-    attr_accessor :logger
-
     # Creates a working server on host:port (strange things happen if port isn't a Number).
     # Use HttpServer::run to start the server and HttpServer.acceptor.join to 
     # join the thread that's processing incoming requests on the socket.
@@ -90,7 +87,7 @@ module Mongrel
     # The throttle parameter is a sleep timeout (in hundredths of a second) that is placed between 
     # socket.accept calls in order to give the server a cheap throttle time.  It defaults to 0 and
     # actually if it is 0 then the sleep is not done at all.
-    def initialize(host, port, num_processors=950, throttle=0, timeout=60, log=nil, log_level=:debug)
+    def initialize(host, port, num_processors=950, throttle=0, timeout=60)
       
       tries = 0
       @socket = TCPServer.new(host, port) 
@@ -99,12 +96,11 @@ module Mongrel
       @host = host
       @port = port
       @workers = ThreadGroup.new
-      @throttle = throttle
+      @throttle = throttle / 100.0
       @num_processors = num_processors
       @timeout = timeout
-      @logger = Mongrel::Log.new(log || &quot;log/mongrel-#{host}-#{port}.log&quot;, log_level)
     end
-    
+
     # Does the majority of the IO processing.  It has been written in Ruby using
     # about 7 different IO processing strategies and no matter how it's done 
     # the performance just does not improve.  It is currently carefully constructed
@@ -188,23 +184,21 @@ module Mongrel
       rescue EOFError,Errno::ECONNRESET,Errno::EPIPE,Errno::EINVAL,Errno::EBADF
         client.close rescue nil
       rescue HttpParserError =&gt; e
-        Mongrel.log(:error, &quot;#{Time.now.httpdate}: HTTP parse error, malformed request (#{params[Const::HTTP_X_FORWARDED_FOR] || client.peeraddr.last}): #{e.inspect}&quot;)
-        Mongrel.log(:error, &quot;#{Time.now.httpdate}: REQUEST DATA: #{data.inspect}\n---\nPARAMS: #{params.inspect}\n---\n&quot;)
-        # http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4
-        client.write(Const::ERROR_400_RESPONSE)
+        STDERR.puts &quot;#{Time.now}: HTTP parse error, malformed request (#{params[Const::HTTP_X_FORWARDED_FOR] || client.peeraddr.last}): #{e.inspect}&quot;
+        STDERR.puts &quot;#{Time.now}: REQUEST DATA: #{data.inspect}\n---\nPARAMS: #{params.inspect}\n---\n&quot;
       rescue Errno::EMFILE
         reap_dead_workers('too many files')
       rescue Object =&gt; e
-        Mongrel.log(:error, &quot;#{Time.now.httpdate}: Read error: #{e.inspect}&quot;)
-        Mongrel.log(:error, e.backtrace.join(&quot;\n&quot;))
+        STDERR.puts &quot;#{Time.now}: Read error: #{e.inspect}&quot;
+        STDERR.puts e.backtrace.join(&quot;\n&quot;)
       ensure
         begin
           client.close
         rescue IOError
           # Already closed
         rescue Object =&gt; e
-          Mongrel.log(:error, &quot;#{Time.now.httpdate}: Client error: #{e.inspect}&quot;)
-          Mongrel.log(:error, e.backtrace.join(&quot;\n&quot;))
+          STDERR.puts &quot;#{Time.now}: Client error: #{e.inspect}&quot;
+          STDERR.puts e.backtrace.join(&quot;\n&quot;)
         end
         request.body.delete if request and request.body.class == Tempfile
       end
@@ -216,14 +210,14 @@ module Mongrel
     # after the reap is done.  It only runs if there are workers to reap.
     def reap_dead_workers(reason='unknown')
       if @workers.list.length &gt; 0
-        Mongrel.log(:error, &quot;#{Time.now.httpdate}: Reaping #{@workers.list.length} threads for slow workers because of '#{reason}'&quot;)
-        error_msg = &quot;#{Time.now.httpdate}: Mongrel timed out this thread: #{reason}&quot;
+        STDERR.puts &quot;#{Time.now}: Reaping #{@workers.list.length} threads for slow workers because of '#{reason}'&quot;
+        error_msg = &quot;Mongrel timed out this thread: #{reason}&quot;
         mark = Time.now
         @workers.list.each do |worker|
           worker[:started_on] = Time.now if not worker[:started_on]
 
           if mark - worker[:started_on] &gt; @timeout + @throttle
-            Mongrel.log(:error, &quot;#{Time.now.httpdate}: Thread #{worker.inspect} is too old, killing.&quot;)
+            STDERR.puts &quot;Thread #{worker.inspect} is too old, killing.&quot;
             worker.raise(TimeoutError.new(error_msg))
           end
         end
@@ -238,7 +232,7 @@ module Mongrel
     # that much longer.
     def graceful_shutdown
       while reap_dead_workers(&quot;shutdown&quot;) &gt; 0
-        Mongrel.log(:error, &quot;#{Time.now.httpdate}: Waiting for #{@workers.list.length} requests to finish, could take #{@timeout + @throttle} seconds.&quot;)
+        STDERR.puts &quot;Waiting for #{@workers.list.length} requests to finish, could take #{@timeout + @throttle} seconds.&quot;
         sleep @timeout / 10
       end
     end
@@ -276,21 +270,23 @@ module Mongrel
           while true
             begin
               client = @socket.accept
-
-              num_workers = @workers.list.length
-              if num_workers &gt;= @num_processors
-                Mongrel.log(:error, &quot;#{Time.now.httpdate}: Server overloaded with #{num_workers} processors (#@num_processors max). Dropping connection.&quot;)
+  
+              if defined?($tcp_cork_opts) and $tcp_cork_opts
+                client.setsockopt(*$tcp_cork_opts) rescue nil
+              end
+  
+              worker_list = @workers.list
+  
+              if worker_list.length &gt;= @num_processors
+                STDERR.puts &quot;Server overloaded with #{worker_list.length} processors (#@num_processors max). Dropping connection.&quot;
                 client.close rescue nil
                 reap_dead_workers(&quot;max processors&quot;)
               else
-                if defined?($tcp_cork_opts) and $tcp_cork_opts
-                  client.setsockopt(*$tcp_cork_opts) rescue nil
-                end
                 thread = Thread.new(client) {|c| process_client(c) }
                 thread[:started_on] = Time.now
                 @workers.add(thread)
   
-                sleep @throttle/100.0 if @throttle &gt; 0
+                sleep @throttle if @throttle &gt; 0
               end
             rescue StopServer
               break
@@ -301,14 +297,14 @@ module Mongrel
               # client closed the socket even before accept
               client.close rescue nil
             rescue Object =&gt; e
-              Mongrel.log(:error, &quot;#{Time.now.httpdate}: Unhandled listen loop exception #{e.inspect}.&quot;)
-              Mongrel.log(:error, e.backtrace.join(&quot;\n&quot;))
+              STDERR.puts &quot;#{Time.now}: Unhandled listen loop exception #{e.inspect}.&quot;
+              STDERR.puts e.backtrace.join(&quot;\n&quot;)
             end
           end
           graceful_shutdown
         ensure
           @socket.close
-          # Mongrel.log(:error, &quot;#{Time.now.httpdate}: Closed socket.&quot;)
+          # STDERR.puts &quot;#{Time.now}: Closed socket.&quot;
         end
       end
 </diff>
      <filename>lib/mongrel.rb</filename>
    </modified>
    <modified>
      <diff>@@ -173,10 +173,9 @@ module Mongrel
     
     # The stdoutput should be completely bypassed but we'll drop a warning just in case
     def stdoutput
-      STDERR.puts &quot;#{Time.now.httpdate}: WARNING: Your program is doing something not expected.  Please tell Zed that stdoutput was used and what software you are running.  Thanks.&quot;
+      STDERR.puts &quot;WARNING: Your program is doing something not expected.  Please tell Zed that stdoutput was used and what software you are running.  Thanks.&quot;
       @response.body
     end    
 
   end
-
 end</diff>
      <filename>lib/mongrel/cgi.rb</filename>
    </modified>
    <modified>
      <diff>@@ -55,13 +55,15 @@ module Mongrel
         # I need to add my own -h definition to prevent the -h by default from exiting.
         @opt.on_tail(&quot;-h&quot;, &quot;--help&quot;, &quot;Show this message&quot;) do
           @done_validating = true
-          Mongrel.log(@opt)
+          puts @opt
         end
 
         # I need to add my own -v definition to prevent the -v from exiting by default as well.
         @opt.on_tail(&quot;--version&quot;, &quot;Show version&quot;) do
           @done_validating = true
-          Mongrel.log(&quot;Version #{Mongrel::Const::MONGREL_VERSION}&quot;)
+          if VERSION
+            puts &quot;Version #{Mongrel::Const::MONGREL_VERSION}&quot;
+          end
         end
 
         @opt.parse! argv
@@ -153,17 +155,17 @@ module Mongrel
 
       # Prints a list of available commands.
       def print_command_list
-        Mongrel.log(&quot;#{Mongrel::Command::BANNER}\nAvailable commands are:\n\n&quot;)
+        puts &quot;#{Mongrel::Command::BANNER}\nAvailable commands are:\n\n&quot;
 
         self.commands.each do |name|
           if /mongrel::/ =~ name
             name = name[9 .. -1]
           end
 
-          Mongrel.log(&quot; - #{name[1 .. -1]}\n&quot;)
+          puts &quot; - #{name[1 .. -1]}\n&quot;
         end
 
-        Mongrel.log(&quot;\nEach command takes -h as an option to get help.&quot;)
+        puts &quot;\nEach command takes -h as an option to get help.&quot;
 
       end
 
@@ -178,7 +180,7 @@ module Mongrel
           print_command_list
           return true
         elsif cmd_name == &quot;--version&quot;
-          Mongrel.log(&quot;Mongrel Web Server #{Mongrel::Const::MONGREL_VERSION}&quot;)
+          puts &quot;Mongrel Web Server #{Mongrel::Const::MONGREL_VERSION}&quot;
           return true
         end
 </diff>
      <filename>lib/mongrel/command.rb</filename>
    </modified>
    <modified>
      <diff>@@ -59,18 +59,18 @@ module Mongrel
         target_gid = Etc.getgrnam(group).gid if group
 
         if uid != target_uid or gid != target_gid
-          Mongrel.log(&quot;Initiating groups for #{user.inspect}:#{group.inspect}.&quot;)
+          log &quot;Initiating groups for #{user.inspect}:#{group.inspect}.&quot;
           Process.initgroups(user, target_gid)
         
-          Mongrel.log(&quot;Changing group to #{group.inspect}.&quot;)
+          log &quot;Changing group to #{group.inspect}.&quot;
           Process::GID.change_privilege(target_gid)
 
-          Mongrel.log(&quot;Changing user to #{user.inspect}.&quot; )
+          log &quot;Changing user to #{user.inspect}.&quot; 
           Process::UID.change_privilege(target_uid)
         end
       rescue Errno::EPERM =&gt; e
-        Mongrel.log(:critical, &quot;Couldn't change user and group to #{user.inspect}:#{group.inspect}: #{e.to_s}.&quot;)
-        Mongrel.log(:critical, &quot;Mongrel failed to start.&quot;)
+        log &quot;Couldn't change user and group to #{user.inspect}:#{group.inspect}: #{e.to_s}.&quot;
+        log &quot;Mongrel failed to start.&quot;
         exit 1
       end
     end
@@ -81,13 +81,13 @@ module Mongrel
 
     # Writes the PID file if we're not on Windows.
     def write_pid_file
-      unless RUBY_PLATFORM =~ /djgpp|(cyg|ms|bcc)win|mingw/
-        Mongrel.log(&quot;Writing PID file to #{@pid_file}&quot;)
+      if RUBY_PLATFORM !~ /mswin/
+        log &quot;Writing PID file to #{@pid_file}&quot;
         open(@pid_file,&quot;w&quot;) {|f| f.write(Process.pid) }
         open(@pid_file,&quot;w&quot;) do |f|
           f.write(Process.pid)
           File.chmod(0644, @pid_file)
-        end
+        end      
       end
     end
 
@@ -131,21 +131,17 @@ module Mongrel
     #
     def listener(options={},&amp;block)
       raise &quot;Cannot call listener inside another listener block.&quot; if (@listener or @listener_name)
-      opts = resolve_defaults(options)
-      opts[:num_processors] ||= 950
-      opts[:throttle] ||= 0
-      opts[:timeout] ||= 60
-
-      @listener = Mongrel::HttpServer.new(
-      opts[:host], opts[:port].to_i, opts[:num_processors].to_i, 
-      opts[:throttle].to_i, opts[:timeout].to_i, 
-      opts[:log], opts[:log_level]
-      )
-      @listener_name = &quot;#{opts[:host]}:#{opts[:port]}&quot;
+      ops = resolve_defaults(options)
+      ops[:num_processors] ||= 950
+      ops[:throttle] ||= 0
+      ops[:timeout] ||= 60
+
+      @listener = Mongrel::HttpServer.new(ops[:host], ops[:port].to_i, ops[:num_processors].to_i, ops[:throttle].to_i, ops[:timeout].to_i)
+      @listener_name = &quot;#{ops[:host]}:#{ops[:port]}&quot;
       @listeners[@listener_name] = @listener
 
-      if opts[:user] and opts[:group]
-        change_privilege(opts[:user], opts[:group])
+      if ops[:user] and ops[:group]
+        change_privilege(ops[:user], ops[:group])
       end
 
       # Does the actual cloaking operation to give the new implicit self.
@@ -167,8 +163,8 @@ module Mongrel
     # * :handler =&gt; HttpHandler -- Handler to use for this location.
     # * :in_front =&gt; true/false -- Rather than appending, it prepends this handler.
     def uri(location, options={})
-      opts = resolve_defaults(options)
-      @listener.register(location, opts[:handler], opts[:in_front])
+      ops = resolve_defaults(options)
+      @listener.register(location, ops[:handler], ops[:in_front])
     end
 
 
@@ -187,16 +183,16 @@ module Mongrel
     # It is safe to call this on win32 as it will only require the daemons
     # gem/library if NOT win32.
     def daemonize(options={})
-      opts = resolve_defaults(options)
+      ops = resolve_defaults(options)
       # save this for later since daemonize will hose it
-      unless RUBY_PLATFORM =~ /djgpp|(cyg|ms|bcc)win|mingw/
+      if RUBY_PLATFORM !~ /mswin/
         require 'daemons/daemonize'
 
-        logfile = opts[:log_file]
+        logfile = ops[:log_file]
         if logfile[0].chr != &quot;/&quot;
-          logfile = File.join(opts[:cwd],logfile)
+          logfile = File.join(ops[:cwd],logfile)
           if not File.exist?(File.dirname(logfile))
-            Mongrel.log(:critical, &quot;!!! Log file directory not found at full path #{File.dirname(logfile)}.  Update your configuration to use a full path.&quot;)
+            log &quot;!!! Log file directory not found at full path #{File.dirname(logfile)}.  Update your configuration to use a full path.&quot;
             exit 1
           end
         end
@@ -204,10 +200,10 @@ module Mongrel
         Daemonize.daemonize(logfile)
 
         # change back to the original starting directory
-        Dir.chdir(opts[:cwd])
+        Dir.chdir(ops[:cwd])
 
       else
-        Mongrel.log(:warning, &quot;WARNING: Win32 does not support daemon mode.&quot;)
+        log &quot;WARNING: Win32 does not support daemon mode.&quot;
       end
     end
 
@@ -217,17 +213,17 @@ module Mongrel
     # :excludes =&gt; [] setting listing the names of plugins to include
     # or exclude from the determining the dependencies.
     def load_plugins(options={})
-      opts = resolve_defaults(options)
+      ops = resolve_defaults(options)
 
       load_settings = {}
-      if opts[:includes]
-        opts[:includes].each do |plugin|
+      if ops[:includes]
+        ops[:includes].each do |plugin|
           load_settings[plugin] = GemPlugin::INCLUDE
         end
       end
 
-      if opts[:excludes]
-        opts[:excludes].each do |plugin|
+      if ops[:excludes]
+        ops[:excludes].each do |plugin|
           load_settings[plugin] = GemPlugin::EXCLUDE
         end
       end
@@ -253,7 +249,7 @@ module Mongrel
       mime = load_yaml(file, mime)
 
       # check all the mime types to make sure they are the right format
-      mime.each {|k,v| Mongrel.log(:warning, &quot;WARNING: MIME type #{k} must start with '.'&quot;) if k.index(&quot;.&quot;) != 0 }
+      mime.each {|k,v| log &quot;WARNING: MIME type #{k} must start with '.'&quot; if k.index(&quot;.&quot;) != 0 }
 
       return mime
     end
@@ -263,8 +259,8 @@ module Mongrel
     # name and configured with the selected options.  The options
     # are merged with the defaults prior to passing them in.
     def plugin(name, options={})
-      opts = resolve_defaults(options)
-      GemPlugin::Manager.instance.create(name, opts)
+      ops = resolve_defaults(options)
+      GemPlugin::Manager.instance.create(name, ops)
     end
 
     # Lets you do redirects easily as described in Mongrel::RedirectHandler.
@@ -348,7 +344,7 @@ module Mongrel
     # it reads it in and does an eval on the contents passing in the right
     # binding so they can put their own Configurator statements.
     def run_config(script)
-      open(script) {|f| eval(f.read, proc {self}.binding) }
+      open(script) {|f| eval(f.read, proc {self}) }
     end
 
     # Sets up the standard signal handlers that are used on most Ruby
@@ -362,28 +358,31 @@ module Mongrel
     #
     # This command is safely ignored if the platform is win32 (with a warning)
     def setup_signals(options={})
-      opts = resolve_defaults(options)
+      ops = resolve_defaults(options)
 
       # forced shutdown, even if previously restarted (actually just like TERM but for CTRL-C)
-      trap(&quot;INT&quot;) { Mongrel.log(:notice, &quot;INT signal received.&quot;); stop(false) }
+      trap(&quot;INT&quot;) { log &quot;INT signal received.&quot;; stop(false) }
 
-      # always clean up the pid file
+      # clean up the pid file always
       at_exit { remove_pid_file }
 
-      unless RUBY_PLATFORM =~ /djgpp|(cyg|ms|bcc)win|mingw/
+      if RUBY_PLATFORM !~ /mswin/
         # graceful shutdown
-        trap(&quot;TERM&quot;) { Mongrel.log(:notice, &quot;TERM signal received.&quot;); stop }
-        # debug mode
-        trap(&quot;USR1&quot;) { Mongrel.log(:notice, &quot;USR1 received, toggling $mongrel_debug_client to #{!$mongrel_debug_client}&quot;); $mongrel_debug_client = !$mongrel_debug_client }
+        trap(&quot;TERM&quot;) { log &quot;TERM signal received.&quot;; stop }
+        trap(&quot;USR1&quot;) { log &quot;USR1 received, toggling $mongrel_debug_client to #{!$mongrel_debug_client}&quot;; $mongrel_debug_client = !$mongrel_debug_client }
         # restart
-        trap(&quot;USR2&quot;) { Mongrel.log(:notice, &quot;USR2 signal received.&quot;); stop(true) }
+        trap(&quot;USR2&quot;) { log &quot;USR2 signal received.&quot;; stop(true) }
 
-        Mongrel.log(:notice, &quot;Signals ready.  TERM =&gt; stop.  USR2 =&gt; restart.  INT =&gt; stop (no restart).&quot;)
+        log &quot;Signals ready.  TERM =&gt; stop.  USR2 =&gt; restart.  INT =&gt; stop (no restart).&quot;
       else
-        Mongrel.log(:notice, &quot;Signals ready.  INT =&gt; stop (no restart).&quot;)
+        log &quot;Signals ready.  INT =&gt; stop (no restart).&quot;
       end
     end
 
-  end
+    # Logs a simple message to STDERR (or the mongrel log if in daemon mode).
+    def log(msg)
+      STDERR.print &quot;** &quot;, msg, &quot;\n&quot;
+    end
 
+  end
 end</diff>
      <filename>lib/mongrel/configurator.rb</filename>
    </modified>
    <modified>
      <diff>@@ -65,13 +65,10 @@ module Mongrel
     REQUEST_URI='REQUEST_URI'.freeze
     REQUEST_PATH='REQUEST_PATH'.freeze
 
-    MONGREL_VERSION=&quot;1.2&quot;.freeze
+    MONGREL_VERSION=&quot;1.1.5&quot;.freeze
 
     MONGREL_TMP_BASE=&quot;mongrel&quot;.freeze
 
-    # A standard 400 response for a request which generates a http parse exception
-    ERROR_400_RESPONSE=&quot;HTTP/1.1 400 Bad Request\r\nConnection: close\r\nServer: Mongrel #{MONGREL_VERSION}\r\n\r\nBAD REQUEST&quot;.freeze
-
     # The standard empty 404 response for bad requests.  Use Error4040Handler for custom stuff.
     ERROR_404_RESPONSE=&quot;HTTP/1.1 404 Not Found\r\nConnection: close\r\nServer: Mongrel #{MONGREL_VERSION}\r\n\r\nNOT FOUND&quot;.freeze
 
@@ -110,5 +107,4 @@ module Mongrel
     REDIRECT = &quot;HTTP/1.1 302 Found\r\nLocation: %s\r\nConnection: close\r\n\r\n&quot;.freeze
     HOST = &quot;HOST&quot;.freeze
   end
-
-end
+end
\ No newline at end of file</diff>
      <filename>lib/mongrel/const.rb</filename>
    </modified>
    <modified>
      <diff>@@ -16,7 +16,7 @@ module MongrelDbg
   def MongrelDbg::configure(log_dir = File.join(&quot;log&quot;,&quot;mongrel_debug&quot;))
     FileUtils.mkdir_p(log_dir)
     @log_dir = log_dir
-    $objects_out = open(File.join(&quot;log&quot;,&quot;mongrel_debug&quot;,&quot;objects.log&quot;),&quot;w&quot;)
+    $objects_out=open(File.join(&quot;log&quot;,&quot;mongrel_debug&quot;,&quot;objects.log&quot;),&quot;w&quot;)
     $objects_out.puts &quot;run,classname,last,count,delta,lenmean,lensd,lenmax&quot;
     $objects_out.sync = true
     $last_stat = nil
@@ -35,12 +35,12 @@ module MongrelDbg
     if not LOGGING[target]
       LOGGING[target] = Logger.new(File.join(@log_dir, &quot;#{target.to_s}.log&quot;))
     end                          
-    MongrelDbg::trace(target, &quot;#{Time.now.httpdate}: TRACING ON&quot;)
+    MongrelDbg::trace(target, &quot;TRACING ON #{Time.now}&quot;)
   end
 
   def MongrelDbg::end_trace(target)
     SETTINGS[:tracing][target] = false
-    MongrelDbg::trace(target, &quot;#{Time.now.httpdate}: TRACING OFF&quot;)
+    MongrelDbg::trace(target, &quot;TRACING OFF #{Time.now}&quot;)
     LOGGING[target].close
     LOGGING[target] = nil
   end
@@ -86,17 +86,20 @@ module Kernel
     end
     MongrelDbg::trace(:files, open_counts.to_yaml)
   end
-end
+end  
+
 
 
 module RequestLog
 
+  # Just logs whatever requests it gets to STDERR (which ends up in the mongrel
+  # log when daemonized).
   class Access &lt; GemPlugin::Plugin &quot;/handlers&quot;
     include Mongrel::HttpHandlerPlugin
     
     def process(request,response)
       p = request.params
-      Mongrel.log(&quot;#{p['REMOTE_ADDR']} \&quot;#{p['REQUEST_METHOD']} #{p[&quot;REQUEST_URI&quot;]} HTTP/1.1\&quot;&quot;)
+      STDERR.puts &quot;#{p['REMOTE_ADDR']} - [#{Time.now.httpdate}] \&quot;#{p['REQUEST_METHOD']} #{p[&quot;REQUEST_URI&quot;]} HTTP/1.1\&quot;&quot;
     end
   end
   
@@ -105,13 +108,12 @@ module RequestLog
     include Mongrel::HttpHandlerPlugin
     
     def process(request, response)
-      MongrelDbg::trace(:files, &quot;#{Time.now.httpdate}: FILES OPEN BEFORE REQUEST #{request.params['PATH_INFO']}&quot;)
+      MongrelDbg::trace(:files, &quot;#{Time.now} FILES OPEN BEFORE REQUEST #{request.params['PATH_INFO']}&quot;)
       log_open_files
     end
     
   end
 
-
   # stolen from Robert Klemme
   class Objects &lt; GemPlugin::Plugin &quot;/handlers&quot;
     include Mongrel::HttpHandlerPlugin
@@ -123,7 +125,7 @@ module RequestLog
         begin
           ObjectSpace.each_object do |o| 
             begin
-              if o.respond_to?(:length)
+              if o.respond_to? :length
                 len = o.length
                 lengths[o.class] ||= Mongrel::Stats.new(o.class)
                 lengths[o.class].sample(len)
@@ -152,28 +154,26 @@ module RequestLog
         $run_count += 1
         $last_stat = stats
       rescue Object
-        STDERR.puts &quot;#{Time.now.httpdate}: object.log ERROR: #$!&quot;
+        STDERR.puts &quot;object.log ERROR: #$!&quot;
       end
     end
   end
 
-
   class Params &lt; GemPlugin::Plugin &quot;/handlers&quot;
     include Mongrel::HttpHandlerPlugin
 
     def process(request, response)
-      MongrelDbg::trace(:rails, &quot;#{Time.now.httpdate}: REQUEST #{request.params['PATH_INFO']}&quot;)
+      MongrelDbg::trace(:rails, &quot;#{Time.now} REQUEST #{request.params['PATH_INFO']}&quot;)
       MongrelDbg::trace(:rails, request.params.to_yaml)
     end
 
   end
 
-
   class Threads &lt; GemPlugin::Plugin &quot;/handlers&quot;
     include Mongrel::HttpHandlerPlugin
 
     def process(request, response)
-      MongrelDbg::trace(:threads, &quot;#{Time.now.httpdate}: REQUEST #{request.params['PATH_INFO']}&quot;)
+      MongrelDbg::trace(:threads, &quot;#{Time.now} REQUEST #{request.params['PATH_INFO']}&quot;)
       begin
         ObjectSpace.each_object do |obj|
           begin
@@ -185,7 +185,7 @@ module RequestLog
                 worker_list.each {|t| keys &lt;&lt; &quot;\n\t\t-- #{t}: #{t.keys.inspect}&quot; }
               end
   
-              MongrelDbg::trace(:threads, &quot;#{Time.now.httpdate}: #{obj.host}:#{obj.port} -- THREADS: #{worker_list.length} #{keys}&quot;)
+              MongrelDbg::trace(:threads, &quot;#{obj.host}:#{obj.port} -- THREADS: #{worker_list.length} #{keys}&quot;)
             end
           rescue Object # Ignore since obj.class can sometimes take parameters            
           end
@@ -198,6 +198,6 @@ end
 
 
 END {
-  MongrelDbg::trace(:files, &quot;#{Time.now.httpdate}: FILES OPEN AT EXIT&quot;)
+  MongrelDbg::trace(:files, &quot;FILES OPEN AT EXIT&quot;)
   log_open_files
 }</diff>
      <filename>lib/mongrel/debug.rb</filename>
    </modified>
    <modified>
      <diff>@@ -19,4 +19,4 @@ module Mongrel
       
     end    
   end
-end
+end
\ No newline at end of file</diff>
      <filename>lib/mongrel/gems.rb</filename>
    </modified>
    <modified>
      <diff>@@ -8,7 +8,6 @@ require 'mongrel/stats'
 require 'zlib'
 require 'yaml'
 
-
 module Mongrel
 
   # You implement your application handler with this.  It's very light giving
@@ -102,7 +101,8 @@ module Mongrel
   #
   # If you pass nil as the root path, it will not check any locations or
   # expand any paths. This lets you serve files from multiple drives
-  # on win32.
+  # on win32. It should probably not be used in a public-facing way
+  # without additional checks.
   #
   # The default content type is &quot;text/plain; charset=ISO-8859-1&quot; but you
   # can change it anything you want using the DirHandler.default_content_type
@@ -120,7 +120,7 @@ module Mongrel
     # You give it the path to the directory root and and optional listing_allowed and index_html
     def initialize(path, listing_allowed=true, index_html=&quot;index.html&quot;)
       @path = File.expand_path(path) if path
-      @listing_allowed=listing_allowed
+      @listing_allowed = listing_allowed
       @index_html = index_html
       @default_content_type = &quot;application/octet-stream&quot;.freeze
     end
@@ -132,12 +132,8 @@ module Mongrel
       # Add the drive letter or root path
       req_path = File.join(@path, req_path) if @path
       req_path = File.expand_path req_path
-     
-      # do not remove the check for @path at the beginning, it's what prevents
-      # the serving of arbitrary files (and good programmer Rule #1 Says: If
-      # you don't understand something, it's not because I'm stupid, it's
-      # because you are).
-      if req_path.index(@path) == 0 and File.exist? req_path
+      
+      if File.exist? req_path and (!@path or req_path.index(@path) == 0)
         # It exists and it's in the right location
         if File.directory? req_path
           # The request is for a directory
@@ -157,7 +153,7 @@ module Mongrel
           return req_path
         end
       else
-        # does not exist or isn't in the right spot or isn't valid because not start with @path
+        # does not exist or isn't in the right spot
         return nil
       end
     end
@@ -209,11 +205,11 @@ module Mongrel
       # test to see if this is a conditional request, and test if
       # the response would be identical to the last response
       same_response = case
-                      when modified_since &amp;&amp; !last_response_time = Time.httpdate(modified_since) rescue nil then false
-                      when modified_since &amp;&amp; last_response_time &gt; Time.now                                  then false
-                      when modified_since &amp;&amp; mtime &gt; last_response_time                                     then false
-                      when none_match     &amp;&amp; none_match == '*'                                              then false
-                      when none_match     &amp;&amp; !none_match.strip.split(/\s*,\s*/).include?(etag)              then false
+                      when modified_since &amp;&amp; !last_response_time = Time.httpdate(modified_since) rescue nil : false
+                      when modified_since &amp;&amp; last_response_time &gt; Time.now                                  : false
+                      when modified_since &amp;&amp; mtime &gt; last_response_time                                     : false
+                      when none_match     &amp;&amp; none_match == '*'                                              : false
+                      when none_match     &amp;&amp; !none_match.strip.split(/\s*,\s*/).include?(etag)              : false
                       else modified_since || none_match  # validation successful if we get this far and at least one of the header exists
                       end
 
@@ -270,7 +266,7 @@ module Mongrel
             response.start(403) {|head,out| out.write(ONLY_HEAD_GET) }
           end
         rescue =&gt; details
-          STDERR.puts &quot;#{Time.now.httpdate}: Error sending file #{req_path}: #{details}&quot;
+          STDERR.puts &quot;Error sending file #{req_path}: #{details}&quot;
         end
       end
     end</diff>
      <filename>lib/mongrel/handlers.rb</filename>
    </modified>
    <modified>
      <diff>@@ -89,7 +89,7 @@ module Mongrel
           update_request_progress(remain, total)
         end
       rescue Object =&gt; e
-        STDERR.puts &quot;#{Time.now.httpdate}: Error reading HTTP body: #{e.inspect}&quot;
+        STDERR.puts &quot;#{Time.now}: Error reading HTTP body: #{e.inspect}&quot;
         STDERR.puts e.backtrace.join(&quot;\n&quot;)
         # any errors means we should delete the file, including if the file is dumped
         @socket.close rescue nil
@@ -102,14 +102,14 @@ module Mongrel
       if !@socket.closed?
         data = @socket.read(len)
         if !data
-          raise &quot;#{Time.now.httpdate}: Socket read return nil&quot;
+          raise &quot;Socket read return nil&quot;
         elsif data.length != len
-          raise &quot;#{Time.now.httpdate}: Socket read returned insufficient data: #{data.length}&quot;
+          raise &quot;Socket read returned insufficient data: #{data.length}&quot;
         else
           data
         end
       else
-        raise &quot;#{Time.now.httpdate}: Socket already closed when reading.&quot;
+        raise &quot;Socket already closed when reading.&quot;
       end
     end
 </diff>
      <filename>lib/mongrel/http_request.rb</filename>
    </modified>
    <modified>
      <diff>@@ -71,9 +71,9 @@ module Mongrel
     # sent the header or the body.  This is pretty catastrophic actually.
     def reset
       if @body_sent
-        raise &quot;#{Time.now.httpdate}: You have already sent the request body.&quot;
+        raise &quot;You have already sent the request body.&quot;
       elsif @header_sent
-        raise &quot;#{Time.now.httpdate}: You have already sent the request headers.&quot;
+        raise &quot;You have already sent the request headers.&quot;
       else
         @header.out.truncate(0)
         @body.close</diff>
      <filename>lib/mongrel/http_response.rb</filename>
    </modified>
    <modified>
      <diff>@@ -82,7 +82,7 @@ module Mongrel
           rescue Errno::EPIPE
             response.socket.close
           rescue Object =&gt; rails_error
-            STDERR.puts &quot;#{Time.now.httpdate}: Error calling Dispatcher.dispatch #{rails_error.inspect}&quot;
+            STDERR.puts &quot;#{Time.now}: Error calling Dispatcher.dispatch #{rails_error.inspect}&quot;
             STDERR.puts rails_error.backtrace.join(&quot;\n&quot;)
           end
         end
@@ -161,9 +161,9 @@ module Mongrel
           raise &quot;Rails was not configured.  Read the docs for RailsConfigurator.&quot;
         end
 
-        Mongrel.log(&quot;Reloading Rails...&quot;)
+        log &quot;Reloading Rails...&quot;
         @rails_handler.reload!
-        Mongrel.log(&quot;Done reloading Rails.&quot;)
+        log &quot;Done reloading Rails.&quot;
 
       end
 
@@ -173,11 +173,11 @@ module Mongrel
         ops = resolve_defaults(options)
         setup_signals(options)
 
-        unless RUBY_PLATFORM =~ /djgpp|(cyg|ms|bcc)win|mingw/
+        if RUBY_PLATFORM !~ /mswin/
           # rails reload
-          trap(&quot;HUP&quot;) { Mongrel.log(&quot;HUP signal received.&quot;); reload! }
+          trap(&quot;HUP&quot;) { log &quot;HUP signal received.&quot;; reload!          }
 
-          Mongrel.log(&quot;Rails signals registered.  HUP =&gt; reload (without restart).  It might not work well.&quot;)
+          log &quot;Rails signals registered.  HUP =&gt; reload (without restart).  It might not work well.&quot;
         end
       end
     end</diff>
      <filename>lib/mongrel/rails.rb</filename>
    </modified>
    <modified>
      <diff>@@ -10,7 +10,7 @@ include Mongrel
 
 class ConditionalResponseTest &lt; Test::Unit::TestCase
   def setup
-    @server = HttpServer.new('127.0.0.1', process_based_port)
+    @server = HttpServer.new('127.0.0.1', 3501)
     @server.register('/', Mongrel::DirHandler.new('.'))
     @server.run
     </diff>
      <filename>test/test_conditional.rb</filename>
    </modified>
    <modified>
      <diff>@@ -29,12 +29,11 @@ end
 class ConfiguratorTest &lt; Test::Unit::TestCase
 
   def test_base_handler_config
-    port = process_based_port
     @config = nil
 
     redirect_test_io do
       @config = Mongrel::Configurator.new :host =&gt; &quot;localhost&quot; do
-        listener :port =&gt; port do
+        listener :port =&gt; 4501 do
           # 2 in front should run, but the sentinel shouldn't since dirhandler processes the request
           uri &quot;/&quot;, :handler =&gt; plugin(&quot;/handlers/testplugin&quot;)
           uri &quot;/&quot;, :handler =&gt; plugin(&quot;/handlers/testplugin&quot;)
@@ -65,12 +64,12 @@ class ConfiguratorTest &lt; Test::Unit::TestCase
       assert listener.classifier.uris.include?(&quot;/test&quot;), &quot;/test not registered&quot;
     end
 
-    res = Net::HTTP.get(URI.parse(&quot;http://localhost:#{port}/test&quot;))
+    res = Net::HTTP.get(URI.parse('http://localhost:4501/test'))
     assert res != nil, &quot;Didn't get a response&quot;
     assert $test_plugin_fired == 3, &quot;Test filter plugin didn't run 3 times.&quot;
 
     redirect_test_io do
-      res = Net::HTTP.get(URI.parse(&quot;http://localhost:#{port}/&quot;))
+      res = Net::HTTP.get(URI.parse('http://localhost:4501/'))
 
       assert res != nil, &quot;Didn't get a response&quot;
       assert $test_plugin_fired == 6, &quot;Test filter plugin didn't run 6 times.&quot;
@@ -81,7 +80,7 @@ class ConfiguratorTest &lt; Test::Unit::TestCase
     end
 
     assert_raise Errno::EBADF, Errno::ECONNREFUSED do
-      res = Net::HTTP.get(URI.parse(&quot;http://localhost:#{port}/&quot;))
+      res = Net::HTTP.get(URI.parse(&quot;http://localhost:4501/&quot;))
     end
   end
 </diff>
      <filename>test/test_configurator.rb</filename>
    </modified>
    <modified>
      <diff>@@ -35,9 +35,8 @@ class HandlersTest &lt; Test::Unit::TestCase
 
   def setup
     stats = Mongrel::StatisticsFilter.new(:sample_rate =&gt; 1)
-    @port = process_based_port
-    
-    @config = Mongrel::Configurator.new :host =&gt; '127.0.0.1', :port =&gt; @port do
+
+    @config = Mongrel::Configurator.new :host =&gt; '127.0.0.1', :port =&gt; 9998 do
       listener do
         uri &quot;/&quot;, :handler =&gt; SimpleHandler.new
         uri &quot;/&quot;, :handler =&gt; stats
@@ -50,31 +49,51 @@ class HandlersTest &lt; Test::Unit::TestCase
         uri &quot;/relative&quot;, :handler =&gt; Mongrel::DirHandler.new(nil, listing_allowed=false, index_html=&quot;none&quot;)
       end
     end
+    
+    File.open(&quot;/tmp/testfile&quot;, 'w') do
+      # Do nothing
+    end
+    
     @config.run
   end
 
   def teardown
     @config.stop(false, true)
+    File.delete &quot;/tmp/testfile&quot;
   end
 
   def test_more_web_server
-    res = hit([ &quot;http://localhost:#{@port}/test&quot;,
-          &quot;http://localhost:#{@port}/dumb&quot;,
-          &quot;http://localhost:#{@port}/404&quot;,
-          &quot;http://localhost:#{@port}/files/rdoc/index.html&quot;,
-          &quot;http://localhost:#{@port}/files/rdoc/nothere.html&quot;,
-          &quot;http://localhost:#{@port}/files/rdoc/&quot;,
-          &quot;http://localhost:#{@port}/files_nodir/rdoc/&quot;,
-          &quot;http://localhost:#{@port}/status&quot;,
+    res = hit([ &quot;http://localhost:9998/test&quot;,
+          &quot;http://localhost:9998/dumb&quot;,
+          &quot;http://localhost:9998/404&quot;,
+          &quot;http://localhost:9998/files/rdoc/index.html&quot;,
+          &quot;http://localhost:9998/files/rdoc/nothere.html&quot;,
+          &quot;http://localhost:9998/files/rdoc/&quot;,
+          &quot;http://localhost:9998/files_nodir/rdoc/&quot;,
+          &quot;http://localhost:9998/status&quot;,
     ])
-
-    # XXX This can't possibly have good coverage.
     check_status res, String
   end
+  
+  def test_nil_dirhandler
+    # Camping uses this internally
+    handler = Mongrel::DirHandler.new(nil, false)  
+    assert handler.can_serve(&quot;/tmp/testfile&quot;)
+    # Not a bug! A nil @file parameter is the only circumstance under which
+    # we are allowed to serve any existing file
+    assert handler.can_serve(&quot;../../../../../../../../../../tmp/testfile&quot;)
+  end
+  
+  def test_non_nil_dirhandler_is_not_vulnerable_to_path_traversal
+    # The famous security bug of Mongrel 1.1.2
+    handler = Mongrel::DirHandler.new(&quot;/doc&quot;, false)
+    assert_nil handler.can_serve(&quot;/tmp/testfile&quot;)
+    assert_nil handler.can_serve(&quot;../../../../../../../../../../tmp/testfile&quot;)
+  end
 
   def test_deflate
-    Net::HTTP.start(&quot;localhost&quot;, @port) do |h|
-      # test that no accept-encoding returns a non-deflated response
+    Net::HTTP.start(&quot;localhost&quot;, 9998) do |h|
+      # Test that no accept-encoding returns a non-deflated response
       req = h.get(&quot;/dumb&quot;)
       assert(
         !req['Content-Encoding'] ||
@@ -98,7 +117,7 @@ class HandlersTest &lt; Test::Unit::TestCase
   #end
 
   def test_unregister
-    @config.listeners[&quot;127.0.0.1:#{@port}&quot;].unregister(&quot;/&quot;)
+    @config.listeners[&quot;127.0.0.1:9998&quot;].unregister(&quot;/&quot;)
   end
 end
 </diff>
      <filename>test/test_handlers.rb</filename>
    </modified>
    <modified>
      <diff>@@ -42,7 +42,6 @@ class HttpParserTest &lt; Test::Unit::TestCase
     assert_equal should_be_good.length, nread
     assert parser.finished?
     assert !parser.error?
-    assert_equal &quot;++++++++++&quot;, req[&quot;HTTP_AAAAAAAAAAAAA&quot;]
 
     nasty_pound_header = &quot;GET / HTTP/1.1\r\nX-SSL-Bullshit:   -----BEGIN CERTIFICATE-----\r\n\tMIIFbTCCBFWgAwIBAgICH4cwDQYJKoZIhvcNAQEFBQAwcDELMAkGA1UEBhMCVUsx\r\n\tETAPBgNVBAoTCGVTY2llbmNlMRIwEAYDVQQLEwlBdXRob3JpdHkxCzAJBgNVBAMT\r\n\tAkNBMS0wKwYJKoZIhvcNAQkBFh5jYS1vcGVyYXRvckBncmlkLXN1cHBvcnQuYWMu\r\n\tdWswHhcNMDYwNzI3MTQxMzI4WhcNMDcwNzI3MTQxMzI4WjBbMQswCQYDVQQGEwJV\r\n\tSzERMA8GA1UEChMIZVNjaWVuY2UxEzARBgNVBAsTCk1hbmNoZXN0ZXIxCzAJBgNV\r\n\tBAcTmrsogriqMWLAk1DMRcwFQYDVQQDEw5taWNoYWVsIHBhcmQYJKoZIhvcNAQEB\r\n\tBQADggEPADCCAQoCggEBANPEQBgl1IaKdSS1TbhF3hEXSl72G9J+WC/1R64fAcEF\r\n\tW51rEyFYiIeZGx/BVzwXbeBoNUK41OK65sxGuflMo5gLflbwJtHBRIEKAfVVp3YR\r\n\tgW7cMA/s/XKgL1GEC7rQw8lIZT8RApukCGqOVHSi/F1SiFlPDxuDfmdiNzL31+sL\r\n\t0iwHDdNkGjy5pyBSB8Y79dsSJtCW/iaLB0/n8Sj7HgvvZJ7x0fr+RQjYOUUfrePP\r\n\tu2MSpFyf+9BbC/aXgaZuiCvSR+8Snv3xApQY+fULK/xY8h8Ua51iXoQ5jrgu2SqR\r\n\twgA7BUi3G8LFzMBl8FRCDYGUDy7M6QaHXx1ZWIPWNKsCAwEAAaOCAiQwggIgMAwG\r\n\tA1UdEwEB/wQCMAAwEQYJYIZIAYb4QgEBBAQDAgWgMA4GA1UdDwEB/wQEAwID6DAs\r\n\tBglghkgBhvhCAQ0EHxYdVUsgZS1TY2llbmNlIFVzZXIgQ2VydGlmaWNhdGUwHQYD\r\n\tVR0OBBYEFDTt/sf9PeMaZDHkUIldrDYMNTBZMIGaBgNVHSMEgZIwgY+AFAI4qxGj\r\n\tloCLDdMVKwiljjDastqooXSkcjBwMQswCQYDVQQGEwJVSzERMA8GA1UEChMIZVNj\r\n\taWVuY2UxEjAQBgNVBAsTCUF1dGhvcml0eTELMAkGA1UEAxMCQ0ExLTArBgkqhkiG\r\n\t9w0BCQEWHmNhLW9wZXJhdG9yQGdyaWQtc3VwcG9ydC5hYy51a4IBADApBgNVHRIE\r\n\tIjAggR5jYS1vcGVyYXRvckBncmlkLXN1cHBvcnQuYWMudWswGQYDVR0gBBIwEDAO\r\n\tBgwrBgEEAdkvAQEBAQYwPQYJYIZIAYb4QgEEBDAWLmh0dHA6Ly9jYS5ncmlkLXN1\r\n\tcHBvcnQuYWMudmT4sopwqlBWsvcHViL2NybC9jYWNybC5jcmwwPQYJYIZIAYb4QgEDBDAWLmh0\r\n\tdHA6Ly9jYS5ncmlkLXN1cHBvcnQuYWMudWsvcHViL2NybC9jYWNybC5jcmwwPwYD\r\n\tVR0fBDgwNjA0oDKgMIYuaHR0cDovL2NhLmdyaWQt5hYy51ay9wdWIv\r\n\tY3JsL2NhY3JsLmNybDANBgkqhkiG9w0BAQUFAAOCAQEAS/U4iiooBENGW/Hwmmd3\r\n\tXCy6Zrt08YjKCzGNjorT98g8uGsqYjSxv/hmi0qlnlHs+k/3Iobc3LjS5AMYr5L8\r\n\tUO7OSkgFFlLHQyC9JzPfmLCAugvzEbyv4Olnsr8hbxF1MbKZoQxUZtMVu29wjfXk\r\n\thTeApBv7eaKCWpSp7MCbvgzm74izKhu3vlDk9w6qVrxePfGgpKPqfHiOoGhFnbTK\r\n\twTC6o2xq5y0qZ03JonF7OJspEd3I5zKY3E+ov7/ZhW6DqT8UFvsAdjvQbXyhV8Eu\r\n\tYhixw1aKEPzNjNowuIseVogKOLXxWI5vAi5HgXdS0/ES5gDGsABo4fqovUKlgop3\r\n\tRA==\r\n\t-----END CERTIFICATE-----\r\n\r\n&quot;
     parser = HttpParser.new
@@ -52,24 +51,6 @@ class HttpParserTest &lt; Test::Unit::TestCase
     #assert parser.finished?
     #assert !parser.error?
   end
-
-  def test_parse_ie6_urls
-    %w(/some/random/path&quot;
-       /some/random/path&gt;
-       /some/random/path&lt;
-       /we/love/you/ie6?q=&lt;&quot;&quot;&gt;
-       /url?&lt;=&quot;&amp;&gt;=&quot;
-       /mal&quot;formed&quot;?
-    ).each do |path|
-      parser = HttpParser.new
-      req = {}
-      sorta_safe = %(GET #{path} HTTP/1.1\r\n\r\n)
-      nread = parser.execute(req, sorta_safe, 0)
-      assert_equal sorta_safe.length, nread
-      assert parser.finished?
-      assert !parser.error?
-    end
-  end
   
   def test_parse_error
     parser = HttpParser.new
@@ -88,103 +69,6 @@ class HttpParserTest &lt; Test::Unit::TestCase
     assert parser.error?, &quot;Parser SHOULD have error&quot;
   end
 
-  def test_parse_like_optimized_header
-    parser = HttpParser.new
-    req = {}
-    should_be_good = &quot;GET / HTTP/1.1\r\nAuthorizationn: zz\r\n\r\n&quot;
-    nread = parser.execute(req, should_be_good, 0)
-    assert_equal should_be_good.length, nread
-    assert parser.finished?
-    assert !parser.error?
-    assert_equal &quot;zz&quot;, req[&quot;HTTP_AUTHORIZATIONN&quot;]
-    assert ! req[&quot;HTTP_AUTHORIZATION&quot;]
-  end
-
-  def test_parse_twin_lookalike_optimized_headers
-    parser = HttpParser.new
-    req = {}
-    should_be_good = &quot;GET / HTTP/1.1\r\n&quot; \
-                     &quot;Accept-Encoding: abcdef\r\n&quot; \
-                     &quot;Accept-Language: zyxvut\r\n&quot; \
-                     &quot;\r\n&quot;
-    nread = parser.execute(req, should_be_good, 0)
-    assert_equal should_be_good.length, nread
-    assert parser.finished?
-    assert !parser.error?
-    assert_equal &quot;abcdef&quot;, req[&quot;HTTP_ACCEPT_ENCODING&quot;]
-    assert_equal &quot;zyxvut&quot;, req[&quot;HTTP_ACCEPT_LANGUAGE&quot;]
-  end
-
-  if RUBY_PLATFORM !~ /java/
-    # as of now, the Java version does not have the same global-object
-    # reuse optimization the C version does
-
-    def test_parse_optimized_headers_global_objects_used
-      parser = HttpParser.new
-      req = {}
-      should_be_good = &quot;GET / HTTP/1.1\r\nHost: example.com\r\n\r\n&quot;
-      nread = parser.execute(req, should_be_good, 0)
-      assert_equal should_be_good.length, nread
-      assert parser.finished?
-      assert !parser.error?
-      assert_equal &quot;example.com&quot;, req[&quot;HTTP_HOST&quot;]
-
-      frozen_host_a = nil
-      req.each { |k,v| k == &quot;HTTP_HOST&quot; &amp;&amp; frozen_host_a = k }
-
-      parser = HttpParser.new
-      req = {}
-      should_be_good = &quot;GET / HTTP/1.1\r\nHost: example.com\r\n\r\n&quot;
-      nread = parser.execute(req, should_be_good, 0)
-      assert_equal should_be_good.length, nread
-      assert parser.finished?
-      assert !parser.error?
-
-      frozen_host_b = nil
-      req.each { |k,v| k == &quot;HTTP_HOST&quot; &amp;&amp; frozen_host_b = k }
-      assert_equal &quot;HTTP_HOST&quot;, frozen_host_a
-      assert_equal &quot;HTTP_HOST&quot;, frozen_host_b
-      assert_equal frozen_host_a.object_id, frozen_host_b.object_id
-    end
-  end
-
-  def test_host_port_parsing
-    parser = HttpParser.new
-    req = {}
-    should_be_good = &quot;GET / HTTP/1.1\r\nHost: example.com\r\n\r\n&quot;
-    nread = parser.execute(req, should_be_good, 0)
-    assert_equal should_be_good.length, nread
-    assert parser.finished?
-    assert !parser.error?
-    assert_equal &quot;example.com&quot;, req[&quot;HTTP_HOST&quot;]
-    assert_equal &quot;example.com&quot;, req[&quot;SERVER_NAME&quot;]
-    assert_equal &quot;80&quot;, req[&quot;SERVER_PORT&quot;]
-
-    parser = HttpParser.new
-    req = {}
-    should_be_good = &quot;GET / HTTP/1.1\r\nHost: example.com:123\r\n\r\n&quot;
-    nread = parser.execute(req, should_be_good, 0)
-    assert_equal should_be_good.length, nread
-    assert parser.finished?
-    assert !parser.error?
-    assert_equal &quot;example.com:123&quot;, req[&quot;HTTP_HOST&quot;]
-    assert_equal &quot;example.com&quot;, req[&quot;SERVER_NAME&quot;]
-    assert_equal &quot;123&quot;, req[&quot;SERVER_PORT&quot;]
-
-    # null character in domain name is never actually valid, but if it
-    # becomes valid in Web 3.0, we'll be ready for it.
-    parser = HttpParser.new
-    req = {}
-    should_be_good = &quot;GET / HTTP/1.1\r\nHost: example.com\0:123\r\n\r\n&quot;
-    nread = parser.execute(req, should_be_good, 0)
-    assert_equal should_be_good.length, nread
-    assert parser.finished?
-    assert !parser.error?
-    assert_equal &quot;example.com\0:123&quot;, req[&quot;HTTP_HOST&quot;]
-    assert_equal &quot;example.com\0&quot;, req[&quot;SERVER_NAME&quot;]
-    assert_equal &quot;123&quot;, req[&quot;SERVER_PORT&quot;]
-  end
-
   def test_fragment_in_uri
     parser = HttpParser.new
     req = {}</diff>
      <filename>test/test_http11.rb</filename>
    </modified>
    <modified>
      <diff>@@ -10,10 +10,10 @@ class RedirectHandlerTest &lt; Test::Unit::TestCase
 
   def setup
     redirect_test_io do
-      @server = Mongrel::HttpServer.new('127.0.0.1', process_based_port)
+      @server = Mongrel::HttpServer.new('127.0.0.1', 9998)
     end
     @server.run
-    @client = Net::HTTP.new('127.0.0.1', process_based_port)
+    @client = Net::HTTP.new('127.0.0.1', 9998)
   end
 
   def teardown</diff>
      <filename>test/test_redirect_handler.rb</filename>
    </modified>
    <modified>
      <diff>@@ -38,9 +38,8 @@ end
 
 class RequestProgressTest &lt; Test::Unit::TestCase
   def setup
-    @port = process_based_port
     redirect_test_io do
-      @server = Mongrel::HttpServer.new(&quot;127.0.0.1&quot;, @port)
+      @server = Mongrel::HttpServer.new(&quot;127.0.0.1&quot;, 9998)
     end
     @handler = UploadBeginHandler.new
     @server.register(&quot;/upload&quot;, @handler)
@@ -52,7 +51,7 @@ class RequestProgressTest &lt; Test::Unit::TestCase
   end
 
   def test_begin_end_progress
-    Net::HTTP.get(&quot;localhost&quot;, &quot;/upload&quot;, @port)
+    Net::HTTP.get(&quot;localhost&quot;, &quot;/upload&quot;, 9998)
     assert @handler.request_began
     assert @handler.request_progressed
     assert @handler.request_processed
@@ -63,7 +62,7 @@ class RequestProgressTest &lt; Test::Unit::TestCase
     handlers.each { |h| h.reset }
 
     # make the call
-    Net::HTTP.get(&quot;localhost&quot;, &quot;/upload&quot;, @port)
+    Net::HTTP.get(&quot;localhost&quot;, &quot;/upload&quot;, 9998)
 
     # assert that each one was fired
     handlers.each { |h|
@@ -89,7 +88,7 @@ class RequestProgressTest &lt; Test::Unit::TestCase
     # remove handlers to make sure they've all gone away
     @server.unregister(&quot;/upload&quot;)
     handlers.each { |h| h.reset }
-    Net::HTTP.get(&quot;localhost&quot;, &quot;/upload&quot;, @port)
+    Net::HTTP.get(&quot;localhost&quot;, &quot;/upload&quot;, 9998)
     handlers.each { |h|
       assert !h.request_began &amp;&amp; !h.request_progressed &amp;&amp; !h.request_processed
     }</diff>
      <filename>test/test_request_progress.rb</filename>
    </modified>
    <modified>
      <diff>@@ -21,12 +21,11 @@ end
 class WebServerTest &lt; Test::Unit::TestCase
 
   def setup
-    @port = process_based_port
     @valid_request = &quot;GET / HTTP/1.1\r\nHost: www.zedshaw.com\r\nContent-Type: text/plain\r\n\r\n&quot;
     
     redirect_test_io do
       # We set num_processors=1 so that we can test the reaping code
-      @server = HttpServer.new(&quot;127.0.0.1&quot;, @port, num_processors=1)
+      @server = HttpServer.new(&quot;127.0.0.1&quot;, 9998, num_processors=1)
     end
     
     @tester = TestHandler.new
@@ -43,14 +42,14 @@ class WebServerTest &lt; Test::Unit::TestCase
   end
 
   def test_simple_server
-    hit([&quot;http://localhost:#{@port}/test&quot;])
+    hit(['http://localhost:9998/test'])
     assert @tester.ran_test, &quot;Handler didn't really run&quot;
   end
 
 
   def do_test(string, chunk, close_after=nil, shutdown_delay=0)
     # Do not use instance variables here, because it needs to be thread safe
-    socket = TCPSocket.new(&quot;127.0.0.1&quot;, @port);
+    socket = TCPSocket.new(&quot;127.0.0.1&quot;, 9998);
     request = StringIO.new(string)
     chunks_out = 0
 
@@ -95,7 +94,7 @@ class WebServerTest &lt; Test::Unit::TestCase
 
   def test_num_processors_overload
     redirect_test_io do
-      assert_raises Errno::ECONNRESET, Errno::EPIPE, Errno::ECONNABORTED, Errno::EINVAL do
+      assert_raises Errno::ECONNRESET, Errno::EPIPE, Errno::ECONNABORTED, Errno::EINVAL, IOError do
         tests = [
           Thread.new { do_test(@valid_request, 1) },
           Thread.new { do_test(@valid_request, 10) },</diff>
      <filename>test/test_ws.rb</filename>
    </modified>
    <modified>
      <diff>@@ -64,11 +64,3 @@ def hit(uris)
 
   return results
 end
-
-# process_based_port provides a port number, usable for TCP and UDP 
-# connections based on $$ and with a 5000 as base.
-# this is required if you perform several builds of mongrel in parallel
-# (like continuous integration systems)
-def process_based_port
-  5000 + $$ % 1000
-end
\ No newline at end of file</diff>
      <filename>test/testhelp.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>74290abc9ebd287542b2dcc0133fa41d33e5177b</id>
    </parent>
  </parents>
  <author>
    <name>Patrick Hurley</name>
    <email>phurley@gmail.com</email>
  </author>
  <url>http://github.com/pivotal/mongrel/commit/38a0ee0856a278edca79f9ab49a4b3b6cd5cbe0f</url>
  <id>38a0ee0856a278edca79f9ab49a4b3b6cd5cbe0f</id>
  <committed-date>2009-08-16T20:33:12-07:00</committed-date>
  <authored-date>2009-08-16T20:33:12-07:00</authored-date>
  <message>sync up with 1.1.5 gem</message>
  <tree>e2127882dcc0667aed3b8f1149eae3512301be67</tree>
  <committer>
    <name>Patrick Hurley</name>
    <email>phurley@gmail.com</email>
  </committer>
</commit>
