Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo


#5 Handle missing 'Content-Length' header field?

Satoshi Konno
Oliver Newell

Greetings Skonno...

A friend of mine got a Play@TV device recently
(www.playattv.com) and I tried interacting with it via
CLink. It didn't quite work, and
after a little snooping, I discovered that the device
was not putting a 'Content-Length' header in it's HTTP
responses. A little suprising, given that the device
uses Intel's UPNP MicroStack - maybe the PlayTV guys
got over-enthusiastic 'customizing' it? :)

Anyway, I managed to get it to work by putting a couple
of kludges in the CLink code. Basically I modified the
HTTPPacket.getContentLength() so it returned -1 (as
opposed to 0) if no Content-Length header was found,
and then I modified HTTPPacket.set( InputStream in) so
that if there was no Content-Length header in an
incoming HTTP response (first line starts with HTTP),
the reader code just reads until it hits EOF or
64Kbytes. I told you it was a kludge! :)

I don't know if you want to formally support this
device and similarly broken devices - in my opinion
they should fix their stuff (I sent them a note letting
them know). In any event, it might be nice to print a
warning message about the missing Content-Length field
so it's obvious when one has a slightly defective device.

Let me know if you want the source for my hacked-up
workaround - it may do more harm than good!



  • Satoshi Konno
    Satoshi Konno

    Logged In: YES

    Hi Oliver,

    Could you send the your fixed files ?

    I think that your implementation is no problem. Because
    CyberLink run as a HTTP v1.0 client, the socket stream would
    be closed when the server sends all date.

    The device might be released in Japan, and I find out it at
    Yahoo Auction in Japan. I would like to get it at a low price
    because I have interested in the Intel's UPNP MicroStack :-)

    PCast Play@TV : PC-MP1000

  • Satoshi Konno
    Satoshi Konno

    • assigned_to: nobody --> skonno