summaryrefslogtreecommitdiff
path: root/trunk/sample/dualstack-fetch.rb
diff options
context:
space:
mode:
authoryugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-08-25 15:13:14 +0000
committeryugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-08-25 15:13:14 +0000
commitd0233291bc8a5068e52c69c210e5979e5324b5bc (patch)
tree7d9459449c33792c63eeb7baa071e76352e0baab /trunk/sample/dualstack-fetch.rb
parent0dc342de848a642ecce8db697b8fecd83a63e117 (diff)
parent72eaacaa15256ab95c3b52ea386f88586fb9da40 (diff)
re-adding tag v1_9_0_4 as an alias of trunk@18848v1_9_0_4
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/tags/v1_9_0_4@18849 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'trunk/sample/dualstack-fetch.rb')
-rw-r--r--trunk/sample/dualstack-fetch.rb48
1 files changed, 0 insertions, 48 deletions
diff --git a/trunk/sample/dualstack-fetch.rb b/trunk/sample/dualstack-fetch.rb
deleted file mode 100644
index 1897a3d8e9..0000000000
--- a/trunk/sample/dualstack-fetch.rb
+++ /dev/null
@@ -1,48 +0,0 @@
-# simple webpage fetcher
-
-# The code demonstrates how a multi-protocol client should be written.
-# TCPSocket is using getaddrinfo() internally, so there should be no problem.
-
-require "socket"
-
-if ARGV.size != 1
- STDERR.print "requires URL\n"
- exit
-end
-
-url = ARGV[0]
-if url !~ /^http:\/\/([^\/]+)(\/.*)$/
- STDERR.print "only http with full hostname is supported\n"
- exit
-end
-
-# split URL into host, port and path
-hostport = $1
-path = $2
-if (hostport =~ /^(.*):([0-9]+)$/)
- host = $1
- port = $2
-else
- host = hostport
- port = 80
-end
-if host =~ /^\[(.*)\]$/
- host = $1
-end
-
-#STDERR.print "url=<#{ARGV[0]}>\n"
-#STDERR.print "host=<#{host}>\n"
-#STDERR.print "port=<#{port}>\n"
-#STDERR.print "path=<#{path}>\n"
-
-STDERR.print "conntecting to #{host} port #{port}\n"
-c = TCPSocket.new(host, port)
-dest = Socket.getnameinfo(c.getpeername,
- Socket::NI_NUMERICHOST|Socket::NI_NUMERICSERV)
-STDERR.print "conntected to #{dest[0]} port #{dest[1]}\n"
-c.print "GET #{path} HTTP/1.0\n"
-c.print "Host: #{host}\n"
-c.print "\n"
-while c.gets
- print
-end