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

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
}
----

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

···

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.

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.