• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Multipart POST using NSInputStream subclass
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Multipart POST using NSInputStream subclass


  • Subject: Re: Multipart POST using NSInputStream subclass
  • From: Dave Dribin <email@hidden>
  • Date: Wed, 16 May 2007 11:35:58 -0500

On May 16, 2007, at 10:51 AM, Becky Willrich wrote:
This is definitely not safe; much depends on exactly what your stream is going to do, but I would expect this to fail in strange and unexpected ways.

Dang. :) FWIW, I'm writing an open source command line tool, which I'm calling `nsurl`, to help debug NSURLConnection issues. It's supposed to be similar to `curl`, but uses NSURLConnection instead of libcurl. My input stream subclass (a work in progress) can be found here:


<http://ddribin.googlecode.com/svn/trunk/nsurl/ DDMultipartInputStream.m>

The subclass contains an array of standard NSInputStream objects for the parts, and iterates over them. It's actually quite similar to FormDataStreamCFNet.cpp, so I was glad when I saw that Safari implemented it basically the same way. :)

BTW, thanks to my client (jamlab.com) for letting me open source this test tool. I've been writing it while trying to get NSURLConnection working with their HTTP-based API. They web guys were testing with `curl`, but then my Obj-C code wouldn't run due to some quirk in NSURLConnection. So I decided to write a command line tool they can test with. I'll do a full release once it's further along.

It's using quasi-private APIs, although you might find the matching headers in the Darwin distribution of CF; I'm not sure.

Yup, it's in Darwin:

<http://www.opensource.apple.com/darwinsource/10.4.9.x86/CF-368.28/ Stream.subproj/CFStreamAbstract.h>

At least it's not in CFStreamPriv.h. :)

If you're choosing between this and overriding NSInputStream's private methods, this is definitely safer;

Sounds good. I think I'll stick with the temp file for now, and maybe revisit this later.


You can if you'd like (squeaky wheels and all that), but I don't think it's necessary - I believe the problem is well-understood by the relevant teams.

Can you comment if this will be addressed for Leopard? This is probably the 3rd or 4th issue with NSURLConnection that I've come across that makes it more difficult than it should be to write HTTP- based client apps. Most seem to relate to multipart POST, though the shared NSURLCredentialStorage is pretty nasty, too. I've been tempted to look at CURLHandle, but that's based on the deprecated NSURLHandle and itself hasn't been updated in years. I don't want to code against libcurl directly if I don't have to, but that's still an option I'm keeping in my back pocket.


-Dave

_______________________________________________
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


  • Follow-Ups:
    • Re: Multipart POST using NSInputStream subclass
      • From: Ladd Van Tol <email@hidden>
References: 
 >Multipart POST using NSInputStream subclass (From: Dave Dribin <email@hidden>)
 >Re: Multipart POST using NSInputStream subclass (From: Quinn <email@hidden>)
 >Re: Multipart POST using NSInputStream subclass (From: Dave Dribin <email@hidden>)
 >Re: Multipart POST using NSInputStream subclass (From: Becky Willrich <email@hidden>)

  • Prev by Date: Re: Multipart POST using NSInputStream subclass
  • Next by Date: Re: Multipart POST using NSInputStream subclass
  • Previous by thread: Re: Multipart POST using NSInputStream subclass
  • Next by thread: Re: Multipart POST using NSInputStream subclass
  • Index(es):
    • Date
    • Thread