Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Streaming API does not allow access to the HTTP status or the headers from the callback #827

Open
@igorpeshansky

Description

@igorpeshansky

The current streaming API takes a callback function with two parameters:

typedef function<void(boost::iterator_range<charconst*>const&,                        system::error_codeconst&)> body_callback_function_type;

This means that from within the body handler, there is no way to know what the HTTP status code was for the underlying request or what the headers were (most importantly the "Transfer-Encoding" header), even though the status code and the headers are parsed before the callback is invoked.

One workaround is to use the callback to simply assemble the body bytes, and then actually parse it after the request completes. This, however, won't work for hanging gets, where the data is coming in incrementally.

I'd like to augment the API to allow the callback to access the underlyinghttp_async_protocol_handler fields (including the promises andis_chunk_encoding), most likely via the underlyingresponse object. There is a way to make it backward compatible by overloading on a 2-parameter callback.

@deanberris, would you entertain a PR with such a change?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp