-
-
Notifications
You must be signed in to change notification settings - Fork 107
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
Content-Length issue when using compression #44
Comments
I think a patch like this will fix the issue --- a/swift.go
+++ b/swift.go
@@ -1422,8 +1422,10 @@ func (c *Connection) ObjectOpen(container string, objectName string, checkHash b
file.body = io.TeeReader(resp.Body, file.hash)
}
// Read Content-Length
- file.length, err = getInt64FromHeader(resp, "Content-Length")
- file.lengthOk = (err == nil)
+ if resp.Header.Get("Content-Length") != "" {
+ file.length, err = getInt64FromHeader(resp, "Content-Length")
+ file.lengthOk = (err == nil)
+ }
return
} Reading through the code, having length not set will mean you can't seek from the end of a file and that is about it. The I pushed a branch |
I just tested the fix-44 branch and it works perfectly now... Here is the result with compression turned on in the NetScaler.
Thank you for the quick turn around on this. Excellent support... 👍 |
Glad it worked and thanks for testing . I'll merge to master shortly... |
This is merged to master now - thanks for the report -- Nick |
I have the following code:
This code works just fine when we have compression turned off on the NetScaler (which is between the client and the swift proxy).
Example Output:
This code fails when we turn on compression on the NetScaler.
Example Output:
Notice that when the code works, we have
Content-Length:102400
Notice that when the code fails, we have
Cteonnt-Length:102400
andContent-Length
is not set.I have tested other libraries in Java and Python and they do not fail in this same case. In doing some research, this seems to be a standard way to specify if the request was compressed or not. The
Content-Length
header is returned jumbled if the request was compressed to signify that it is reporting the compressed length.Do you have any ideas how to address this? Right now I can upload files, but I can't download any files when compression is turned on.
The text was updated successfully, but these errors were encountered: