Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8277409
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T08:41:08+00:00 2026-06-08T08:41:08+00:00

A script of mine submits an HTTP request, but I’d like to send the

  • 0

A script of mine submits an HTTP request, but I’d like to send the raw HTTP request to an associate for troubleshooting. Is there a way I can output the raw HTTP request to a file?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T08:41:09+00:00Added an answer on June 8, 2026 at 8:41 am

    If you’re using Net::HTTP, use #set_debug_output:

    1.9.3p194 :017 > http = Net::HTTP.new('google.com')
     => #<Net::HTTP google.com:80 open=false> 
    1.9.3p194 :018 > http.request_get('/')
     => #<Net::HTTPMovedPermanently 301 Moved Permanently readbody=true> 
    1.9.3p194 :019 > http.set_debug_output($stdout)
     => #<IO:<STDOUT>> 
    1.9.3p194 :020 > http.request_get('/')
    opening connection to google.com...
    opened
    <- "GET / HTTP/1.1\r\nAccept: */*\r\nUser-Agent: Ruby\r\nConnection: close\r\nHost: google.com\r\n\r\n"
    -> "HTTP/1.1 301 Moved Permanently\r\n"
    -> "Location: http://www.google.com/\r\n"
    -> "Content-Type: text/html; charset=UTF-8\r\n"
    -> "Date: Mon, 23 Jul 2012 21:41:13 GMT\r\n"
    -> "Expires: Wed, 22 Aug 2012 21:41:13 GMT\r\n"
    -> "Cache-Control: public, max-age=2592000\r\n"
    -> "Server: gws\r\n"
    -> "Content-Length: 219\r\n"
    -> "X-XSS-Protection: 1; mode=block\r\n"
    -> "X-Frame-Options: SAMEORIGIN\r\n"
    -> "Connection: close\r\n"
    -> "\r\n"
    reading 219 bytes...
    -> "<HTML><HEAD><meta http-equiv=\"content-type\" content=\"text/html;charset=utf-8\">\n<TITLE>301 Moved</TITLE></HEAD><BODY>\n<H1>301 Moved</H1>\nThe document has moved\n<A HREF=\"http://www.google.com/\">here</A>.\r\n</BODY></HTML>\r\n"
    read 219 bytes
    Conn close
     => #<Net::HTTPMovedPermanently 301 Moved Permanently readbody=true> 
    

    Or with HTTParty, use the :debug_output option:

    1.9.3p194 :028 > HTTParty.get('http://www.google.com', :debug_output => $stdout)
    opening connection to www.google.com...
    opened
    <- "GET / HTTP/1.1\r\nConnection: close\r\nHost: www.google.com\r\n\r\n"
    -> "HTTP/1.1 200 OK\r\n"
    -> "Date: Mon, 23 Jul 2012 21:42:55 GMT\r\n"
    -> "Expires: -1\r\n"
    -> "Cache-Control: private, max-age=0\r\n"
    -> "Content-Type: text/html; charset=ISO-8859-1\r\n"
    -> "Set-Cookie: expires=; expires=Mon, 01-Jan-1990 00:00:00 GMT; path=/; domain=www.google.com\r\n"
    -> "Set-Cookie: path=; expires=Mon, 01-Jan-1990 00:00:00 GMT; path=/; domain=www.google.com\r\n"
    -> "Set-Cookie: domain=; expires=Mon, 01-Jan-1990 00:00:00 GMT; path=/; domain=www.google.com\r\n"
    -> "Set-Cookie: expires=; expires=Mon, 01-Jan-1990 00:00:00 GMT; path=/; domain=.www.google.com\r\n"
    -> "Set-Cookie: path=; expires=Mon, 01-Jan-1990 00:00:00 GMT; path=/; domain=.www.google.com\r\n"
    -> "Set-Cookie: domain=; expires=Mon, 01-Jan-1990 00:00:00 GMT; path=/; domain=.www.google.com\r\n"
    -> "Set-Cookie: expires=; expires=Mon, 01-Jan-1990 00:00:00 GMT; path=/; domain=google.com\r\n"
    -> "Set-Cookie: path=; expires=Mon, 01-Jan-1990 00:00:00 GMT; path=/; domain=google.com\r\n"
    -> "Set-Cookie: domain=; expires=Mon, 01-Jan-1990 00:00:00 GMT; path=/; domain=google.com\r\n"
    -> "Set-Cookie: expires=; expires=Mon, 01-Jan-1990 00:00:00 GMT; path=/; domain=.google.com\r\n"
    -> "Set-Cookie: path=; expires=Mon, 01-Jan-1990 00:00:00 GMT; path=/; domain=.google.com\r\n"
    -> "Set-Cookie: domain=; expires=Mon, 01-Jan-1990 00:00:00 GMT; path=/; domain=.google.com\r\n"
    -> "Set-Cookie: PREF=ID=bf7ea711fb78b88f:FF=0:TM=1343079775:LM=1343079775:S=sitzmIr74uTXkzTt; expires=Wed, 23-Jul-2014 21:42:55 GMT; path=/; domain=.google.com\r\n"
    -> "Set-Cookie: NID=62=i-gpt9kPmB80W787ganAdeSSc502sPHOT5bwpddGHTbVtAB5-oDjjaJtQAN7znbEk70RkuHDui5sJOlZrXB0MzfIKtpU2x7vRDj3vFQch6BRcqQaVmzm_J7OzAIOpB5H; expires=Tue, 22-Jan-2013 21:42:55 GMT; path=/; domain=.google.com; HttpOnly\r\n"
    -> "P3P: CP=\"This is not a P3P policy! See http://www.google.com/support/accounts/bin/answer.py?hl=en&answer=151657 for more info.\"\r\n"
    -> "Server: gws\r\n"
    -> "X-XSS-Protection: 1; mode=block\r\n"
    -> "X-Frame-Options: SAMEORIGIN\r\n"
    -> "Connection: close\r\n"
    -> "\r\n"
    reading all...
    # ... snip ...
    

    At this point, you can copy that output, or you can replace $stdout with any IO instance, like a File:

    1.9.3p194 :034 > File.open('/tmp/http.out', 'w') {|f| http.set_debug_output(f); http.get('/')}
     => #<Net::HTTPMovedPermanently 301 Moved Permanently readbody=true> 
    1.9.3p194 :035 > File.read('/tmp/http.out')
     => "opening connection to google.com...\nopened\n<- "GET / HTTP/1.1\\r\\nAccept-Encoding: gzip;q=1.0,deflate;q=0.6,identity;q=0.3\\r\\nAccept: */*\\r\\nUser-Agent: Ruby\\r\\nConnection: close\\r\\nHost: google.com\\r\\n\\r\\n"\n-> "HTTP/1.1 301 Moved Permanently\\r\\n"\n-> "Location: http://www.google.com/\\r\\n"\n-> "Content-Type: text/html; charset=UTF-8\\r\\n"\n-> "Date: Mon, 23 Jul 2012 21:46:02 GMT\\r\\n"\n-> "Expires: Wed, 22 Aug 2012 21:46:02 GMT\\r\\n"\n-> "Cache-Control: public, max-age=2592000\\r\\n"\n-> "Server: gws\\r\\n"\n-> "Content-Length: 219\\r\\n"\n-> "X-XSS-Protection: 1; mode=block\\r\\n"\n-> "X-Frame-Options: SAMEORIGIN\\r\\n"\n-> "Connection: close\\r\\n"\n-> "\\r\\n"\nreading 219 bytes...\n-> "<HTML><HEAD><meta http-equiv=\\"content-type\\" content=\\"text/html;charset=utf-8\\">\\n<TITLE>301 Moved</TITLE></HEAD><BODY>\\n<H1>301 Moved</H1>\\nThe document has moved\\n<A HREF=\\"http://www.google.com/\\">here</A>.\\r\\n</BODY></HTML>\\r\\n"\nread 219 bytes\nConn close\n"
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This script of mine has a function, which is not working the way, I
I've been trying to debug a script of mine and I can't get my
This next challenge of mine involves jqtransform which can be found here http://www.dfc-e.com/metiers/multimedia/opensource/jqtransform/ I
Here's a snippet of a script of mine attempting to put extra Unicode awesomeness
Script: http://keith-wood.name/countdown.htm Daily json response: items: { fajr: '5:23 am', sharooq: '7:23 am', dhur:
My script works seemed to be working perfectly well, but Eclipse 3.7.2 was telling
The script below works fine if 3 and 3.2 are not links but i
I am using livevalidation script on my contact form.But i dont know what is
I wanted to share here a useful script of mine. I am developing some
there's any bad thing getting timer in accordion script i'm using because when it

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.