Kcar Parser ParserError Response

kcar - bytestream to Rack response converter

kcar features an HTTP parser that will convert a bytestream into a 3-element array suitable for use as a Rack response. It is IO interface agnostic, so it may be used with HTTP streams over Unix domain sockets, regular files, FIFOs, StringIOs as well as traditional TCP sockets.




If you're using a packaged Ruby distribution, make sure you have a C compiler and the matching Ruby development libraries and headers.

If you use RubyGems:

gem install kcar

Otherwise grab the latest tarball from:

Unpack it, and run "ruby setup.rb"


While you can use the Kcar::Parser directly, you'll usually want the higher-level interface of Kcar::Response:

require 'rack' # for Rack::Utils::HeaderHash, which is optional
require 'socket' # for TCPSocket
require 'kcar'
sock ='', 80)
sock.write("GET / HTTP/1.0\r\n\r\n")

# instead of a Rack::Utils::HeaderHash object below, you can also
# pass a regular Hash or Array object.
response =,
status, headers, body = response.rack

You can now do further processing on the status, headers, or iterate through the body with body.each.


You can get the latest source via git from the following locations:

git:// (mirror)

You may browse the code from the web and download the latest snapshot tarballs here:

Inline patches (from "git format-patch") to the mailing list are preferred because they allow code review and comments in the reply to the patch.

We will adhere to mostly the same conventions for patch submissions as git itself. See the Documentation/SubmittingPatches document distributed with git on on patch submission guidelines to follow. Just don't email the git mailing list or maintainer with kcar patches.


All feedback (bug reports, user/development discussion, patches, pull requests) go to the mailing list:

Mailing list archives are available here:

We love to hear from you!
Email patches (using git send-email), pull requests (formatted using git request-pull), questions, bug reports, suggestions, etc. to us publically at:
Mail archives are available at:
Please send plain-text email only and do not waste bandwidth on HTML mail, HTML mail will not be read.
Quote as little as reasonable and do not top post.
For sensitive topics, email us privately at: