Skip to content

CDN is disabled for partial/range downloads (streaming_offset != 0) #3701

Description

@cdxf

Commit: 89d7374 (Jan 8, 2020) File: td/telegram/files/FileDownloader.cpp:163-168

if (streaming_offset == 0) {
  cdn_supported = true;
}

The commit message says: "Temporarily disable CDN if streaming is enabled." — marked as temporary but has been in place for ~6.5 years with no follow-up.

cdn_supported is initialized to false and only set to true when streaming_offset == 0. Any download with offset > 0 or a bounded limit results in cdn_supported=false in the upload.getFile request, so the server never replies with upload_fileCdnRedirect. The download goes through the origin DC instead of a CDN edge.

Questions:

  1. Protocol limitation or missing implementation? — Is there a fundamental MTProto restriction where CDN servers reject offset > 0 requests? The upload.getCdnFile TL schema accepts a plain int offset parameter, which suggests partial CDN reads should work?

  2. Would accepting the redirect and then requesting the partial range from the CDN work? — If the initial upload_getFile(cdn_supported=true) returns an upload_fileCdnRedirect, the client could use upload_getCdnFile(offset, size) with the non-zero offset directly against the CDN. Is there any known server-side issue with this?

  3. Is there intent to re-enable this?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions