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

List:       helix-filesystem-cvs
Subject:    [Filesystem-cvs] http httpfsys.cpp, 1.171.2.2.4.16, 1.171.2.2.4.17 httpfsys.h, 1.57.8.3, 1.57.8.4
From:       dcollins () helixcommunity ! org
Date:       2013-11-18 21:09:24
[Download RAW message or body]

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

Modified Files:
      Tag: SERVER_NUCLEUS
	httpfsys.cpp httpfsys.h 
Log Message:
Synopsis
========
RPDS OSX-related updates to enable cloud login/logout and download

Branches:  SERVER_NUCLEUS
Reviewer:  Qiang


Description
===========
This implements changes related to RPDS on OS X, addressing several
issues, primarily related to cloud login/logout and cloud download, and
getting the databases functional.  Several of these changes have to do
with getting CloudMgr to work with httpfsys again and are not
OSX-specific.

These changes include:

* The $HOME/Movies folder is set as the user's "My Videos" folder.

* Sets various paths related to $HOME/Library/Real/RPDS.
  This directory tree is created on server startup if
  not present.

* Message Pipes moved to $HOME/Library/Real/RPDS/pipes/*

* Msgtest now generates randomized message pipe names,
  so multiple instances can be used concurrently.
  Cleanup and signal handling was added to msgtest to
  remove these on exiting or crashing.

* A bug was fixed where PipeInstance was declared as a
  struct but attempted to define constructor initialization.
  The constructor was not being called.  This resulted in
  the message pipe code using the wrong file descriptors,
  causing various weird bugs.  The fix was to make it a class.

* Added the ffmpeg binaries to the OSX "installer".

* Changed the default for server builds of httpfsys to not
  use the plugin's lock.  This isn't needed the way it is
  used in the server, and doesn't work right since it's
  used recursively which isn't supported with the type of
  lock it attempts to use.  Fixes various deadlock issues.

* Added some ifdef-out debugging to httpfsys.

* Cloudmgr now expects an HXR_OK+null_buffer at EOF rather than an
  HXR_FAIL, so I made the server build of httpfsys behave this way.

* Cloudmgr needed to be updated in a few places to accommodate
  different Stat() behavior from httpfsys, where it sends an HXR_OK
  but a size of zero.  We were literally taking the zero and
  reading zero bytes, which was not working :)

* Updated the server core initialization to not set several
  obsolete config settings.  These would get written to the
  config file if it was rewritten by the server.

* Fixed an obscure off-by-one in an CHXString assert.

* Implemented but commented-out changes related to 
  the Mac-specific client-id.  This will be enabled
  in a subsequent checkin.


Files Affected
==============
server_rn/nucleus/common/util/make_test_unix.pcf [added]
common/container/hxstring.cpp
server_rn/nucleus/cloud/manager/authmgr.cpp
server_rn/nucleus/cloud/manager/cldconfig.h
server_rn/nucleus/cloud/manager/cloudmgr.cpp
server_rn/nucleus/cloud/manager/downloadmgr.cpp
server_rn/nucleus/cloud/manager/msghandler.cpp
server_rn/nucleus/cloud/manager/msghandler.h
server_rn/nucleus/cloud/manager/syncmgr.cpp
server_rn/nucleus/cloud/protocol/protocol/authprotocol.cpp
server_rn/nucleus/cloud/protocol/protocol/cloudprotocol.cpp
server_rn/nucleus/cloud/protocol/upload/mediaupload.cpp
server_rn/nucleus/cms/library/platform/unix/unixlibrary.cpp
server_rn/nucleus/common/util/chxhttpfileobject.cpp
server_rn/nucleus/common/util/clientauth.cpp
server_rn/nucleus/common/util/make_test
server_rn/nucleus/common/util/make_test_win32.pcf
server_rn/nucleus/common/util/platform/unix/chxpipesunix.cpp
server_rn/nucleus/common/util/platform/unix/fileopsunix.cpp
server_rn/nucleus/common/util/platform/unix/useropsunix.cpp
server_rn/nucleus/common/util/pub/channelmsg.h
server_rn/nucleus/common/util/pub/platform/unix/chxpipesunix.h
server_rn/nucleus/common/util/test/platform/unix/msgtest.cpp
server_rn/nucleus/engine/bin/Umakefil
server_rn/nucleus/installer/make_tempdir_osx
server_rn/nucleus/installer/files/rpdsvc_osx_sample.cfg
filesystem/http/httpfsys.cpp
filesystem/http/httpfsys.h
server/engine/config/config.cpp
server/engine/core/Umakefil
server/engine/core/_main.cpp


Testing Performed
=================
Unit Tests:
- None

Integration Tests:
- Msgtest was used to login and logout.
- Msgtest was used to trigger a cloud download.
- Command-line sqlite and Sqlite Manager were used to examine
  the databases and verify certain data.
- Used two msgtest commands concurrently.

Leak Tests:
- None

Performance Tests:
- None

Platforms Tested:
    OSX: OSX 10.9 / x86_64
    WIN: Windows 7 64-bit
Builds Verified:
    OSX: XCode5 on OSX 10.9 / x86_64 / Debug
    WIN: win-x86-vc10 / Debug


QA Hints
========
N/A



Index: httpfsys.h
===================================================================
RCS file: /cvsroot/filesystem/http/httpfsys.h,v
retrieving revision 1.57.8.3
retrieving revision 1.57.8.4
diff -u -d -r1.57.8.3 -r1.57.8.4
--- httpfsys.h	11 Dec 2012 00:15:36 -0000	1.57.8.3
+++ httpfsys.h	18 Nov 2013 21:09:22 -0000	1.57.8.4
@@ -632,7 +632,7 @@
                                 IHXBuffer*              pBuffer,
                     UINT32                  ulHeaderLength
                             );
-    HX_RESULT       _HandleFail(UINT32 ulHTTPError);
+    HX_RESULT       _HandleFail(UINT32 ulHTTPError, IHXBuffer* pBuffer);
     HX_RESULT       _HandleUnAuthorized(HTTPResponseMessage* pMessage, IHXBuffer* \
pBuffer, UINT32 ulHeaderLength);  HX_RESULT       \
_HandleRedirect(HTTPResponseMessage* pMessage);  

Index: httpfsys.cpp
===================================================================
RCS file: /cvsroot/filesystem/http/httpfsys.cpp,v
retrieving revision 1.171.2.2.4.16
retrieving revision 1.171.2.2.4.17
diff -u -d -r1.171.2.2.4.16 -r1.171.2.2.4.17
--- httpfsys.cpp	9 Apr 2013 03:22:00 -0000	1.171.2.2.4.16
+++ httpfsys.cpp	18 Nov 2013 21:09:22 -0000	1.171.2.2.4.17
@@ -265,6 +265,15 @@
 
 #define ICECAST_META_SIZE_MULTIPLE                  16      // bytes
 
+#ifdef HELIX_FEATURE_SERVER_NUCLEUS
+#define HELIX_FEATURE_HTTP_EMPTY_BUFFER_AT_EOF
+#endif
+#ifdef HTTP_STDOUT_DEBUG
+#define STDOUT_DEBUG(x) HTTPStdoutDebug x
+extern void HTTPStdoutDebug(const char* szMessage, UINT32 ulHTTPError, UINT32 \
ulSize, IHXBuffer* pBuffer); +#else
+#define STDOUT_DEBUG(x) /**/
+#endif
 
 const char* const CHTTPFileSystem::zm_pDescription    = "RealNetworks HTTP File \
System with CHTTP Support";  const char* const CHTTPFileSystem::zm_pCopyright      = \
HXVER_COPYRIGHT; @@ -1173,7 +1182,11 @@
 #ifdef HELIX_FEATURE_SERVER_DRM_VCAS
     , m_bUserDrmVCAS(FALSE)
 #endif
+#if defined(HELIX_FEATURE_SERVER)
+    , m_bNoNeedLock(TRUE) // Server doesn't use this lock
+#else
     , m_bNoNeedLock(FALSE)
+#endif
     , m_nHTTPMethod(0)
 /*************************/
 {
@@ -2033,7 +2046,10 @@
         HX_LOCK(m_pMutex);
     }
 
-    HXLOGL3(HXLOG_HTTP, "Write (%lu)", pBuffer ? pBuffer->GetSize() : 0);
+    UINT32 ulSize = pBuffer ? pBuffer->GetSize() : 0;
+    HXLOGL3(HXLOG_HTTP, "Write (%lu)", ulSize);
+    STDOUT_DEBUG(("Write", 0, ulSize, pBuffer));
+
     HX_RESULT nRetVal = HXR_FAILED;
 
     if (m_pSocket && m_nPostDataSize && pBuffer)
@@ -3296,7 +3312,14 @@
                 {
                     HX_UNLOCK(m_pMutex);
                 }
+#ifdef HELIX_FEATURE_HTTP_EMPTY_BUFFER_AT_EOF
+                IHXBuffer* pBuffer = NULL;
+                m_pCommonClassFactory->CreateInstance(CLSID_IHXBuffer, \
(void**)&pBuffer); +                CallReadDone(HXR_OK, pBuffer);
+                HX_RELEASE(pBuffer);
+#else
                 CallReadDone(HXR_READ_ERROR, NULL);
+#endif
                 if (!m_bNoNeedLock)
                 {
                     HX_LOCK(m_pMutex);
@@ -5052,6 +5075,7 @@
                         m_pSocket->SelectEvents(HX_SOCK_EVENT_READ |
                                                 HX_SOCK_EVENT_CLOSE);
                     }
+                    STDOUT_DEBUG(("_WriteRequestChunk", 0, ulActual, pBuffer));
                 }
             }
         }
@@ -5923,11 +5947,12 @@
 //
 //
 HX_RESULT
-CHTTPFileObject::_HandleFail(UINT32 ulHTTPError)
+CHTTPFileObject::_HandleFail(UINT32 ulHTTPError, IHXBuffer* pBuffer)
 {
     HX_RESULT   theErr = HXR_OK;
 
     HXLOGL1(HXLOG_HTTP, "_HandleFail(%lu)", ulHTTPError);
+    STDOUT_DEBUG(("_HandleFail", ulHTTPError, (pBuffer ? pBuffer->GetSize() : 0), \
pBuffer));  
     if (ulHTTPError == 400)
     {
@@ -6014,6 +6039,7 @@
     HX_RESULT   theErr = HXR_OK;
 
     HXLOGL2(HXLOG_HTTP, "_HandleSuccess");
+    STDOUT_DEBUG(("_HandleSuccess", 0, (pBuffer ? pBuffer->GetSize() : 0), \
pBuffer));  
     // If we've been closed, then exit early
     if (m_bClosed) return HXR_OK;
@@ -8707,7 +8733,7 @@
                 if (!m_bReadHeaderDone)
                 {
                     // We couldn't recognize the headers, so fail.
-                    retVal = _HandleFail(400);
+                    retVal = _HandleFail(400, pBuffer);
                 }
                 else
                 {
@@ -8900,7 +8926,7 @@
             if (0 == strncasecmp((const char*)szHeader, "RTSP/", 5))
 
             {
-                retVal = _HandleFail(400);
+                retVal = _HandleFail(400, pBuffer);
                 goto cleanup;
             }
 
@@ -8946,7 +8972,7 @@
                             break;
                     }
                     HXLOGL1(HXLOG_HTTP, "CHTTPFileObject::HandleHeaderRead ICY \
                failed with status %u", statusCode);
-                    retVal = _HandleFail(statusCode);
+                    retVal = _HandleFail(statusCode, pBuffer);
                     goto cleanup;
                 }
             }
@@ -9356,12 +9382,12 @@
                     case 400: // Fail
                     case 404: // Not Found
                         {
-                            retVal = _HandleFail(ulHTTPStatus);
+                            retVal = _HandleFail(ulHTTPStatus, pBuffer);
                         }
                         break;
                     case 401: // Not Authorized
                         {
-                            retVal = _HandleFail(ulHTTPStatus);
+                            retVal = _HandleFail(ulHTTPStatus, pBuffer);
                         }
                         break;
                     case 407: // Proxy Authentication Required
@@ -9381,12 +9407,12 @@
                     case 416: // Invalid range request
                         m_LastError = HXR_INVALID_PARAMETER;
                         m_pFileResponse->SeekDone(HXR_FAILED);
-                        retVal = _HandleFail(ulHTTPStatus);
+                        retVal = _HandleFail(ulHTTPStatus, pBuffer);
                         break;
 
                     default:
                         {
-                            retVal = _HandleFail(400);
+                            retVal = _HandleFail(400, pBuffer);
                         }
                         break;
                 };
@@ -10486,5 +10512,35 @@
 
     return retVal;
 }
-                              
-                              
+
+#ifdef HTTP_STDOUT_DEBUG
+void
+HTTPStdoutDebug(const char* szMessage, UINT32 ulHTTPError, UINT32 ulSize, IHXBuffer* \
pBuffer) +{
+    const UCHAR* pBuf = pBuffer ? pBuffer->GetBuffer() : (UCHAR*)"";
+    char szBuf[2048];
+    if (ulSize > 2047) { ulSize = 2047; };
+    memcpy(szBuf, pBuffer->GetBuffer(), ulSize);
+    for (int i=0; i < ulSize; ++i)
+    {
+        if ((szBuf[i] < 32 || szBuf[i] > 126) && szBuf[i] != '\r' && szBuf[i] != \
'\n') +        {
+            szBuf[i] = '.';
+        };
+    }
+    szBuf[ulSize] = '\0';
+    if (ulHTTPError)
+    {
+        printf("CHTTPFileObject: %s (http_error=%lu, size=%lu):\n", szMessage, \
ulHTTPError, ulSize); +    }
+    else
+    {
+        printf("CHTTPFileObject: %s (size=%lu):\n", szMessage, ulSize);
+    }
+    printf("----------------------------------------------------------------------\n");
 +    printf("%s\n", szBuf);
+    printf("----------------------------------------------------------------------\n");
 +    fflush(stdout);
+}
+#endif
+


_______________________________________________
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