×

Discussion Board

Results 1 to 2 of 2
  1. #1
    Registered User
    Join Date
    Feb 2008
    Posts
    2

    Exclamation S40 devices do not handle HTTP HEAD response correctly

    I have a J2ME application that runs on S40, S60 and many other devices (SE, BlackBerry). This application uses an HTTP HEAD request to ping the server and verify that it is alive.

    On an S60 device this works perfectly no matter what content I have inside the HTML file that is the subject of the HEAD request. On an S40 the J2ME software throws an IOException if the file is not empty.

    I have tracked this down to what I believe is the developers of the S40 software misinterpreting the HTTP specification. The spec says that the headers in the HEAD response should the same as those of the equivalent HTTP GET request, it's is just that there should be no content.
    http://www.w3.org/Protocols/rfc2616/...c9.html#sec9.4

    I believe that the S40 device sees the content length header in the HEAD response and then throws the exception when it detects that there is no body to the response. This problem also occurs on a Blackberry model I tried. The S60 device operates correctly. Below is an example.

    Code:
    Client [xxx] HTTP request at 2008-12-08 07:03:13.586 +0100
    reassembled from segment(s) [74]
        HTTP request
            HEAD / HTTP/1.1
            User-Agent: curl/7.18.2 (i386-redhat-linux-gnu) libcurl/7.18.2
    NSS/3.12.0.3 zlib/1.2.3 libidn/0.6.14 libssh2/0.18
            Host: xxx
            Accept: */*
        Data (0/0 bytes printed)
    
    Server [xxx] HTTP response at 2008-12-08 07:03:13.586 +0100
    reassembled from segment(s) [76]
        HTTP response
            HTTP/1.1 200 OK
            Server: Apache-Coyote/1.1
            Set-Cookie: JSESSIONID=F9027A6CF9C4BFC585CBDBC59C68D7CF; Path=/
            Content-Type: text/html;charset=ISO-8859-1
            Content-Length: 61
            Date: Mon, 08 Dec 2008 06:03:13 GMT
        Text data (0 bytes)
    I solved this problem by just ensuring that the file on the server that is the subject of the HTTP HEAD request is empty. This causes the content length header to be set to zero and the S40 phones are happy.

  2. #2
    Super Contributor
    Join Date
    Jun 2007
    Location
    Mumbai
    Posts
    539

    Re: S40 devices do not handle HTTP HEAD response correctly

    hi,
    I have also faced soem thing like this. it seems on series 40 after opening conenction when u make first request to get any thing like conn.getStatus , the native system blocks ur flow there and gets all data from server, buffer it, then delivers u all. if u downloading big file then u will notice this. even i have noticed that u can create multiple request of http at same time on s40. the system makes que of all request and service it one by one. It caused many issues when i was developing my last client. and best part is while development u wont notice this cause on emulator there is nothing like this, it allows multiple connection and all.
    au revoir
    Prakash Raman

Similar Threads

  1. Problem retreiving custom HTTP response header
    By hmeet2 in forum Symbian Networking & Messaging (Closed)
    Replies: 0
    Last Post: 2007-01-03, 09:35
  2. Urgent: Wrong Http response in Nokia devices (platform 1.0)
    By rab_gandhi in forum Mobile Java Networking & Messaging & Security
    Replies: 0
    Last Post: 2005-06-08, 10:09
  3. Receive uncomplete HTTP response
    By apitoman in forum Symbian Networking & Messaging (Closed)
    Replies: 6
    Last Post: 2004-03-24, 16:15
  4. Replies: 1
    Last Post: 2002-07-22, 07:57

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×