Giter Club home page Giter Club logo

Comments (4)

ncw avatar ncw commented on August 24, 2024

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 Length method on the file will fetch the length using a HEAD request if required.

I pushed a branch fix-44 with that change in for you to try.

from swift.

swill avatar swill commented on August 24, 2024

I just tested the fix-44 branch and it works perfectly now...

Here is the result with compression turned on in the NetScaler.

 downloaded: 100.txt
map[Cteonnt-Length:102400 Last-Modified:Wed, 17 Jun 2015 17:03:48 GMT X-Timestamp:1434560627.86336 Date:Wed, 17 Jun 2015 17:03:48 GMT Accept-Ranges:bytes Cache-Control:private Etag:4c6426ac7ef186464ecbb0d81cbfcb1e X-Trans-Id:tx3025cdfdbf5d4d6092916-005581a874 Content-Type:text/plain; charset=utf-8]

Thank you for the quick turn around on this. Excellent support... 👍

from swift.

ncw avatar ncw commented on August 24, 2024

Glad it worked and thanks for testing . I'll merge to master shortly...

from swift.

ncw avatar ncw commented on August 24, 2024

This is merged to master now - thanks for the report

-- Nick

from swift.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.