ruby / ruby/net-http

Feature Request: Support Http trailers in chunked transfer

Open
#28 2 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Ruby
Stars
148
Forks
95
Avg merge
10h 54m
Merged PRs (30d)
4

Description

Trailers in chunked transfer are described by rfc3230-section 4.1. Net/http does not support setting trailers nor is there a way for users to implement chunked trailers on top of net/http. The grammar is (combining section 4.1 and 4.1.2):

chunked-body   = *chunk
                      last-chunk
                      trailer-part
                      CRLF

     chunk          = chunk-size [ chunk-ext ] CRLF
                      chunk-data CRLF
     chunk-size     = 1*HEXDIG
     last-chunk     = 1*("0") [ chunk-ext ] CRLF

     chunk-data     = 1*OCTET ; a sequence of chunk-size octets
     trailer-part   = *( header-field CRLF )

When a body_stream is set and the transfer-encoding is chunked, GenericRequest#send_request_with_body_stream creates a Chunker . The Chunker correctly follows the rfc in writing out the chunks and writing the last-chunk as "0\r\n\r\n". However, there are no hooks or support for writing the trailer-part.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Read RFC 7230 section 4.1, then inspect lib/net/http/generic_request.rb, especially Chunker and GenericRequest#send_request_with_body_stream. Define how callers provide trailers and verify that chunked bodies emit the trailer-part after the last-chunk and final CRLF.

Written by the indexing model from the issue text.

Assessment

Tech stack
ruby
Domain
networking
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.