Re: Exception using custom input stream for NSURLRequest
Re: Exception using custom input stream for NSURLRequest
- Subject: Re: Exception using custom input stream for NSURLRequest
- From: Jens Alfke <email@hidden>
- Date: Sun, 05 Feb 2012 14:52:51 -0800
On Feb 5, 2012, at 12:55 PM, Lou Zell wrote:
> Are you able to share your implementations for the two methods?
https://github.com/couchbaselabs/TouchDB-iOS/blob/master/Source/TDMultiInputStream.h
https://github.com/couchbaselabs/TouchDB-iOS/blob/master/Source/TDMultiInputStream.m
This class is an input-stream multiplexer: it concatenates multiple input sources (files, data, other input streams) and makes them readable as a single input stream. It can be used as the HTTPBodyStream of an NSURLRequest since it implements those two magic methods.
People doing MIME multipart uploads will also want to look at its subclass that does exactly that:
https://github.com/couchbaselabs/TouchDB-iOS/blob/master/Source/TDMultipartStreamer.h
https://github.com/couchbaselabs/TouchDB-iOS/blob/master/Source/TDMultipartStreamer.m
This just inserts the appropriate multipart boundary string in between the input sources to make them into a valid multipart body.
Note: These classes are basically standalone, but use some logging and unit-test functions from my MYUtilities library (https://github.com/snej/MYUtilities).
Note2: As part of the TouchDB project, these source files are released under the Apache 2 license.
—Jens
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Macnetworkprog mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden