Skip to content

Commit 0496f70

Browse files
committed
Fixed bug in headers
1 parent 76895d5 commit 0496f70

File tree

1 file changed

+6
-12
lines changed

1 file changed

+6
-12
lines changed

pluto/pluto.go

+6-12
Original file line numberDiff line numberDiff line change
@@ -226,13 +226,10 @@ func FetchMeta(u *url.URL, headers []string) (*FileMeta, error) {
226226
}
227227

228228
for _, v := range headers {
229-
vsp := strings.Split(v, ":")
229+
vsp := strings.Index(v, ":")
230230

231-
if len(vsp) != 2 {
232-
continue
233-
}
234-
key := vsp[0]
235-
value := vsp[1]
231+
key := v[:vsp]
232+
value := v[vsp:]
236233

237234
req.Header.Set(key, value)
238235
}
@@ -296,13 +293,10 @@ func download(begin, end uint64, config *Config) (io.ReadCloser, error) {
296293
req.Header.Set("Range", fmt.Sprintf("bytes=%d-%d", begin, end))
297294

298295
for _, v := range config.Headers {
299-
vsp := strings.Split(v, ":")
296+
vsp := strings.Index(v, ":")
300297

301-
if len(vsp) != 2 {
302-
continue
303-
}
304-
key := vsp[0]
305-
value := vsp[1]
298+
key := v[:vsp]
299+
value := v[vsp:]
306300

307301
req.Header.Set(key, value)
308302
}

0 commit comments

Comments
 (0)