Project

rbkb-http

0.0
No commit activity in last 3 years
No release in over 3 years
HTTP libraries and tools based on and complementary to Ruby BlackBag
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 0

Runtime

>= 0
 Project Readme

rbkb-http¶ ↑

HTTP protocol addons for the Ruby BlackBag (rbkb-http)

DESCRIPTION¶ ↑

This library includes HTTP protocol tools and libraries based on and complementary to the Ruby BlackBag library.

At it’s core rbkb-http is simply a set of serializable and desieralizable objects for HTTP request and response messages.

REQUIREMENTS¶ ↑

SYNOPSIS¶ ↑

require 'rubygems'
require 'rbkb/http'

# we start with a raw HTTP request string
rawdat = "POST /foo HTTP/1.0
Content-Length: 10

a=12345678"

# ... which we parse into an abstract object
req = Rbkb::Http::Request.new()
req.capture(rawdat) 

# Or you could just say this in one shot
#req = Rbkb::Http::Request.parse(rawdat)

# now we can mess with the request body
req.body << "extrastuff"

# .. and/or action line
req.action.version="HTTP/1.1"

# ... and/or headers
req.headers.set_header("Host", "somehost.com")

# and spit out a new request string (content-length is auto-calculated!)
puts req.to_raw
-/snip-

Which produces:

POST /foo HTTP/1.1
Content-Length: 20
Host: somehost.com

a=12345678extrastuff

Copyright © 2009 Eric Monti. See LICENSE for details.