I have a legacy Mod_perl code that accepts a cxml call. This code is known-good, been around forever. I am trying to create a little JavaScript page that calls this code, for testing (long story).
When I submit the CxmlHttpRequest to the Perl CGI, it is throwing the dreaded "inappropriate ioctl for device" error.
I must need to change something in the JavaScript to make Perl happy. Any ideas?
Here is the JavaScript for the XML request calling Perl:
xmlhttp=new XMLHttpRequest();
xmlhttp.open("POST", "http://www.example.com/path/login.cgi", true);
xmlhttp.onreadystatechange=function() {
if (xmlhttp.readyState==4) {
alert("Response = " + xmlhttp.responseText)
}
}
xmlhttp.send(
'<?xml version="1.0" encoding="UTF-8"?>'+
(etc)
Here's the Perl. The read line is throwing the ioctl error. The content length returns a reasonable (non-zero) length.
if ($ENV{'REQUEST_METHOD'} eq 'POST' && $ENV{'CONTENT_LENGTH'} > 0){
read(STDIN, $input, $ENV{'CONTENT_LENGTH'}, 0) or $self->std_log("Can't read: $!\n");
$self->std_log("Post method, content length = " . $ENV{'CONTENT_LENGTH'} . "\n" );
$self->std_log("Input = \n $input \n");
$ENV{'CONTENT_LENGTH'} = 0;
}