[
https://issues.apache.org/jira/browse/THRIFT-6110?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Dmytro Shteflyuk resolved THRIFT-6110.
--------------------------------------
Fix Version/s: 0.25.0
Resolution: Fixed
> Ruby HTTP client transport should reject empty successful responses
> -------------------------------------------------------------------
>
> Key: THRIFT-6110
> URL: https://issues.apache.org/jira/browse/THRIFT-6110
> Project: Thrift
> Issue Type: Bug
> Components: Ruby - Library
> Reporter: Dmytro Shteflyuk
> Assignee: Dmytro Shteflyuk
> Priority: Major
> Fix For: 0.25.0
>
> Time Spent: 1h
> Remaining Estimate: 0h
>
> h3. Problem
> {{Thrift::HTTPClientTransport}} accepts an HTTP response with a successful
> status and then assumes that it contains a body. A 204 response has no body,
> and some 200 responses may carry an empty body. In the nil-body case, the
> transport passes {{nil}} to the binary-string helper and raises an
> implementation-level {{NoMethodError}} instead of a Thrift transport
> exception.
> h3. Client impact
> A Ruby client calling a service through the HTTP transport can receive a
> confusing, unrelated exception when an intermediary or endpoint returns a
> successful response without a Thrift payload. Callers cannot consistently
> handle this as a transport failure, and the original HTTP-response context is
> obscured.
> h3. Reproduction
> {code}
> # Server response:
> HTTP/1.1 204 No Content
> # Ruby client:
> transport = Thrift::HTTPClientTransport.new("http://localhost:8080/service")
> transport.write("request")
> transport.flush
> # current:
> # undefined method 'encoding' for nil (NoMethodError)
> #
> # desired:
> # raises Thrift::TransportException for an empty successful response
> {code}
> The same typed failure should apply to a 200 response whose body is an empty
> string. Existing non-2xx handling and normal non-empty Thrift responses
> should remain unchanged.
> h3. Expected behavior
> After a successful HTTP response, the transport should reject a missing or
> empty body with {{Thrift::TransportException}} rather than trying to treat it
> as a binary buffer.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)