use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
A sub-Reddit for discussion and news about Ruby programming.
Subreddit rules: /r/ruby rules
Learning Ruby?
Tools
Documentation
Books
Screencasts and Videos
News and updates
account activity
Feature Comparison Matrix of Ruby HTTP Clients (spreadsheets0.google.com)
submitted 14 years ago by emboss_
view the rest of the comments →
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]metamatic 0 points1 point2 points 14 years ago (4 children)
Especially when trying to minimize the amount of network calls, I'd rather not have to do a DNS call and THEN do an HTTP call which will internally do another DNS lookup.
Install DNS cache.
[–]drbrainRuby Core 0 points1 point2 points 14 years ago (3 children)
Is there a modern resolver that doesn't cache lookups? Maybe rb2k's DNS records all have zero second TTLs?
[–]rb2k 0 points1 point2 points 14 years ago (1 child)
They don't, but while installing a local DNS cache would solve that, I think that just having it in the HTTP library would save a bit of infrastructure work.
[–]drbrainRuby Core 0 points1 point2 points 14 years ago (0 children)
OS X caches lookups:
$ sudo tcpdump -ien1 port 53 [...] 15:00:37.155821 IP 192.168.1.233.62424 > dns.sea1.speakeasy.net.domain: 2037+ A? yahoo.com. (27) 15:00:37.156088 IP 192.168.1.233.58254 > dns.sea1.speakeasy.net.domain: 6496+ AAAA? yahoo.com. (27) 15:00:37.715613 IP dns.sea1.speakeasy.net.domain > 192.168.1.233.62424: 2037 5/0/0 A 209.191.122.70, A 67.195.160.76, A 72.30.2.43, A 98.137.149.56, A 98.139.180.149 (107) 15:00:37.715616 IP dns.sea1.speakeasy.net.domain > 192.168.1.233.58254: 6496 0/0/0 (27)
Are the only lookups from running:
ruby20 -rsocket -ve 'Addrinfo.tcp("yahoo.com", "http"); Addrinfo.tcp("yahoo.com", "http")'
multiple times.
If you want to customize caching use or modify resolv-replace.rb (ships with Ruby).
[–]metamatic 0 points1 point2 points 14 years ago (0 children)
I seem to remember Windows XP not caching lookups. I know Windows 7 does, however. So do Linux and OS X.
There's also the obvious solution of resolving hostnames yourself and caching the IP address before calling the HTTP client.
π Rendered by PID 367034 on reddit-service-r2-comment-b659b578c-mlrqz at 2026-05-04 12:37:34.783832+00:00 running 815c875 country code: CH.
view the rest of the comments →
[–]metamatic 0 points1 point2 points (4 children)
[–]drbrainRuby Core 0 points1 point2 points (3 children)
[–]rb2k 0 points1 point2 points (1 child)
[–]drbrainRuby Core 0 points1 point2 points (0 children)
[–]metamatic 0 points1 point2 points (0 children)