http.post() problem only when using base64-encoded data

Discussion in 'Ruby' started by Randy Lawrence, Jul 4, 2004.

  1. I'm able to do a simple http.post() but when the data I'm posting is
    more complex than a simple string, I get a "permission denied" Apache error.

    One possibility is that encoding the data with base64 can result in
    having '=' characters. I'd really appreciate it if anyone can provide
    some tips on how I can successfully http.post() more complex strings
    without resorting to file uploads.

    Here's the script I'm using (it fails only when somedata is assigned a
    complex string such as base64-encoded rsa signature):

    ----
    require 'net/http'
    somedata = 'hello'

    Net::HTTP.start( 'www.somedomainxyz123.com', 80 ) {|http|
    response = http.post( '/ruby/testpost.rbx',
    "foo=#{somedata}" )
    puts response.body
    }
    ----
     
    Randy Lawrence, Jul 4, 2004
    #1
    1. Advertising

  2. Randy Lawrence

    Patrick May Guest

    On Sunday, July 4, 2004, at 04:04 PM, Randy Lawrence wrote:

    > I'm able to do a simple http.post() but when the data I'm posting is
    > more complex than a simple string, I get a "permission denied" Apache
    > error.


    What are you running on the server? It looks to me like 'cgi' or
    whatever you are running to decode the post is having trouble creating
    a temp file.

    That's a guess.

    Cheers,

    Patrick
     
    Patrick May, Jul 4, 2004
    #2
    1. Advertising

  3. Randy Lawrence wrote:

    > I'm able to do a simple http.post() but when the data I'm posting is
    > more complex than a simple string, I get a "permission denied" Apache
    > error.
    >
    > One possibility is that encoding the data with base64 can result in
    > having '=' characters. I'd really appreciate it if anyone can provide
    > some tips on how I can successfully http.post() more complex strings
    > without resorting to file uploads.
    >
    > Here's the script I'm using (it fails only when somedata is assigned a
    > complex string such as base64-encoded rsa signature):
    >
    > ----
    > require 'net/http'
    > somedata = 'hello'
    >
    > Net::HTTP.start( 'www.somedomainxyz123.com', 80 ) {|http|
    > response = http.post( '/ruby/testpost.rbx',
    > "foo=#{somedata}" )
    > puts response.body
    > }
    > ----
    >


    Problem solved.

    It turned out to be web server security settings forbidding character
    values outside of 32-126 range. The base64 encoding was including
    carriage returns (10) which triggered the error.
     
    Randy Lawrence, Jul 4, 2004
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Mr. T

    decode base64 encoded login info

    Mr. T, Mar 5, 2007, in forum: ASP .Net
    Replies:
    1
    Views:
    524
    Patrice
    Mar 5, 2007
  2. Phil C.
    Replies:
    2
    Views:
    452
    Phil C.
    Jul 19, 2005
  3. Mr. T

    decode base64 encoded login info

    Mr. T, Mar 5, 2007, in forum: ASP .Net Security
    Replies:
    0
    Views:
    180
    Mr. T
    Mar 5, 2007
  4. Michael

    Base64-Encoded URL in ASP

    Michael, Feb 23, 2004, in forum: ASP General
    Replies:
    1
    Views:
    326
    Chris Barber
    Feb 24, 2004
  5. Randy Lawrence
    Replies:
    0
    Views:
    288
    Randy Lawrence
    Jul 4, 2004
Loading...

Share This Page