OpenHome Forum
PS3 interoperability problem - Printable Version

+- OpenHome Forum (http://forum.openhome.org)
+-- Forum: OpenHome (/forumdisplay.php?fid=1)
+--- Forum: Net (/forumdisplay.php?fid=5)
+--- Thread: PS3 interoperability problem (/showthread.php?tid=1037)

Pages: 1 2


PS3 interoperability problem - simoncn - 29-07-2012 06:13 PM

After further testing and debugging (thanks, bubbleguuum!), the PS3 interoperability problem has been identified. ohNet is using HTTP chunked encoding to send action responses, and the PS3 is unable to handle this.

The UPnP Device Architecture 1.1 spec lists three ways to send the action response:

a) For an HTTP 1.1 control point, the device can choose to use chunked encoding

b) For an HTTP 1.1 or 1.0 control point, the device can choose to include the Content-Length header and not use chunked encoding

c) For an HTTP 1.1 or 1.0 control point, the device can choose to close the session after sending the response and not include the Content-Length header and not use chunked encoding

The code in DviServerUpnp.cpp always uses option a). This doesn't work with HTTP 1.0 control points. It should work with HTTP 1.1 control points, but for some reason the PS3 won't accept it even though it identifies itself as HTTP 1.1.

As an experiment, I changed the code in DviServerUpnp.cpp to use option c) instead of option a). This works with the PS3, and it should also work with all other UPnP 1.1 and 1.0 control points. To make this change, the following lines in DviServerUpnp.cpp need to be removed:

Line 1051: iWriterResponse->WriteHeader(Http::kHeaderTransferEncoding, Http::kTransferEncodingChunked);

Line 1056: iWriterChunked->SetChunked(true);

Line 1084: iWriterResponse->WriteHeader(Http::kHeaderTransferEncoding, Http::kTransferEncodingChunked);

Line 1088: iWriterChunked->SetChunked(true);

There's one more change that would be needed to make ohNet interoperate with HTTP 1.0 control points, though it isn't needed to solve the PS3 issue. When sending a property change notification, chunked encoding is always used (lines 332 and 340). Removing chunked encoding for this isn't as simple as removing it for action responses, because the session would need to be closed after sending the notification. The code in PropertyWriterUpnp::PropertyWriteEnd() doesn't do this, and I'm not sure how to modify this code to close the session before reading the response.

Note: Page 99 of the UPnP Device Architecture 1.1 spec has confusing wording describing when the session needs to be closed if not using chunked encoding and not using Content-Length. It says that the Origin Server needs to close the session after sending the response, but the word response appears to be a cut-and-paste error and should say request instead. If the device doesn't use chunked encoding or Content-Length, and doesn't close the session after sending the notification request, Kinsky produces a 412 error.


RE: PS3 interoperability problem - simonc - 30-07-2012 08:14 AM

It should be pretty straightforward to change this for both action responses and event notifications. I'll make the changes this week and will let you know when they're available.

Out of interest, did you find that the PS3 supports chunking in event notifications but not action responses? Or does it fall back to polling state getter actions when it fails to understand an event?


RE: PS3 interoperability problem - bubbleguuum - 30-07-2012 11:21 AM

(30-07-2012 08:14 AM)simonc Wrote:  Out of interest, did you find that the PS3 supports chunking in event notifications but not action responses? Or does it fall back to polling state getter actions when it fails to understand an event?

The PS3 doesn't use eventing at all: it is a primitive CP and most do mostly Browse() actions


RE: PS3 interoperability problem - simonc - 30-07-2012 12:18 PM

(30-07-2012 11:21 AM)bubbleguuum Wrote:  
(30-07-2012 08:14 AM)simonc Wrote:  Out of interest, did you find that the PS3 supports chunking in event notifications but not action responses? Or does it fall back to polling state getter actions when it fails to understand an event?

The PS3 doesn't use eventing at all: it is a primitive CP and most do mostly Browse() actions

Thanks, that makes sense. It'd have seemed odd if one part of a CP managed to implement HTTP 1.1 while another was stuck on 1.0.


RE: PS3 interoperability problem - simonc - 30-07-2012 12:49 PM

(30-07-2012 08:14 AM)simonc Wrote:  It should be pretty straightforward to change this for both action responses and event notifications. I'll make the changes this week and will let you know when they're available.

Out of interest, did you find that the PS3 supports chunking in event notifications but not action responses? Or does it fall back to polling state getter actions when it fails to understand an event?

This problem sounded vaguely familiar. Checking through recent commits shows that Linn's Songbox media server also had problems with PS3. These were fixed by making a change to the SOAP messages ohNet responds with. The commit https://github.com/openhome/ohNet/commit/2caefa76c77f80033a4e6dec0b4fe1a07276797d covered this on 5th June.

If you aren't already using a more recent version of ohNet, can you try updating to pick up this change and try again with PS3 please?


RE: PS3 interoperability problem - simoncn - 30-07-2012 06:08 PM

(30-07-2012 12:49 PM)simonc Wrote:  This problem sounded vaguely familiar. Checking through recent commits shows that Linn's Songbox media server also had problems with PS3. These were fixed by making a change to the SOAP messages ohNet responds with. The commit https://github.com/openhome/ohNet/commit/2caefa76c77f80033a4e6dec0b4fe1a07276797d covered this on 5th June.

If you aren't already using a more recent version of ohNet, can you try updating to pick up this change and try again with PS3 please?

I have a feeling that it may be this change rather than the change to non-chunked encoding that made the PS3 work.

The original test didn't include this change and used chunked encoding. This test failed.

The recent test did include this change and didn't use chunked encoding. This test passed.

I'll send bubbleguuum another build that has this change and uses chunked encoding. If this works with the PS3, the issue was fixed by this change and wasn't caused by chunked encoding.

My apologies for (possibly) jumping to the wrong conclusion.


RE: PS3 interoperability problem - simoncn - 30-07-2012 08:16 PM

(30-07-2012 06:08 PM)simoncn Wrote:  I'll send bubbleguuum another build that has this change and uses chunked encoding. If this works with the PS3, the issue was fixed by this change and wasn't caused by chunked encoding.

My apologies for (possibly) jumping to the wrong conclusion.

The PS3 problem is confirmed as not being related to chunked encoding. The PS3 and MinimServer/ohNet are interoperating using the current ohNet code, including the 5th June change but not including my changes to remove chunked encoding.


RE: PS3 interoperability problem - simonc - 31-07-2012 08:22 AM

(30-07-2012 08:16 PM)simoncn Wrote:  
(30-07-2012 06:08 PM)simoncn Wrote:  I'll send bubbleguuum another build that has this change and uses chunked encoding. If this works with the PS3, the issue was fixed by this change and wasn't caused by chunked encoding.

My apologies for (possibly) jumping to the wrong conclusion.

The PS3 problem is confirmed as not being related to chunked encoding. The PS3 and MinimServer/ohNet are interoperating using the current ohNet code, including the 5th June change but not including my changes to remove chunked encoding.

Glad you've got it working now. Thanks for putting so much effort into tracing this through ohNet too!


RE: PS3 interoperability problem - simoncn - 04-01-2013 03:22 PM

I've had another report of an interoperability problem, this time with a 2011 model Samsung TV. This is a UPnP 1.0 control point, and the traces I've got suggest that the problem is caused by ohNet sending chunked encoding in the response to an HTTP 1.0 request.

Did the change to avoid sending chunked encoding to HTTP 1.0 control points ever get into ohNet? Looking at the latest code in DviServerUPnP, I don't see it there.


RE: PS3 interoperability problem - simonc - 04-01-2013 03:47 PM

(04-01-2013 03:22 PM)simoncn Wrote:  I've had another report of an interoperability problem, this time with a 2011 model Samsung TV. This is a UPnP 1.0 control point, and the traces I've got suggest that the problem is caused by ohNet sending chunked encoding in the response to an HTTP 1.0 request.

Did the change to avoid sending chunked encoding to HTTP 1.0 control points ever get into ohNet? Looking at the latest code in DviServerUPnP, I don't see it there.

I never got round to these changes I'm afraid. I've added this to the backlog; it won't be forgotten but probably won't appear for a few weeks.