Skip to content

Commit 983b986

Browse files
authored
feat: modify how multipart bytes header is built (no space) on http source (#1018)
* remove unused fixture * refactor how range header in built * remove space from range header
1 parent ccb56b2 commit 983b986

File tree

2 files changed

+7
-9
lines changed

2 files changed

+7
-9
lines changed

src/uproot/source/http.py

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -289,16 +289,14 @@ def multifuture(
289289
"""
290290
connection = make_connection(source.parsed_url, source.timeout)
291291

292-
range_strings = []
293-
for start, stop in ranges:
294-
range_strings.append(f"{start}-{stop - 1}")
295-
292+
range_header = {
293+
"Range": "bytes="
294+
+ ",".join([f"{start}-{stop - 1}" for start, stop in ranges])
295+
}
296296
connection.request(
297297
"GET",
298298
full_path(source.parsed_url),
299-
headers=dict(
300-
{"Range": "bytes=" + ", ".join(range_strings)}, **source.auth_headers
301-
),
299+
headers=dict(**range_header, **source.auth_headers),
302300
)
303301

304302
def task(resource):
@@ -317,7 +315,7 @@ def task(resource):
317315
"GET",
318316
full_path(redirect_url),
319317
headers={
320-
"Range": "bytes=" + ", ".join(range_strings),
318+
**range_header,
321319
**source.auth_headers,
322320
},
323321
)

tests/test_0001_source_class.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ def test_memmap_fail(use_threads, tmp_path):
119119

120120
@pytest.mark.parametrize("use_threads", [True, False])
121121
@pytest.mark.network
122-
def test_http(server, use_threads):
122+
def test_http(use_threads):
123123
url = "https://example.com"
124124
with uproot.source.http.HTTPSource(
125125
url,

0 commit comments

Comments
 (0)