Skip to content

Instantly share code, notes, and snippets.

@jakenotjacob
Created June 2, 2014 21:45
Show Gist options
  • Save jakenotjacob/211806c8917f3f1fb78b to your computer and use it in GitHub Desktop.
Save jakenotjacob/211806c8917f3f1fb78b to your computer and use it in GitHub Desktop.
Client used to test my HTTP server
#!/usr/bin/env ruby
#
require 'socket'
server, port, resource = ARGV
conn = TCPSocket.open server, port
conn.print("GET #{resource} HTTP/1.0\r\n\r\n")
response = conn.read
headers, body = response.split("\r\n\r\n", 2)
puts "---HEADERS---"
puts headers
puts "-------------"
puts "---BODY---"
puts body
puts "----------"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment