locked
HttpClient progress not reported when using HttpBufferContent

    Question

  • Hi,

    I'm using Windows.Web.Http.HttpClient to upload files to a range of services. It was working fine while using HttpStreamContent, but I had to change it to use HttpBufferContent to allow re-sending the request if the service failed(Resending a request using HttpStreamContent throws a cryptic exception). Well the change worked, but the progress is broken now. When using HttpBufferContent it report to have sent the 100% of the bytes instantly which is a clear bug.

    I hope you can improve these components, the api is very good, but the implementation is pathetic.

    Regards,

    Alvaro.


    Alvaro Rivoir

    Sunday, November 9, 2014 7:48 PM

All replies

  • Hi Alvaro,

    Thank you very much for reporting the potential bug with us, I would like invite you to share us a minimum reproducible demo for test purpose and I will also consult our seniors to see if this is a known issue.

    --James


    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    Monday, November 10, 2014 5:28 AM
    Moderator
  • HttpBufferContent moves all the data to lower networking APIs all at once. That is why progress jumps from 0% to 100%.

    As you described, HttpStreamContent fails when the request needs to be sent twice (e.g., server requires credentials) and the given stream only implements IInputStream. To allow the stream to be sent multiple times and show a more detailed progress, make sure to provide a stream that implements IRandomAccessStream.

    Using HttpStreamContent will show progress in multiples of 65536 bytes, since the stream is consumed in 65536 bytes long buffers.


    Tuesday, December 30, 2014 2:06 AM