     if bufString.indexOf('\r\n\r\n') is -1
       return
     req = parseRequest bufString
+    if not req?
+      console.warn "error: request can't be parsed: #{bufString}"
+      c.buf = null
+      return
     req.rawbody = c.buf[req.headerBytes+4..]
     req.socket = c
     if req.headers['content-length']?

    console.log()
    return
  req = parseRequest decodedRequest
  console.log "===request (decoded)==="
  process.stdout.write decodedRequest
  console.log "============="

    continue if /^\s*$/.test line
    params = line.split ": "
    headers[params[0].toLowerCase()] = params[1]

  try
    decodedURI = decodeURIComponent uri
  catch e
    console.log "error: failed to decode URI: #{uri}"
    return null

  return {
    method: method
    uri: decodedURI
    protocol: protocol
    headers: headers
    body: body
    headerBytes: headerPart.length  # TODO
  }
