thrift-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Malan Ruppert (Jira)" <>
Subject [jira] [Commented] (THRIFT-4987) TProtocolException: Bad version in readMessageBegin when using XHR client with C++ server
Date Mon, 23 Mar 2020 09:07:00 GMT


Malan Ruppert commented on THRIFT-4987:

[~emmenlau] after spending some time debugging, I found a solution for using binary in the

In xhr_connection.js, after creating XMLHttpRequest object, you need to specify the response
type as being 'arraybuffer':

line 103: var xreq = this.getXmlHttpRequestObject();  
line 104: xreq.responseType = 'arraybuffer';

Afterwards, in the onreadystatechange event handler of the XMLHttpRequest object, setRecvBuffer
needs to be called with the 'response' propery of the XMLHttpRequest object (instead of 'responseText'
xreq.onreadystatechange = function() {
    if (this.readyState == 4 && this.status == 200) {
Ofcourse this will most likely break again when using JSON. But seems to be a starting point
for fixing the binary protocol for browser..

> TProtocolException: Bad version in readMessageBegin when using XHR client with C++ server
> -----------------------------------------------------------------------------------------
>                 Key: THRIFT-4987
>                 URL:
>             Project: Thrift
>          Issue Type: Bug
>          Components: Node.js - Library
>    Affects Versions: 0.13.0
>            Reporter: Mario Emmenlauer
>            Priority: Major
> I'm getting a "TProtocolException: Bad version in readMessageBegin" in the web browser
when running an XHR client with binary protocol on a C++ server. The issue comes as soon as
I call a method with return value that returns for example an int32_t.
> This is tested with latest thrift from master.
> The Nodejs Http client works successfully with binary protocol, so the issue seems to
be related to the XHR connection or XHR client.
> Is this a bug or am I doing something wrong? I've found this report in various places
on the internet, in combination with Cassandra. It seems this happened for Cassandra in the
past, but as far as I could see, it was resolved by switching to the compact protocol.

This message was sent by Atlassian Jira

View raw message