Some suggestion for HTTPRequest class

Hao Hu
2011-07-25
2013-05-02
  • Hao Hu
    Hao Hu
    2011-07-25

    Hello everyone,
    I have read the source code of HTTPRequest.java, and it contains a post method with the fixed timeout option. In other words, both SOAP request and XML description retrieval invoke such method. But it will raise some problem. For example, there are several UPnP devices in the same subnet, but some UPnP device has a very bad implementation (very common sense), it does not hold any URL for some description file. In this case, the control point will be hanged for a while, which will give some user an illusion that some devices cannot be found. To solve this problem, we should just set the timeout shorter. However, it will result in another problem. In the UPnP AV, we send a "Browse" action to Media Server, if the MediaServer have a lot content,  longer timeout is expected. Therefore, I think, is it possible to add a timeout parameter for the post method in order to adapt the different usages.
    Thanks for any help and suggestions.
    Best regards,
    Hao Hu

     
  • Hao Hu
    Hao Hu
    2011-07-25

    Regarding to the previous post. The WD TV Live Hub maybe have a bug, it responds different messages:
    HTTP/1.1 200 OK
    LOCATION: http://192.168.200.159:61538/
    EXT:
    SERVER: POSIX, UPnP/1.0, Intel MicroStack/1.0.1497
    USN: uuid:xx-xxx-xxx-xxx-xxx-xxx::upnp:rootdevice
    CACHE-CONTROL: max-age=1800
    ST: upnp:rootdevice

    HTTP/1.1 200 OK
    CACHE-CONTROL: max-age=1810
    DATE: Mon, 25 Jul 2011 09:20:40 GMT
    EXT:
    LOCATION: http://192.168.200.159:9000/DeviceDescription.xml
    SERVER: Linux/2.x.x, UPnP/1.0, pvConnect UPnP SDK/1.0
    ST: upnp:rootdevice
    USN: uuid:xxxxxx-xxxx-xxxx-xxxx-xxxxxxx::upnp:rootdevice
    Content-Length: 0

    In fact, the location url of the first url is not reachable, which results in that Parser::parse method will be hanged for a certain time, the upcoming devices cannot be discovered. So I suggest that,
    after this statement
    HttpURLConnection urlCon = (HttpURLConnection)locationURL.openConnection();
    Theses statements should be appended.
    urlCon.setConectTimeout(…);
    urlCon.setReadTimeout(….);
    Thanks for any kinds of comment.
    Cheers,
    Hao Hu

     
  • Satoshi Konno
    Satoshi Konno
    2011-07-27

    Hi Hao,

    I will add a global method into the ControlPoint class for your suggestion as the following.

      ControlPoint.setConnectionTimeout(…);

    Do you have any suggestions ?

    Best Regards,

    Satoshi Konno

     
  • Hao Hu
    Hao Hu
    2011-07-28

    Hi Satoshi,
    Thanks for you fast reply. I am very interesting in this project. How can I become the committer or developer of this project.
    Best Regards,
    Hao Hu

     
  • Satoshi Konno
    Satoshi Konno
    2011-07-29

    Hi Hao,

    I have added your account, horsson, into the project as a developer.

    Please check it :-)

    Best Regards,

    Satoshi Konno

     
  • Hao Hu
    Hao Hu
    2011-07-29

    Hi Satoshi,
    Thanks very much. I will take my spare time to check the open issues and open discussion.
    Best Regards,
    Hao Hu