1

We have a small proxy server written in .net. A simplified version of the core proxy functionality:

builder.Run(async ctx =>
        {
            using (HttpClient client = new HttpClient())
            {
                await client.SendAsync(BuildRequest(), HttpCompletionOption.ResponseHeadersRead)
                .ContinueWith(t => t.Result.Content.CopyToAsync(ctx.Response.Body));
            }
        });

The idea is that the proxy will simply stream any downstream responses back to calling client as raw as possible.

problem

The connection between the proxy and the service seems to working fine, always returning the 17kb of data i expect. The problem is between the client and the proxy, where sending the same request results in a response truncated somewhere between 0 and 17kb in length, apparently without reason.

  • When copying content from the service response to the client response, how can i tell when all of the content has been received? I know that chunked transfers are terminated by 0 length chunk, so do i need to check for this manually, or is this something handled by the httpresponse instance itself?
richzilla
  • 40,440
  • 14
  • 56
  • 86

0 Answers0