Re: Multipart POST using NSInputStream subclass
Re: Multipart POST using NSInputStream subclass
- Subject: Re: Multipart POST using NSInputStream subclass
- From: Aaron Wallis <email@hidden>
- Date: Wed, 16 May 2007 07:09:00 +1000
Hi Dave,
I'm totally watching this thread, i'm working on a project thats
going to require the exact same thing!
Fingers crossed someone helps us out :D
- az
On 16/05/2007, at 1:35 AM, Dave Dribin wrote:
Hello,
I've been working on an NSInputStream subclass so I can POST a
large file without loading the entire file into memory. I'm
currently building the entire multipart/form-data body using
NSMutableData, and passing this to -[NSMutableURLRequest
setHTTPBody:]. The downside to this approach is that the entire
HTTP body is resident in memory.
I noticed that the body of NSMutableURLRequest can alternately be
set using setHTTPBodyStream:. I figured if I can subclass
NSInputStream, I could achieve my goal. According to the
NSInputStream doc [1], a subclass needs to override three methods
read:maxLength:, getBuffer:length:, and hasBytesAvailable.
I've done this, and from my unit tests, it seems that I'm doing
everything correct. However, when I try to use my stream in an
NSURLConnection, I get the following runtime error:
*** -[DDMultipartInputStream _scheduleInCFRunLoop:forMode:]:
selector not recognized [self = 0x3062b0]
I found a message on the list from 2005 citing "problems with
subclassing
NSInputStream that may prevent it from working":
<http://lists.apple.com/archives/macnetworkprog/2005/Jul/
msg00004.html>
Is this still the case? Do I have to go the temporary file route?
Or am I just not subclassing NSInputStream correctly?
Thanks,
-Dave
[1]: http://developer.apple.com/documentation/Cocoa/Reference/
Foundation/Classes/NSInputStream_Class/Reference/Reference.html
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Macnetworkprog mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40gmail.com
This email sent to email@hidden
_______________________________________________
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