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

  • Home
  • SEARCH
  • 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 6089131
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T12:03:55+00:00 2026-05-23T12:03:55+00:00

I have the following code: http = Net::HTTP.new(www.something.com, 80) http.set_debug_output($stdout) http.post(/blah, something, {‘random-parameter’ =>

  • 0

I have the following code:

    http = Net::HTTP.new("www.something.com", 80)
    http.set_debug_output($stdout)
    http.post("/blah", "something", {'random-parameter' => 'value1="something",value2="somethingelse"'})

Then when I read the output from stdout, it looks like this:

<- "POST /blah HTTP/1.1\r\nAccept: */*\r\nContent-Type: application/x-www-form-urlencoded\r\nConnection: close\r\nrandom-parameter: value1=\"something\",value2=\"somethingelse\"\r\nContent-Length: 9\r\nHost: www.something.com\r\n\r\n"
<- "something"

with the quotes being escaped. The problem is that the slashes seem to be sent to the server, which doesn’t like that. I’m getting an error that says

Unknown value for random-parameter in header: {value1=\\\"something\\\"value2=\\\"somethingelse\\\"}

So my question is, is there a way to tell Net::HTTP to not insert those slashes, or strip them out before sending the header?

Clarifications:

I’m using Ruby 1.8.7 with Rails 2.0.2.

I think it may be Rails that is escaping the characters, but I’m not sure how to make it stop.

  • 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-05-23T12:03:56+00:00Added an answer on May 23, 2026 at 12:03 pm

    Are you sure you’re building up the header correctly? Net::HTTP does not quote quotes when sending the request. You can easily verify it by using for example netcat (nc):

    Terminal 1:

    > nc -v -l -p 2323
    

    Terminal 2 (in irb):

    > http = Net::HTTP.new("localhost", 2323)
    > http.post("/blah", "something", {'random-parameter' => ... )
    

    Result (in terminal 1):

    listening on [any] 2323 ...
    connect to [127.0.0.1] from localhost [127.0.0.1] 37598
    POST /blah HTTP/1.1
    Connection: close
    Accept: */*
    Random-Parameter: value1="something",value2="somethingelse"
    Content-Type: application/x-www-form-urlencoded
    Content-Length: 9
    Host: localhost:2323
    
    something
    

    I think what you actually may want to do (not sure, but I’m guessing) is something more along the lines of the HTTP spec:

    > http.post("/blah", "something", {
        'random-parameter' => 'value1="something"; value2="somethingelse"' })
    

    Rails is probably interpreting your first value1=… as the whole value..when you probably need to separate the values with ‘;’, not ‘,’.

    Also note that you don’t usually pass parameters through request headers. But maybe that’s what you want to do in this case(?) Otherwise you should either pass the parameters in the URL itself like param1=foo&param2=bar, or use x-www-form-urlencoded to pass the parameters.

    See here for a cheat sheet:
    http://www.rubyinside.com/nethttp-cheat-sheet-2940.html

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following code: http://www.nomorepasting.com/getpaste.php?pasteid=22615 Which is called by the javascript mentioned in
I have to following code: http://www.nomorepasting.com/getpaste.php?pasteid=22987 If PHPSESSID is not already in the table
I have the following code: $bind = new COM(LDAP://CN=GroupName,OU=Groups,OU=Division,DC=company,DC=local); When I execute it from
I have the following code var postData = ; var req = HttpWebRequest.Create(http://www.imageshack.us/upload_api.php); req.ContentType
I am following http://www.mikesdotnetting.com/Article/125/ASP.NET-MVC-Uploading-and-Downloading-Files . Using VS2010, ASP.NET 4.0, MVC3 in C# with ADO.NET
Hey all. I have the following code: http://jsfiddle.net/g7Cgg/ As you can see, there are
I am trying to hit the following web service with axis2: http://www.webservicex.net/geoipservice.asmx?WSDL I have
I Have following code: Controller: public ActionResult Step1() { return View(); } [AcceptVerbs(HttpVerbs.Post)] public
I have the following code: String inputFile = somefile.txt; FileInputStream in = new FileInputStream(inputFile);
I have the following code for use in my asp.net website: CalendarService service =

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.