You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@thrift.apache.org by "Jens-G (via GitHub)" <gi...@apache.org> on 2026/09/21 15:03:31 UTC

[PR] THRIFT-6331: Read binary replies in XHRConnection.read() [thrift]

Jens-G opened a new pull request, #3923:
URL: https://github.com/apache/thrift/pull/3923

   Since THRIFT-4987, `XHRConnection.flush()` passes the replies of the binary protocols to `setRecvBuffer()` as an `ArrayBuffer`. `setRecvBuffer()` took the size from `length`, which an `ArrayBuffer` does not have, and `read()` then called `substr()` on it:
   
   ```
   TypeError: this.recv_buf.substr is not a function
   ```
   
   This change sizes an `ArrayBuffer` by its `byteLength` and lets `read()` return its bytes as a `Buffer`, as the other Node.js transports do. The string replies of `TJSONProtocol` are read as before, and `readAll()` still returns the reply as it arrived. Decoding a reply does not go through `read()`, so it is not affected.
   
   **This builds on #3920**, which fixes `read()` reading from `read_buf` and adds `lib/nodejs/test/connection_transport.test.js`. The new case in that file feeds an `ArrayBuffer` with bytes from 0x80 up and checks the bytes that come back:
   
   | | `connection_transport.test.js` |
   |---|---|
   | #3920 alone | `TypeError: this.recv_buf.substr is not a function` |
   | with this change | 10/10 pass |
   
   `make -C lib/nodejs check` passes in a container (thrift:jammy), including `thrift_4987_xhr_protocol.test.mjs` (6/6) and `lint-tests`.
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@thrift.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] THRIFT-6331: Read binary replies in XHRConnection.read() [thrift]

Posted by "Jens-G (via GitHub)" <gi...@apache.org>.
Jens-G merged PR #3923:
URL: https://github.com/apache/thrift/pull/3923


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@thrift.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org