... and you disabled the SD SPI interface on digital pin 4? Just checking. There have been more than a few posts here.
In the original sketch (i.e. before I started paring it down to debug), I was, and I was also writing to the SD card in order to cache the data. I've added the following code back in to setup():
pinMode(4, OUTPUT);
digitalWrite(4, HIGH);
The good news is that the Arduino made around 50 successful requests to Apache, and around 25 requests to the ruby server, each downloading the full payload. The bad news is that both runs still eventually hit a loop where the Arduino was still connected, but no data was available to be read. Subsequent runs saw the error reappear after as little as 10 requests, which is probably few enough to suggest that it's still not the root cause.
I'd be really interested in anyone who can run these examples on their own Arduinos to see if they definitely don't see this behaviour at all.
Additionally, would
usage of the SD card while the ethernet is active cause interference? Everything I've read implies that they are intended to be used at the same time (e.g. serving files from the SD card, which is a classic example), so that seems unlikely...
"Still connected" and "Done reading for now" back-to-back means the server is not finished sending packets. It just did not receive a new packet during that check.
Yeah, I can see what you mean, but I am reasonably confident my reading of the wireshark logs - the Arduino is definitely due to send the server an ACK packet, but there's nothing making it onto the IP stack on the server machine. So in a sense, you are describing the situation; it's just that the server hasn't sent any new packets, because it's still waiting for an acknowledgement of the previous one.