Skip to content

Instantly share code, notes, and snippets.

@nicklegr
Created October 7, 2017 06:18
Show Gist options
  • Save nicklegr/b55035f9c7aaef4788c3fe3b308cadb4 to your computer and use it in GitHub Desktop.
Save nicklegr/b55035f9c7aaef4788c3fe3b308cadb4 to your computer and use it in GitHub Desktop.
def encode(str)
str
.gsub(" ", "%20")
.gsub("\n", "%0d%0a")
end
cmd = "curl gopher://example.com:80/_" + encode(<<-EOD)
GET / HTTP/1.1
Host: example.com
EOD
puts cmd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment