Closed jcharum closed 4 years ago
Does
startGetObjectRequest
still need to constructnewInfo
?
I don't think so, but I'm only 80% sure, as I have little experience with this code. My reasoning goes like this:
startGetObjectRequest
will only call newInfo
if f.info == nil
.startGetObjectRequest
is only called by handleRead
.handleRead
is only called to handle a readRequest
.readRequest
is only issued in (*s3Reader).Read
.*s3Reader
is by (*s3File).Reader
. It only does this if f.mode == readonly
.readonly
*s3File
is by (*s3Impl).Open
.(*s3Impl).Open
will only return successfully if the handleStat
sends a non-error response
, via runRequest
and statRequest
.handleStat
only sends a non-error response after populating f.info
.f.info != nil
in startGetObjectRequest
, and it will not call newInfo
.I'm not really sure how to thoroughly test removal of this code right now, so I don't want to add it to this PR. The change in this PR seems much less risky.
Also, I looked through the history, and I think the f.info == nil
case became obsolete in 3cf2bd3a402b890b1e04641627c2044fb9fe986e, which introduced the statRequest
on (*s3Impl).Open
.
Use
HeadObject
instead ofGetObject
for handlingstatRequest
s. Besides being a better semantic match, it fixes #15.