Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[fix] Read server response during EPIPE #761

Merged
merged 1 commit into from Sep 16, 2021

Conversation

stanhu
Copy link
Contributor

@stanhu stanhu commented Sep 15, 2021

When a request_block is used to send data, an error on the server side
only gets reported as a EPIPE. excon doesn't read anything sent back
from the server, which makes it hard to debug what went wrong.

We now read the server response, if any, and show it in the exception.

For example:

/home/stanhu/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/excon-0.85.0/lib/excon/connection.rb:491:in `raise_socket_error': HTTP/1.1 400 Bad Request\r (Excon::Error::Socket)
x-amz-request-id: MEMSPP5B8RB0XNGR\r
x-amz-id-2: ezVTklrChvB5lJDCpCm/IgPg1XkHgCLlJvSrCgQgxNIQQdjIZsMBx5Tfqz79mr1nfPiO99c+4XQ=\r
Content-Type: application/xml\r
Transfer-Encoding: chunked\r
Date: Wed, 15 Sep 2021 04:16:54 GMT\r
Server: AmazonS3\r
Connection: close\r
\r
17c\r
<?xml version="1.0" encoding="UTF-8"?>
<Error><Code>InvalidArgument</Code><Message>The secret key was invalid for the specified algorithm.</Message><ArgumentName>x-amz-server-side-encryption</ArgumentName><ArgumentValue>null</ArgumentValue><RequestId>MEMSPP5B8RB0XNGR</RequestId><HostId>ezVTklrChvB5lJDCpCm/IgPg1XkHgCLlJvSrCgQgxNIQQdjIZsMBx5Tfqz79mr1nfPiO99c+4XQ=</HostId></Error>\r
0\r
\r
Broken pipe (Excon::Error)

Closes #760

When a `request_block` is used to send data, an error on the server side
only gets reported as a `EPIPE`. excon doesn't read anything sent back
from the server, which makes it hard to debug what went wrong.

We now read the server response, if any, and show it in the exception.

Closes excon#760
@geemus geemus merged commit 5f384be into excon:master Sep 16, 2021
@geemus
Copy link
Contributor

geemus commented Sep 16, 2021

@stanhu Looks good, thanks for the detailed explanation and fix!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Server responses not surfaced when request_block is used to send
2 participants