psanford/httpreadat

Would you consider tagging a release?

Closed this issue · 2 comments

Hi!

Thanks for this, made porting sqlite3vfshttp to github.com/ncruces/go-sqlite3 a breeze.

Would you be so kind as to tag a release?

Also, did you consider using HEAD here?

httpreadat/httpreadat.go

Lines 82 to 84 in 005e63d

func (rr *RangeReader) Size() (n int64, err error) {
req, err := http.NewRequest("GET", rr.url, nil)
if err != nil {

Thanks again!

I tagged v0.1.0 for you.

Also, did you consider using HEAD here?

The use of GET with a range of 0-0 is intentional. Certain webservers treat GET and HEAD differently with respect to permissions. By only using GET, which has to work for any of this package to work, we reduce the number of potential failures due to server and authorization issues.

You can see an example of this by using AWS S3 presigned urls. Presigning takes a single http verb and only will allow use of that verb with the signed url:

$ curl -I $PRESIGNED_URL
HTTP/1.1 403 Forbidden
Content-Type: application/xml
Date: Mon, 22 May 2023 18:07:38 GMT
Server: AmazonS3

$ curl -i -r 0-0 $PRESIGNED_URL
HTTP/1.1 206 Partial Content
Date: Mon, 22 May 2023 18:08:19 GMT
Last-Modified: Sun, 01 Aug 2021 04:55:46 GMT
ETag: "cd5a32a2886cb45aa890298a521f3d3a-4"
Accept-Ranges: bytes
Content-Range: bytes 0-0/29040640
Content-Type: binary/octet-stream
Server: AmazonS3
Content-Length: 1