• Stars
    star
    339
  • Rank 124,632 (Top 3 %)
  • Language
    Ruby
  • Created over 14 years ago
  • Updated 3 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Thread-safe persistent connections with Net::HTTP

net-http-persistent¶ ↑

home

github.com/drbrain/net-http-persistent

rdoc

rdoc.info/gems/net-http-persistent

DESCRIPTION:¶ ↑

Manages persistent connections using Net::HTTP including a thread pool for connecting to multiple hosts.

Using persistent HTTP connections can dramatically increase the speed of HTTP. Creating a new HTTP connection for every request involves an extra TCP round-trip and causes TCP congestion avoidance negotiation to start over.

Net::HTTP supports persistent connections with some API methods but does not make setting up a single persistent connection or managing multiple connections easy. Net::HTTP::Persistent wraps Net::HTTP and allows you to focus on how to make HTTP requests.

FEATURES/PROBLEMS:¶ ↑

  • Supports TLS with secure defaults

  • Thread-safe

  • Pure ruby

SYNOPSIS¶ ↑

The following example will make two requests to the same server. The connection is kept alive between requests:

require 'net/http/persistent'

uri = URI 'http://example.com/awesome/web/service'

http = Net::HTTP::Persistent.new name: 'my_app_name'

# perform a GET
response = http.request uri

# create a POST
post_uri = uri + 'create'
post = Net::HTTP::Post.new post_uri.path
post.set_form_data 'some' => 'cool data'

# perform the POST, the URI is always required
response = http.request post_uri, post

# if you are done making http requests, or won't make requests for several
# minutes
http.shutdown

Please see the documentation on Net::HTTP::Persistent for more information, including SSL connection verification, header handling and tunable options.

INSTALL:¶ ↑

gem install net-http-persistent

LICENSE:¶ ↑

(The MIT License)

Copyright © Eric Hodel, Aaron Patterson

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ‘Software’), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED ‘AS IS’, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

More Repositories

1

meme

Generate memes from http://memegenerator.net
Ruby
206
star
2

ruby-growl

Pure-Ruby Growl Notifier
Ruby
48
star
3

net-http-pipeline

An HTTP/1.1 pipelining implementation atop Net::HTTP
Ruby
42
star
4

ruby-bluetooth

A Linux, OS X and Windows ruby bluetooth wrapper
Objective-C
40
star
5

strace_me

strace a block of ruby code
Ruby
35
star
6

net-http-digest_auth

An implementation of RFC 2617 Digest Access Authentication
Ruby
27
star
7

pasteboard

An OS X Pasteboard wrapper
Ruby
25
star
8

indigo-powerview

Hunter Douglas PowerView plugin for Indigo home automation software
Python
23
star
9

opengl

The official repository of the ruby-opengl wrapper
C
20
star
10

drbdump

A tcpdump-like protocol analyzer tool for DRb traffic
Ruby
12
star
11

marshal-structure

Dump the structure of a Marshal Object
Ruby
10
star
12

capp

A ruby libpcap wrapper that is GVL-friendly
C
10
star
13

drb-worm

A worm that spreads itself via DRb and forms its own private network.
Ruby
9
star
14

ruby-mruby

MRuby embedded in Ruby
C
7
star
15

nu_plugin_prometheus

A nushell plugin for querying prometheus
Rust
5
star
16

temperature_monitor

Wireless Arduino Temperature Monitor
Ruby
4
star
17

hoe-travis

A Hoe plugin that allows your gem to gain maximum benefit from http://travis-ci.org
Ruby
4
star
18

cast

Make abstract syntax trees out of C code and save the world.
Ruby
4
star
19

return_bang

return_bang implements non-local exits from methods
Ruby
4
star
20

curses-pad

curses newpad() support for ruby 1.9
Ruby
4
star
21

launch

A ruby wrapper for the launch(3) API for daemons and agents spawned by launchd(8)
C
3
star
22

nushell-config

Nushell configuration files
Nushell
3
star
23

RingyDingy

RingyDingy is a little boat that keeps your DRb service afloat!
Ruby
2
star
24

vimrc

Lua
2
star
25

gem-tldr

Are your gems taking up too much disk space? Documentation got you down? Comments stuck in your craw? Tests taking too much space? Fix all that by with gem tldr
Ruby
2
star
26

fancy_require

Perform fancy requiring by adding a custom object to the load path.
Ruby
2
star
27

compute-combine-requests

Rust
1
star
28

daikin_exporter

Prometheus exporter for Daikin ComfortControl HVAC units
Rust
1
star
29

where_am_i

Rust
1
star
30

flume_water_exporter

An exporter for the Flume Smart Home Water Monitor
Rust
1
star
31

SEAnoise

Ruby
1
star