fix(worker): raise http.client header limit so Qobuz tracks stop failing

Bruno Mars "24K Magic" track 1 repeatedly downloaded as a 0-byte file. The
worker log showed the real cause: streamrip's track download hit
HTTPException("got more than 100 headers") — Qobuz's CDN returns >100 response
headers for some tracks and Python's http.client rejects them at the default
_MAXHEADERS=100, so streamrip skips the track and leaves an empty placeholder.

- Raise http.client._MAXHEADERS to 1000 on import of the Qobuz adapter, so those
  responses parse and the track downloads.
- _count_staged_audio now skips 0-byte files (a failed-track placeholder is not a
  real track) — improves the download-progress estimate and stops counting dead
  tracks. (A verify-level "reject 0-byte tracks" safety net is a follow-up under
  #16 per-track duration matching — it needs the pipeline fakes to write real
  files, deferred to avoid disproportionate churn here.)

worker 223 tests / 7-skip.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Jonathan
2026-07-14 13:17:20 +02:00
parent 9a95c33b7e
commit bc42e546f0
3 changed files with 28 additions and 7 deletions
@@ -1,8 +1,15 @@
import asyncio
import hashlib
import http.client
import os
from typing import Callable
# Qobuz's CDN returns responses with more than Python's default 100-header limit for some
# tracks, so http.client raises HTTPException("got more than 100 headers"), streamrip skips
# that track, and it lands as a 0-byte file (seen on Bruno Mars "24K Magic" — track 1). Raise
# the limit process-wide so those downloads succeed. (Set on import of the Qobuz adapter.)
http.client._MAXHEADERS = 1000
def _hashed_password(password: str) -> str:
"""streamrip's Qobuz email/password login expects the password as an MD5 hex digest."""