1 = kcar - bytestream to Rack response converter
3 kcar features an HTTP parser that will convert a bytestream into a
4 3-element array suitable for use as a Rack response. It is IO interface
5 agnostic, so it may be used with HTTP streams over Unix domain sockets,
6 regular files, FIFOs, StringIOs as well as traditional TCP sockets.
8 A drop-in, Net::HTTP-compatible interface is planned.
12 * RFC2616-compliant Ragel+C parser adapted from Unicorn and Mongrel
14 * decodes chunked response bodies with an optional pass-through mode
15 (to avoid rechunking with Rack::Chunked)
17 * handles odd things like trailers and multiline headers
19 * streaming interface for response bodies allows for incremental
20 processing of arbitrarily large responses.
24 * kcar is only lightly tested and is not yet aware of all quirks found in
25 all real (possibly broken) web servers.
29 If you're using a packaged Ruby distribution, make sure you have a C
30 compiler and the matching Ruby development libraries and headers.
36 Otherwise grab the latest tarball from:
38 http://bogomips.org/kcar/files/
40 Unpack it, and run "ruby setup.rb"
44 While you can use the Kcar::Parser directly, you'll usually want the
45 higher-level interface of Kcar::Response:
47 require 'rack' # for Rack::Utils::HeaderHash, which is optional
48 require 'socket' # for TCPSocket
50 sock = TCPSocket.new('example.com', 80)
51 sock.write("GET / HTTP/1.0\r\n\r\n")
53 # instead of a Rack::Utils::HeaderHash object below, you can also
54 # pass a regular Hash or Array object.
55 response = Kcar::Response.new(sock, Rack::Utils::HeaderHash.new)
56 status, headers, body = response.rack
58 You can now do further processing on the status, headers, or iterate
59 through the body with body.each.
63 You can get the latest source via git from the following locations:
65 git://git.bogomips.org/kcar.git
66 git://repo.or.cz/kcar.git (mirror)
68 You may browse the code from the web and download the latest snapshot
71 * http://git.bogomips.org/cgit/kcar.git (cgit)
72 * http://repo.or.cz/w/kcar.git (gitweb)
74 Inline patches (from "git format-patch") to the mailing list are
75 preferred because they allow code review and comments in the reply to
78 We will adhere to mostly the same conventions for patch submissions as
79 git itself. See the Documentation/SubmittingPatches document
80 distributed with git on on patch submission guidelines to follow. Just
81 don't email the git mailing list or maintainer with kcar patches.
85 All feedback (bug reports, user/development discussion, patches, pull
86 requests) go to the mailing list: mailto:kcar@librelist.com