Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

Add configurable limits for HTTP response bodies

Đang mở
#436 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
52/100
Loại issue
Tính năng
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Ít trao đổi
Công nghệ
rust
Lĩnh vực
cli, networking

Hướng nghiên cứu

Bắt đầu trong src/http.rs:141-165, đặc biệt là response.into_body().collect().await ở dòng 155, và kiểm tra cấu hình request hiện có cũng như các ví dụ HTTP. Xác định cách chọn giới hạn và cách expose lỗi đã được định kiểu, sau đó áp dụng giới hạn này khi tiêu thụ cả body có độ dài cố định lẫn body chunked. Hoàn thành khi các acceptance test bao phủ các giới hạn thấp hơn, bằng và cao hơn giới hạn, cũng như các giới hạn chunked, đồng thời các ví dụ hiện có chạy thành công trên các target được hỗ trợ.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

enhancement high priority

Context

The HTTP host collects the complete response body into memory before returning it to Roc:

  • src/http.rs:141-165
  • specifically response.into_body().collect().await at line 155

A slow response can be constrained with the existing request timeout, but there is no response-size limit. A server can therefore return a very large fixed-length or chunked body and cause excessive memory use or an allocation abort.

This matters for a general-purpose CLI platform because URLs and servers are often outside the application's control.

Suggested direction

Add an explicit maximum response-body size to the HTTP API. Design options include:

  • a limit on the shared request configuration;
  • a platform-level default plus an opt-in override;
  • a separate bounded send operation.

Enforce the limit while consuming frames, rather than collecting first and checking afterward. Return a distinct typed error that callers can distinguish from malformed bodies and network failures.

A later streaming response API can be tracked separately; this issue only needs bounded buffering.

Acceptance criteria

  • Callers can select or rely on a documented finite response-body limit.
  • Both Content-Length responses and chunked/unknown-length responses are stopped before exceeding the limit.
  • Exceeding the limit returns a documented typed error rather than panicking or aborting.
  • Tests cover a body just below the limit, exactly at it, above it, and a chunked body above it.
  • Existing normal HTTP examples continue to pass on every supported target.
Ngôn ngữ chính
Rust
Star
121
Fork
46
Merge trung bình
12 giờ 20 phút
Pull request đã merge (30 ngày)
18

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của roc-lang/basic-cli

Tất cả issue của roc-lang/basic-cli

Issue tương tự

Thêm issue về Rust

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.