curl-users
curl problem solved (was: 7.9.5)
Date: Tue, 08 Apr 2003 17:01:58 +0200
Thanks Ralph for the tips regarding my curl and PHP upgrades.
You are right about the "production-testing" duo server setup.
My 2nd server is running Redhat 8/Apache 2.0, and I stumbled upon some
problems there (regexp document directory aliases and some other stuff),
therefore I was not very eager to upgrade the production machine to 8.
About the curl "bug". The port-listener tool I was using to monitor the
POST data was only reporting the first 1024 bytes...:) Minus all the
header stuff, the posted data was indeed cut off to about 320 bytes... by
the monitoring tool. I'm sorry for making the wrong conclusion and posting
that on the list. I took me 2 hours to program a socket based solution to
figure that one out.
But that wasn't the reason of my problem. Since I am relaying all headers
from the requestor to the receiver and vice versa, I was also relaying the
content-length. Specifying a new content length of the POST request, or
setting it to 0 did not replace the value already in the header.
Apparantly this is fixed in newer releases of curl. The incorrect (to
short) content-lenght in the header caused the database server to receive
an incomplete request, and it threw back an error.
Interesting: transforming the $_POST array to a urlencoded string, gave me
the few extra bytes. The reason turns out to be "can't" or "needn't", they
are encoded as %5c%27, which produces the extra bytes - and incorrect data
("can/'t" and "needn/'t"). This took care of the problem:
function ArrayToPostString($theArray) {
$temp = array();
foreach ($theArray as $key => $value) {
$temp[] = urlencode($key)."=". urlencode(stripslashes($value));
}
return (implode("&", $temp));
}
I wonder if there is more to take care of. I'll probably learn from
experience.
-- Peter
-------------------------------------------------------
This SF.net email is sponsored by: ValueWeb:
Dedicated Hosting for just $79/mo with 500 GB of bandwidth!
No other company gives more support or power for your dedicated server
http://click.atdmt.com/AFF/go/sdnxxaff00300020aff/direct/01/
Received on 2003-04-09