Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 94533
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T23:30:59+00:00 2026-05-10T23:30:59+00:00

I wrote a raw TCP client for HTTP/HTTPS requests, however I’m having problems with

  • 0

I wrote a raw TCP client for HTTP/HTTPS requests, however I’m having problems with chunked encoding responses. HTTP/1.1 is requirement therefore I should support it.

Raw TCP is a business requirement that I need to keep, therefore I can’t switch to .NET HTTPWebRequest/HTTPWebResponse However if there is way to convert a RAW HTTP Request/Response into HTTPWebRequest/HTTPWebResponse that’d work.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-10T23:31:00+00:00Added an answer on May 10, 2026 at 11:31 pm

    The best place to start is the http 1.1 specification, which lays out how chunking works. Specifically section 3.6.1.

    3.6.1 Chunked Transfer Coding

    The chunked encoding modifies the body of a message in order to
    transfer it as a series of chunks, each with its own size indicator,
    followed by an OPTIONAL trailer containing entity-header fields. This allows dynamically produced content to be transferred along with the
    information necessary for the recipient to verify that it has
    received the full message.

       Chunked-Body   = *chunk                     last-chunk                     trailer                     CRLF     chunk          = chunk-size [ chunk-extension ] CRLF                     chunk-data CRLF    chunk-size     = 1*HEX    last-chunk     = 1*('0') [ chunk-extension ] CRLF     chunk-extension= *( ';' chunk-ext-name [ '=' chunk-ext-val ] )    chunk-ext-name = token    chunk-ext-val  = token | quoted-string    chunk-data     = chunk-size(OCTET)    trailer        = *(entity-header CRLF) 

    The chunk-size field is a string of hex digits indicating the size of
    the chunk. The chunked encoding is ended by any chunk whose size is
    zero, followed by the trailer, which is terminated by an empty line.

    The trailer allows the sender to include additional HTTP header
    fields at the end of the message. The Trailer header field can be used to indicate which header fields are included in a trailer (see section 14.40).

    Assuming that you have already read the header from the response and are pointing to the next byte in the stream your pseudo code would look something like this:

    done = false; uint8 bytes[]; while (!done) {   chunksizeString = readuntilCRLF(); // read in the chunksize as a string   chunksizeString.strip(); // strip off the CRLF   chunksize = chunksizeString.convertHexString2Int(); // convert the hex string to an integer.   bytes.append(readXBytes(chunksize)); // read in the x bytes and append them to your buffer.   readCRLF(); // read the trailing CRLF and throw it away.   if (chunksize == 0)      done = true; //  } // now read the trailer if any // trailer is optional, so it may be just the empty string trailer = readuntilCRLF() trailer = trailer.strip() if (trailer != '')    readCRLF(); // read out the last CRLF and we are done. 

    This is ignoring the chunk-extension portion, but since it is delimited with a ‘;’ it should be easy to split it out. This should be enough to get you started. Keep in mind that the chunksize string does not have a leading ‘0x’.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 66k
  • Answers 66k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • added an answer Simply put the NextResult at the end of the loop… May 11, 2026 at 11:25 am
  • added an answer Consider that storing UTC time is less ambiguous than storing… May 11, 2026 at 11:25 am
  • added an answer It's impossible to say, not knowing the size of string1… May 11, 2026 at 11:25 am

Related Questions

I wrote a raw TCP client for HTTP/HTTPS requests, however I'm having problems with
I want to write a raw byte/byte stream to a position in a file.
I wrote a simple batch file as a PowerShell script, and I am getting
I wrote a windows service using VB that read some legacy data from Visual
I wrote a component that displays a filename, a thumbnail and has a button
I wrote a simple tool to generate a DBUnit XML dataset using queries that
I wrote a quick program in python to add a gtk GUI to a
I wrote a simple Windows Forms program in C#. I want to be able
I wrote a utility for photographers that I plan to sell online pretty cheap
I wrote a script to export twitter friends as foaf rdf description. Now I'm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.