• 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
Connection delegate never getting called, with chunked response
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Connection delegate never getting called, with chunked response


  • Subject: Connection delegate never getting called, with chunked response
  • From: Jens Alfke <email@hidden>
  • Date: Tue, 07 Jun 2011 11:55:28 -0700

I’ve got a weird & frustrating problem fetching an HTTP resource with NSURLConnection, and my current hypothesis is that it’s something to do with the way CFNetwork handles chunked responses; specifically, that it waits until the complete response is available before calling any of the delegate methods. Is that so?

Here are the specifics: I’m reading a CouchDB _changes feed [1] in ‘continuous’ (aka streaming) mode, where the server never ends the response, but keeps sending data continuously as it becomes available. I’ve been using NSURLConnection for years for all kinds of things, but this time I’m stumped, as I can’t get it to work at all on this feed.

What I see is that I create the connection (ignoring local & remote caches), and then none of the delegate methods ever get called, no matter how long I wait. I know the code is basically correct because if I change the URL slightly to specify the non-streaming mode (in which it sends one chunk of data and ends the response), the delegate calls happen as normal and my code works.

The problematic URL works fine when accessed through ‘curl’. But it also fails with the ‘HTTP Client’ app, which presumably also uses NSURLConnection.

My current hypothesis, as I said, is that when CFNetwork receives an HTTP header with “Transfer-Encoding: chunked”, it doesn’t call the delegate as usual, but instead waits until it’s received the entire response body before unchunking it and sending it to the delegate in one lump.

Is that so? If true, I’m going to have to reluctantly abandon NSURLConnection and fetch this resource using a plain NSStream. :(

—Jens

[1] http://wiki.apache.org/couchdb/HTTP_database_API#Changes

Attachment: smime.p7s
Description: S/MIME cryptographic signature

 _______________________________________________
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: Connection delegate never getting called, with chunked response
      • From: Mark Pauley <email@hidden>
  • Prev by Date: Re: Writing on a common socket from multiple threads
  • Next by Date: Re: Connection delegate never getting called, with chunked response
  • Previous by thread: Re: Writing on a common socket from multiple threads
  • Next by thread: Re: Connection delegate never getting called, with chunked response
  • Index(es):
    • Date
    • Thread