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.
10 * RFC2616-compliant Ragel+C parser adapted from Mongrel
12 * decodes chunked response bodies with an optional pass-through mode
13 (to avoid rechunking with Rack::Chunked)
15 * handles odd things like trailers and multiline headers
17 * streaming interface for response bodies allows for incremental
18 processing of arbitrarily large responses.
20 * supported under Ruby 1.9 and later.
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 https://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://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 * https://bogomips.org/kcar.git
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 public mailing list: mailto:kcar-public@bogomips.org
87 All mail is archived publically at: https://bogomips.org/kcar-public/
88 and nntp://news.public-inbox.org/inbox.comp.lang.ruby.kcar
90 Anonymous posts will always be welcome.
92 No subscription is necessary to post to the mailing list;
93 but you may subscribe by sending a plain-text mail to:
95 mailto:kcar-public+subscribe@bogomips.org
97 Keep in mind we suck at delivering email, so using NNTP or
98 Atom feeds might be a better bet.
99 Please remember to Cc: all recipients as subscription is optional.