|
From: <php...@li...> - 2010-04-13 17:15:29
|
Hi again,
please forget what I've said. The PHP/Java Bridge code is correct.
Java.inc is difficult to read because it doesn't contain any
indentation. Here's the code from Protocol.inc:
function read($size) {
if(is_null($this->headers)) $this->parseHeaders();
if (isset($this->headers["http_error"])) {
$len = $this->headers['content_length'];
for($str=fread($this->socket, $len); strlen($str)<$len;
$str.=fread($this->socket,$len-strlen($str)));
$this->shutdownBrokenConnection($str);
}
return $this->fread(JAVA_RECV_SIZE);
}
Error messages are reported with Content-Length set:
send(3, "PUT /JavaBridge/JavaBridge.phpjavabridge HTTP/1.1\r\nHost:
127.0.0.1:8080\r\nCache-Control: no-cache\r\nPragma: no-cache\r
\nTransfer-Encoding: chunked\r\n\r\n24\r\n\177C<H p=\"1\" v=
\"java.lang.System\"></H>\r\n", 188, 0) = 188
poll([{fd=3, events=POLLIN|POLLERR|POLLHUP}], 1, -1) = 1 ([{fd=3,
revents=POLLIN}])
recv(3, "HTTP/1.1 404 Not Found\r\nServer: Apache-Coyote/1.1\r
\nContent-Type: text/html;charset=utf-8\r\nContent-Length: 952
But the back end response would be interesting nevertheless. Can you
please edit the Java.inc read function as follows and send the output?
function read($size) {
if(is_null($this->headers)) $this->parseHeaders();
if (isset($this->headers["http_error"])) {
//$len = $this->headers['content_length'];
//for($str=fread($this->socket, $len); strlen($str)<$len;
$str.=fread($this->socket,$len-strlen($str)));
$str = fread($this->socket, JAVA_RECV_SIZE);
$this->shutdownBrokenConnection($str);
}
return $this->fread(JAVA_RECV_SIZE);
}
Regards,
Jost Bökemeier
|