[prev in list] [next in list] [prev in thread] [next in thread] 

List:       helix-filesystem-cvs
Subject:    [Filesystem-cvs] http httpfsys.cpp,1.137,1.138
From:       demiurgo () helixcommunity ! org
Date:       2009-10-23 15:17:57
Message-ID: 200910231629.n9NGT3h8020080 () mailer ! progressive-comp ! com
[Download RAW message or body]

Update of /cvsroot/filesystem/http
In directory cvs01.internal.helixcommunity.org:/tmp/cvs-serv14301

Modified Files:
	httpfsys.cpp 
Log Message:
"Nokia submits this code under the terms of a commercial contribution agreement with \
Real Networks, and I am authorized to contribute this code under said agreement."

Modified by: ext-jesus.1.rodriguez@nokia.com
Reviewed by:
Date: Sep 30, 2009
Project: SymbianMmf_wm
ErrorId: LJLI-7W6AH3

Synopsis: Helix doesn't report "service full" event when a shoutcast server reaches \
max user count.

Overview:
When a Shoutcast server cannot service any further connections, it returns status \
"ICY 400 Service Full". Helix does not act accordingly and hangs waiting for data to \
play.

Solution:
CHTTPFileObject::HandleHeaderRead detects whether an HTTP request has been answered \
with an ICY response, but it assumes said answer to be successful (200 OK). This fix \
adds some logic to check the status code of the ICY response, map it to an HTTP \
status code and abort via CHTTPFileObject::_HandleFail, if applicable.

In the particular case of "ICY 400 Service Full" and "ICY 401 Service Unavailable", \
the most appropriate HTTP code is "503 Service Unavailable", which maps to \
HXR_PE_SERVICE_UNAVAILABLE; this will be mapped on Symbian to KErrServerBusy instead \
of KErrMMInvalidProtocol, in order to return a more precise code to any client of the \
Helix API.

Modified files:
/filesystem/http/httpfsys.cpp
/clientapps/symbianMmf/common/hxmmfbasectrl.cpp

New files: None
Image size and heap use impact: Negligible
Module Release testing (STIF): Passed
Test case(s) added: None
Memory leak check performed: Yes, no new leaks introduced.
Platforms and Profiles Build verified: helix-client-s60-50-mmf-mdf-arm
Platforms and Profiles Functionality verified: armv5
Branch: 223Cays, 210Cays, 310Atlas, 401Brizo, HEAD


Index: httpfsys.cpp
===================================================================
RCS file: /cvsroot/filesystem/http/httpfsys.cpp,v
retrieving revision 1.137
retrieving revision 1.138
diff -u -d -r1.137 -r1.138
--- httpfsys.cpp	12 Oct 2009 19:31:13 -0000	1.137
+++ httpfsys.cpp	23 Oct 2009 15:17:55 -0000	1.138
@@ -5447,6 +5447,14 @@
             ReportGeneralFailure();
         }
     }
+    else if (ulHTTPError == 503)
+    {
+        theErr = HXR_PE_SERVICE_UNAVAILABLE;
+        if (m_bOnServer)
+        {
+            ReportGeneralFailure();
+        }
+    }
     else
     {
         theErr = HXR_DOC_MISSING;
@@ -8317,6 +8325,8 @@
         char* szHeader = (char*) pBuffer->GetBuffer();
         UINT32 ulLength = pBuffer->GetSize();
 
+        HXLOGL4(HXLOG_HTTP, "CHTTPFileObject::HandleHeaderRead received %s", (const \
char*)szHeader); +
         // Assume this is not Shoutcast
         if (!m_pLastHeader)
         {
@@ -8377,7 +8387,7 @@
             }
 
             // The Darwin server streams mp3 using ShoutCast (or at least they
-            // they use the ShoutCast mechanism for including meta data in
+            // use the ShoutCast mechanism for including meta data in
             // the mp3 stream).  So, check the header for "icy-metaint", and
             // enable ShoutCast mode.
 
@@ -8389,6 +8399,27 @@
             {
                 m_bShoutcast = TRUE;
                 m_ulMinStartupLengthNeeded = \
HTTP_NONSTANDARD_MIN_STARTUP_LENGTH_NEEDED; +
+                UINT32 statusCode = atoi(szHeader+3); // Skip the ICY declaration \
and get the status code. +                if(statusCode >= 400)
+                {
+                    switch(statusCode)
+                    {
+                        // Aside from 200 OK, ICY status codes do not match HTTP \
codes +                        // e.g. there are some ICY 4xx codes that are \
server-side errors +                        // and should be mapped to HTTP 5xx.
+                        case 400: // Service Full
+                        case 401: // Service Unavailable
+                            statusCode = 503;
+                            break;
+                        default:
+                            statusCode = 400;
+                            break;
+                    }
+                    HXLOGL1(HXLOG_HTTP, "CHTTPFileObject::HandleHeaderRead ICY \
failed with status %u", statusCode); +                    retVal = \
_HandleFail(statusCode); +                    goto cleanup;
+                }
             }
             else
             {


_______________________________________________
Filesystem-cvs mailing list
Filesystem-cvs@helixcommunity.org
http://lists.helixcommunity.org/mailman/listinfo/filesystem-cvs


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic