<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -47,14 +47,14 @@ static int unhex[] = {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1
 #define CURRENT (parser-&gt;current_request)
 #define CONTENT_LENGTH (parser-&gt;current_request-&gt;content_length)
 #define CALLBACK(FOR)                               \
-  if(parser-&gt;FOR##_mark &amp;&amp; CURRENT-&gt;on_##FOR) {     \
+  if(CURRENT &amp;&amp; parser-&gt;FOR##_mark &amp;&amp; CURRENT-&gt;on_##FOR) {     \
     CURRENT-&gt;on_##FOR( CURRENT                      \
                 , parser-&gt;FOR##_mark                \
                 , p - parser-&gt;FOR##_mark            \
                 );                                  \
  }
 #define HEADER_CALLBACK(FOR)                        \
-  if(parser-&gt;FOR##_mark &amp;&amp; CURRENT-&gt;on_##FOR) {     \
+  if(CURRENT &amp;&amp; parser-&gt;FOR##_mark &amp;&amp; CURRENT-&gt;on_##FOR) {     \
     CURRENT-&gt;on_##FOR( CURRENT                      \
                 , parser-&gt;FOR##_mark                \
                 , p - parser-&gt;FOR##_mark            \
@@ -62,7 +62,7 @@ static int unhex[] = {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1
                 );                                  \
  }
 #define END_REQUEST                        \
-    if(CURRENT-&gt;on_complete)               \
+    if(CURRENT &amp;&amp; CURRENT-&gt;on_complete)               \
       CURRENT-&gt;on_complete(CURRENT);       \
     CURRENT = NULL;
 
@@ -108,18 +108,20 @@ static int unhex[] = {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1
   }
 
   action content_length {
-    CURRENT-&gt;content_length *= 10;
-    CURRENT-&gt;content_length += *p - '0';
+    if(CURRENT){
+      CURRENT-&gt;content_length *= 10;
+      CURRENT-&gt;content_length += *p - '0';
+    }
   }
 
-  action use_identity_encoding { CURRENT-&gt;transfer_encoding = EBB_IDENTITY; }
-  action use_chunked_encoding { CURRENT-&gt;transfer_encoding = EBB_CHUNKED; }
+  action use_identity_encoding { if(CURRENT) CURRENT-&gt;transfer_encoding = EBB_IDENTITY; }
+  action use_chunked_encoding { if(CURRENT) CURRENT-&gt;transfer_encoding = EBB_CHUNKED; }
 
-  action set_keep_alive { CURRENT-&gt;keep_alive = TRUE; }
-  action set_not_keep_alive { CURRENT-&gt;keep_alive = FALSE; }
+  action set_keep_alive { if(CURRENT) CURRENT-&gt;keep_alive = TRUE; }
+  action set_not_keep_alive { if(CURRENT) CURRENT-&gt;keep_alive = FALSE; }
 
   action expect_continue {
-    CURRENT-&gt;expect_continue = TRUE;
+    if(CURRENT) CURRENT-&gt;expect_continue = TRUE;
   }
 
   action trailer {
@@ -127,21 +129,25 @@ static int unhex[] = {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1
   }
 
   action version_major {
-    CURRENT-&gt;version_major *= 10;
-    CURRENT-&gt;version_major += *p - '0';
+    if(CURRENT) {
+      CURRENT-&gt;version_major *= 10;
+      CURRENT-&gt;version_major += *p - '0';
+    }
   }
 
   action version_minor {
-    CURRENT-&gt;version_minor *= 10;
-    CURRENT-&gt;version_minor += *p - '0';
+  	if(CURRENT) {
+      CURRENT-&gt;version_minor *= 10;
+      CURRENT-&gt;version_minor += *p - '0';
+    }
   }
 
   action end_header_line {
-    CURRENT-&gt;number_of_headers++;
+    if(CURRENT) CURRENT-&gt;number_of_headers++;
   }
 
   action end_headers {
-    if(CURRENT-&gt;on_headers_complete)
+    if(CURRENT &amp;&amp; CURRENT-&gt;on_headers_complete)
       CURRENT-&gt;on_headers_complete(CURRENT);
   }
 
@@ -171,17 +177,19 @@ static int unhex[] = {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1
   }
 
   action body_logic {
-    if(CURRENT-&gt;transfer_encoding == EBB_CHUNKED) {
-      fnext ChunkedBody;
-    } else {
-      /* this is pretty stupid. i'd prefer to combine this with skip_chunk_data */
-      parser-&gt;chunk_size = CURRENT-&gt;content_length;
-      p += 1;  
-      skip_body(&amp;p, parser, MIN(REMAINING, CURRENT-&gt;content_length));
-      fhold;
-      if(parser-&gt;chunk_size &gt; REMAINING) {
-        fbreak;
-      } 
+    if(CURRENT) { 
+      if(CURRENT-&gt;transfer_encoding == EBB_CHUNKED) {
+        fnext ChunkedBody;
+      } else {
+        /* this is pretty stupid. i'd prefer to combine this with skip_chunk_data */
+        parser-&gt;chunk_size = CURRENT-&gt;content_length;
+        p += 1;  
+        skip_body(&amp;p, parser, MIN(REMAINING, CURRENT-&gt;content_length));
+        fhold;
+        if(parser-&gt;chunk_size &gt; REMAINING) {
+          fbreak;
+        } 
+      }
     }
   }
 
@@ -217,20 +225,20 @@ static int unhex[] = {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1
 
 #  headers
 
-  Method = ( &quot;COPY&quot;      %{ CURRENT-&gt;method = EBB_COPY;      }
-           | &quot;DELETE&quot;    %{ CURRENT-&gt;method = EBB_DELETE;    }
-           | &quot;GET&quot;       %{ CURRENT-&gt;method = EBB_GET;       }
-           | &quot;HEAD&quot;      %{ CURRENT-&gt;method = EBB_HEAD;      }
-           | &quot;LOCK&quot;      %{ CURRENT-&gt;method = EBB_LOCK;      }
-           | &quot;MKCOL&quot;     %{ CURRENT-&gt;method = EBB_MKCOL;     }
-           | &quot;MOVE&quot;      %{ CURRENT-&gt;method = EBB_MOVE;      }
-           | &quot;OPTIONS&quot;   %{ CURRENT-&gt;method = EBB_OPTIONS;   }
-           | &quot;POST&quot;      %{ CURRENT-&gt;method = EBB_POST;      }
-           | &quot;PROPFIND&quot;  %{ CURRENT-&gt;method = EBB_PROPFIND;  }
-           | &quot;PROPPATCH&quot; %{ CURRENT-&gt;method = EBB_PROPPATCH; }
-           | &quot;PUT&quot;       %{ CURRENT-&gt;method = EBB_PUT;       }
-           | &quot;TRACE&quot;     %{ CURRENT-&gt;method = EBB_TRACE;     }
-           | &quot;UNLOCK&quot;    %{ CURRENT-&gt;method = EBB_UNLOCK;    }
+  Method = ( &quot;COPY&quot;      %{ if(CURRENT) CURRENT-&gt;method = EBB_COPY;      }
+           | &quot;DELETE&quot;    %{ if(CURRENT) CURRENT-&gt;method = EBB_DELETE;    }
+           | &quot;GET&quot;       %{ if(CURRENT) CURRENT-&gt;method = EBB_GET;       }
+           | &quot;HEAD&quot;      %{ if(CURRENT) CURRENT-&gt;method = EBB_HEAD;      }
+           | &quot;LOCK&quot;      %{ if(CURRENT) CURRENT-&gt;method = EBB_LOCK;      }
+           | &quot;MKCOL&quot;     %{ if(CURRENT) CURRENT-&gt;method = EBB_MKCOL;     }
+           | &quot;MOVE&quot;      %{ if(CURRENT) CURRENT-&gt;method = EBB_MOVE;      }
+           | &quot;OPTIONS&quot;   %{ if(CURRENT) CURRENT-&gt;method = EBB_OPTIONS;   }
+           | &quot;POST&quot;      %{ if(CURRENT) CURRENT-&gt;method = EBB_POST;      }
+           | &quot;PROPFIND&quot;  %{ if(CURRENT) CURRENT-&gt;method = EBB_PROPFIND;  }
+           | &quot;PROPPATCH&quot; %{ if(CURRENT) CURRENT-&gt;method = EBB_PROPPATCH; }
+           | &quot;PUT&quot;       %{ if(CURRENT) CURRENT-&gt;method = EBB_PUT;       }
+           | &quot;TRACE&quot;     %{ if(CURRENT) CURRENT-&gt;method = EBB_TRACE;     }
+           | &quot;UNLOCK&quot;    %{ if(CURRENT) CURRENT-&gt;method = EBB_UNLOCK;    }
            ); # Not allowing extension methods
 
   HTTP_Version = &quot;HTTP/&quot; digit+ $version_major &quot;.&quot; digit+ $version_minor;
@@ -292,15 +300,15 @@ static int unhex[] = {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1
 
 static void
 skip_body(const char **p, ebb_request_parser *parser, size_t nskip) {
-  if(CURRENT-&gt;on_body &amp;&amp; nskip &gt; 0) {
+  if(CURRENT &amp;&amp; CURRENT-&gt;on_body &amp;&amp; nskip &gt; 0) {
     CURRENT-&gt;on_body(CURRENT, *p, nskip);
   }
-  CURRENT-&gt;body_read += nskip;
+  if(CURRENT) CURRENT-&gt;body_read += nskip;
   parser-&gt;chunk_size -= nskip;
   *p += nskip;
   if(0 == parser-&gt;chunk_size) {
     parser-&gt;eating = FALSE;
-    if(CURRENT-&gt;transfer_encoding == EBB_IDENTITY) {
+    if(CURRENT &amp;&amp; CURRENT-&gt;transfer_encoding == EBB_IDENTITY) {
       END_REQUEST;
     }
   } else {</diff>
      <filename>ebb_request_parser.rl</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>7fb1c5d28cfe6920f1eb46cd3beacceb1b5522e4</id>
    </parent>
  </parents>
  <author>
    <name>dharmarth</name>
    <email>dharmarth.shah@impetus.co.in</email>
  </author>
  <url>http://github.com/ry/libebb/commit/af381bff8591675cd01e6d0d4e799d3185e9bef9</url>
  <id>af381bff8591675cd01e6d0d4e799d3185e9bef9</id>
  <committed-date>2009-05-28T06:48:42-07:00</committed-date>
  <authored-date>2009-05-28T06:48:42-07:00</authored-date>
  <message>Null check for CURRENT(i.e. parser-&gt;current_request).</message>
  <tree>135afb825d25f971c96e4fd1a1fa070bdba081c5</tree>
  <committer>
    <name>dharmarth</name>
    <email>dharmarth.shah@impetus.co.in</email>
  </committer>
</commit>
