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

R

Randy Lawrence

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

Patrick May

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
 
R

Randy Lawrence

Randy said:
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.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,763
Messages
2,569,563
Members
45,039
Latest member
CasimiraVa

Latest Threads

Top