Skip to content

Commit 2e4ebb8

Browse files
committed
More poking at read
1 parent 17c054b commit 2e4ebb8

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

index.js

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ RandomAccessHTTP.prototype.open = function (cb) {
3535
Connection: 'keep-alive'
3636
}
3737
})
38-
this.reqOpts = reqOpts
3938
var req = this.client.request(reqOpts, function (res) {
4039
if (res.statusCode !== 200) return cb(new Error('Bad response: ' + res.statusCode))
4140
if (headersInvalid(res.headers)) {
@@ -70,9 +69,21 @@ RandomAccessHTTP.prototype.read = function (offset, length, cb) {
7069
if (!this.opened) return openAndRead(this, offset, length, cb)
7170
if (!this.readable) return cb(new Error('File is not readable'))
7271

72+
var self = this
7373
var buf = Buffer(length)
7474

7575
if (!length) return cb(null, buf)
76+
var reqOpts = xtend(this.urlObj, {
77+
method: 'HEAD',
78+
headers: {
79+
Connection: 'keep-alive',
80+
'Accept-Ranges': 'bytes'
81+
}
82+
})
83+
84+
function onres () {
85+
// todo
86+
}
7687
}
7788

7889
RandomAccessHTTP.prototype.close = function (cb) {

0 commit comments

Comments
 (0)