Skip to content

[server/s3] GetObject Range 请求应返回 206 Partial Content,现返回 200 #3043

Closed as not planned

Description

@codeislaw-hu

环境

  • OpenList 版本: v4.2.6
  • 内置 S3 服务 (gofakes3 backend)

复现步骤

# 请求 Range
curl -H "Range: bytes=6-10" -u "$AK:$SK" --aws-sigv4 "aws:amz:us-east-1:s3" \
  "http://localhost:5246/bucket/key"

预期行为

HTTP 206 Partial Content,响应体仅包含指定字节范围。

实际行为

HTTP 200 OK,返回完整文件内容(或错误的字节)。

原因分析

server/s3/backend.go 的 GetObject 处理 rangeRequest 时,虽计算了范围,但未在响应中设置 StatusCode = 206 与 Content-Range 头。gofakes3 框架层未自动处理。

建议修复

在构造 gofakes3.Object 返回前,若 rangeRequest != nil 且范围有效,设置:

  • StatusCode: 206
  • Content-Range: bytes start-end/total
  • 仅返回切片后的 Contents reader

Activity

  1. jyxjjj commented on Sep 6, 2026

    @jyxjjj
    Member

    不符合提交规范

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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