Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

transfer encoding chunked example for binary files #47

Closed
nViso opened this issue Oct 14, 2015 · 1 comment
Closed

transfer encoding chunked example for binary files #47

nViso opened this issue Oct 14, 2015 · 1 comment
Assignees
Milestone

Comments

@nViso
Copy link

nViso commented Oct 14, 2015

Hi,

Do you have an example of receiving binary files (such as jpeg images) via transfer encoding chunked. The example transfer_encoding_request shows sending text files, but when sending binary data is does not work.

Thanks.

@nViso
Copy link
Author

nViso commented Oct 14, 2015

Hi,

We found the issue and it is working as the read_chunk function in the example is having the crlf inside the data. If we write out the data we can receive a binary file fine.

void read_chunk( const shared_ptr< Session >& session, const Bytes& data )
{
cout << "Partial body chunk: " << data.size( ) << " bytes" << endl;
fwrite((Byte*)(data.data()), sizeof(Byte), static_cast< int >(data.size() - strlen("\r\n")), fp);
session->fetch( "\r\n", read_chunk_size );
}

Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants