Project

General

Profile

Actions

Bug #2037

closed

handleRequestPiecewise

Added by go mac almost 11 years ago. Updated almost 11 years ago.

Status:
Rejected
Priority:
Normal
Assignee:
-
Target version:
-
Start date:
07/16/2013
Due date:
% Done:

0%

Estimated time:

Description

Hi,

I was hoping that I could "concatenate" a response from WStreamResource, assigning a text value to the response.out() stream and an image ifstream to the input parameter of handleRequestPiecewise, i.e.

bf::fstream boostImage(myImage->fileName_.c_str(), boost::filesystem::ifstream::in);

response.out() << myImage->statusText_ << "#";

handleRequestPiecewise(request, response, boostImage);

It almost works but the image is truncated by the length of the data passed into the response.out(). Should it work? Is there a better way?

regards,

Gordon

Actions #1

Updated by Wim Dumon almost 11 years ago

That should in principle work, but I'd expect you check for the continuation before you write the first part of the image:

bf::fstream boostImage(myImage->fileName_.c_str(),  boost::filesystem::ifstream::in);
if (request.continuation())
  response.out() << myImage->statusText_ << "#";
handleRequestPiecewise(request, response, boostImage);

Otherwise you write statusText_ inbetween every chunk of your image. Note that handleRequest() will be invoked multiple times to send the entire file, once for every piece!

Wim.

Actions #2

Updated by go mac almost 11 years ago

Please dont action this one yet. I have noticed that whttpd is reporting the correct response length

"POST /resource HTTP/1.1" 200 2842

and the iphone app (using AFNetworking) is reporting the length of the image minus the text (even though the txt is present). I will have to use a packet sniffer to see what is going on.

Actions #3

Updated by go mac almost 11 years ago

Please close request. I ended up writing my own multipart but for some reason the iPhone (AFNetworking) didnt read in all of the parts, despite them being evident in the packet sniffer. I ended up just joining my parts with a delimiter and sending it as one chunk.

regards,

Gordon

Actions #4

Updated by Wim Dumon almost 11 years ago

  • Status changed from New to Rejected
Actions

Also available in: Atom PDF