Domanda

Background: I have a custom HTTP server written in Erlang to stream stuff to an iPad app. I was using NSURLConnection - the standard high-level Apple way to consume HTTP content. However I was having problems with small chunks of data being buffered and not passed to my code immediately, so I was forced to switch to CFNetwork.

While NSURLConnection never complained, CFNetwork sometimes (~1 in 3 times) gives the following error and kills the connection:

The operation couldn’t be completed. (kCFErrorDomainCFNetwork error 303.)

According to Apple docs, this corresponds to "The HTTP server response could not be parsed."

This only occurs after the connection has been opened for a couple of seconds, and the response is being made.

I've taken a packet capture on the server with tshark. It's quite large, and contains UTF-8 as well as confidential details.

How can I go about verifying that it's a valid HTTP 1.1 chunked response?

Just to clarify, I've looked through the result of tcpick -C -yP -r ... and couldn't see anything immediately amiss, but I'm wondering if there's anything I can pass it through to confirm it's byte for byte valid.

È stato utile?

Soluzione

Turns out it was sndbuf in the Erlang web server being set too low that was the problem.

That was a 5 hour waste of scanning a packet capture, implementing chunked HTTP with CFStream from scratch, etc, etc

Altri suggerimenti

How can I go about verifying that it's a valid HTTP 1.1 chunked response?

By confirming wheter chunked transfer encoding is implemented correctly.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top