You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by GitBox <gi...@apache.org> on 2021/07/21 12:15:12 UTC

[GitHub] [incubator-nuttx-apps] gustavonihei edited a comment on pull request #809: Revert "webclient: Don't call the sink callback if no data is available"

gustavonihei edited a comment on pull request #809:
URL: https://github.com/apache/incubator-nuttx-apps/pull/809#issuecomment-884142582


   > > > i'm not sure if i understand what your app does.
   > > > sink_callback is for the response body.
   > > > as far as i know, right now there is no api for applications to investigate response headers.
   > > > can you explain a bit?
   > > 
   > > 
   > > Sure. I want to log the download progress. I intended to retrieve the file size by parsing the value of Content-Length from the header.
   > > Currently it suceeds most of the time. But occasionally it meets that condition from the commit and fails to retrieve the file size, messing the download progress log.
   > 
   > how does your app get the value of Content-Length?
   > afaik, the current api doen't provide an access to response headers.
   
   Actually it does via the `sink_callback`, see the API documentation:
   https://github.com/apache/incubator-nuttx-apps/blob/master/include/netutils/webclient.h#L93-L95
   
   What my app does is check whether `offset > 0`, which means the beginning of the buffer contains the header data.
   Then I parse the Content-Length field using standard library functions:
   https://godbolt.org/z/TxYe3fzP6
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org