Skip to content

Commit

Permalink
apacheGH-38198: [Go] Fix AuthenticateBasicToken to be reliable behind…
Browse files Browse the repository at this point in the history
… proxies (apache#38199)

### Rationale for this change

Fixes a bug in the Go Flight client library that makes using AuthenticateBasicToken unreliable behind proxies.

### What changes are included in this PR?

Closes the sending side of the bi-directional stream for the Flight Handshake RPC call before trying to read the headers. This matches the C++ implementation.

<img width="609" alt="Screenshot 2023-10-11 at 6 18 40 PM" src="https://github.com/apache/arrow/assets/879445/05e23c6a-0ff8-41fc-825b-8add7fe938bc">

### Are these changes tested?

I've tested these changes against my service deployed behind CloudFlare and verified the error listed in the linked issue disappears.

### Are there any user-facing changes?

No
* Closes: apache#38198

Authored-by: Phillip LeBlanc <phillip@leblanc.tech>
Signed-off-by: Matt Topol <zotthewizard@gmail.com>
  • Loading branch information
phillipleblanc authored and dgreiss committed Feb 17, 2024
1 parent 8a33abe commit bfed1fd
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions go/arrow/flight/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -312,18 +312,18 @@ func (c *client) AuthenticateBasicToken(ctx context.Context, username, password
return ctx, err
}

header, err := stream.Header()
err = stream.CloseSend()
if err != nil {
return ctx, err
}

_, err = stream.Recv()
if err != nil && err != io.EOF {
header, err := stream.Header()
if err != nil {
return ctx, err
}

err = stream.CloseSend()
if err != nil {
_, err = stream.Recv()
if err != nil && err != io.EOF {
return ctx, err
}

Expand Down

0 comments on commit bfed1fd

Please sign in to comment.