Permalink
Browse files

Change the url for the status html/xml pages and Static html server

Status URL has moved to these Valid URLS:

  Html -    http://mythbackend:6544/Status/
            http://mythbackend:6544/Status/GetStatusHTML

  Xml -     http://mythbackend:6544/Status/xml
            http://mythbackend:6544/Status/GetStatus

The html server now serves static pages from:

     http://mythbackend:6544/
  • Loading branch information...
1 parent 9b43aa8 commit 73c3b8843b4575a56a65e14565133de50a744959 @dblain dblain committed Mar 10, 2011
View
7 mythtv/libs/libmythupnp/htmlserver.cpp
@@ -36,7 +36,7 @@ HtmlServerExtension::HtmlServerExtension( const QString sSharePath)
{
// Cache the absolute path for the share directory.
- QDir dir( sSharePath );
+ QDir dir( sSharePath + "/html" );
dir.makeAbsolute();
@@ -59,11 +59,14 @@ bool HtmlServerExtension::ProcessRequest( HttpWorkerThread *, HTTPRequest *pRequ
{
if (pRequest)
{
- if ( pRequest->m_sBaseUrl.startsWith("/html") == false)
+ if ( pRequest->m_sBaseUrl.startsWith("/") == false)
return( false );
QFileInfo oInfo( m_sAbsoluteSharePath + pRequest->m_sResourceUrl );
+ if (oInfo.isDir())
+ oInfo.setFile( oInfo.filePath() + "/index.html" );
+
if (oInfo.exists() == true )
{
oInfo.makeAbsolute();
View
16 mythtv/libs/libmythupnp/httpserver.cpp
@@ -38,6 +38,7 @@
#include "compat.h"
#include "mythdirs.h"
#include "mythverbose.h"
+#include "htmlserver.h"
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
@@ -83,6 +84,15 @@ HttpServer::HttpServer() : QTcpServer(), ThreadPool("HTTP")
VERBOSE(VB_UPNP, QString( "HttpServer() - SharePath = %1")
.arg(m_sSharePath));
+ // ----------------------------------------------------------------------
+ // The HtmlServer Extension is our fall back if a request isn't processed
+ // by any other extension. (This is needed here since it listens for
+ // '/' as it's base url ).
+ // ----------------------------------------------------------------------
+
+ m_pHtmlServer = new HtmlServerExtension( m_sSharePath );
+
+
// -=>TODO: Load Config XML
// -=>TODO: Load & initialize - HttpServerExtensions
}
@@ -97,6 +107,9 @@ HttpServer::~HttpServer()
{
delete m_extensions.takeFirst();
}
+
+ if (m_pHtmlServer != NULL)
+ delete m_pHtmlServer;
}
/////////////////////////////////////////////////////////////////////////////
@@ -180,6 +193,9 @@ void HttpServer::DelegateRequest( HttpWorkerThread *pThread, HTTPRequest *pReque
m_rwlock.unlock();
if (!bProcessed)
+ bProcessed = m_pHtmlServer->ProcessRequest( pThread, pRequest );
+
+ if (!bProcessed)
{
pRequest->m_eResponseType = ResponseTypeHTML;
pRequest->m_nResponseStatus = 404;
View
2 mythtv/libs/libmythupnp/httpserver.h
@@ -98,6 +98,8 @@ class UPNP_PUBLIC HttpServer : public QTcpServer,
QReadWriteLock m_rwlock;
HttpServerExtensionList m_extensions;
+ HttpServerExtension* m_pHtmlServer;
+
virtual WorkerThread *CreateWorkerThread( ThreadPool *,
const QString &sName );
virtual void incomingConnection ( int socket );
View
7 mythtv/programs/mythbackend/httpstatus.cpp
@@ -72,7 +72,7 @@ HttpStatus::~HttpStatus()
HttpStatusMethod HttpStatus::GetMethod( const QString &sURI )
{
- if (sURI.isEmpty() ) return( HSM_GetStatusHTML );
+ if (sURI == "Status" ) return( HSM_GetStatusHTML );
if (sURI == "GetStatusHTML" ) return( HSM_GetStatusHTML );
if (sURI == "GetStatus" ) return( HSM_GetStatusXML );
if (sURI == "xml" ) return( HSM_GetStatusXML );
@@ -91,8 +91,11 @@ bool HttpStatus::ProcessRequest( HttpWorkerThread * /* pThread */,
{
if (pRequest)
{
- if (pRequest->m_sBaseUrl != "/")
+ if ((pRequest->m_sBaseUrl != "/Status" ) &&
+ (pRequest->m_sResourceUrl != "/Status" ))
+ {
return( false );
+ }
switch( GetMethod( pRequest->m_sMethod ))
{
View
4 mythtv/programs/mythbackend/mediaserver.cpp
@@ -15,7 +15,6 @@
#include "upnpcdstv.h"
#include "upnpcdsmusic.h"
#include "upnpcdsvideo.h"
-#include "htmlserver.h"
#include "serviceHosts/mythServiceHost.h"
#include "serviceHosts/guideServiceHost.h"
@@ -59,7 +58,6 @@ MediaServer::MediaServer( bool bIsMaster, bool bDisableUPnp /* = FALSE */ )
return;
}
-
m_pHttpServer = new HttpServer();
if (!m_pHttpServer->listen(QHostAddress::Any, nPort))
@@ -103,8 +101,6 @@ MediaServer::MediaServer( bool bIsMaster, bool bDisableUPnp /* = FALSE */ )
m_pHttpServer->RegisterExtension( new ContentServiceHost( m_sSharePath ));
m_pHttpServer->RegisterExtension( new DvrServiceHost ( m_sSharePath ));
- m_pHttpServer->RegisterExtension( new HtmlServerExtension( m_sSharePath ));
-
if (sIP == "localhost" || sIP.startsWith("127."))
{
VERBOSE(VB_IMPORTANT, "MediaServer:: Loopback address specified - "

0 comments on commit 73c3b88

Please sign in to comment.