In case there's a second person on this planet trying to figure this out, THRIFT or otherwise, it appears to be an issue with PHP's stream_context_create and inserting HTTP headers.
Specifically I needed to POST "Content-Type: application/x-thrift" to the remote server, and although I was inserting the headers properly, they were being stripped and/or overridden on the way out.
There's a post at http://stackoverflow.com/a/4249933 that pushed my in the right direction, and as a workaround I'm now using:
PHP Code:
ini_set("user_agent", "PHP/THttpClient\r\nAccept: application/x-thrift\r\nContent-Type: application/x-thrift");
Appending to the user-agent gets us the rest of the headers as a bonus (if not a bit ugly).
FWIW, here's THRIFT'S implementation (from THttpClient.php) that was failing:
PHP Code:
$headers = array('Host: '.$host,
'Accept: application/x-thrift',
'User-Agent: PHP/THttpClient',
'Content-Type: application/x-thrift',
'Content-Length: '.strlen($this->buf_));
$options = array('method' => 'POST', 'protocol_version' => 1.1,
'header' => implode("\r\n", $headers),
'max_redirects' => 1,
'content' => $this->buf_);
$this->buf_ = '';
$contextid = stream_context_create(array('http' => $options));
$this->handle_ = @fopen($this->scheme_.'://'.$host.$this->uri_, 'r', false, $contextid);
I'm still completely baffed as to why this is happening, but at least now we can deal with it.