Hi,

I was working to get another facebook framework named Scribe to work
with Ruby. As it uses Thrift, I had to set it up. I'm not aware of the
procedure of creating issues and submitting patches. So, I'm putting
the code here itself.

The sample code for Scribe used TBinaryProtocol in Python whose
equivalent is Thrift::BinaryProtocol in Ruby. The method
read_message_begin is quite old as compared to its python counterpart.
I have changed it to be similar to the Python version as listed below.
Please note that this code does not check for a strict read condition
that was used by Python to restrict the actions in the else clause.

def read_message_begin
   version = read_i32
   if(version <0)
     if (version & VERSION_MASK != VERSION_1)
       raise ProtocolException.new(ProtocolException::BAD_VERSION,
'Missing version identifier')
    end
    type = version & 0×000000ff
    name = read_string
    seqid = read_i32
  else
    name = trans.readAll(version)
    type = read_byte
    seqid = read_i32
  end
  [name, type, seqid]
end

Please review and commit it to the codebase.

Regards
Chandranshu

Reply via email to