Esempio n. 1
0
def main():
    """
    Main function a la C/C++. Returns exit code.
    """

    oSrvGlue = WebServerGlueCgi(g_ksValidationKitDir, fHtmlOutput = False);
    try:
        oWui = WuiMain(oSrvGlue);
        oWui.dispatchRequest();
        oSrvGlue.flush();
    except Exception as oXcpt:
        return oSrvGlue.errorPage('Internal error: %s' % (str(oXcpt),), sys.exc_info());

    return 0;
Esempio n. 2
0
def main():
    """
    Main function a la C/C++. Returns exit code.
    """

    oSrvGlue = WebServerGlueCgi(g_ksValidationKitDir, fHtmlOutput = True);
    try:
        oWui = WuiAdmin(oSrvGlue);
        oWui.dispatchRequest();
        oSrvGlue.flush();
    except Exception as oXcpt:
        return oSrvGlue.errorPage('Internal error: %s' % (str(oXcpt),), sys.exc_info());

    return 0;
Esempio n. 3
0
def main():
    """
    Main function a la C/C++. Returns exit code.
    """

    oSrvGlue = WebServerGlueCgi(g_ksValidationKitDir, fHtmlOutput=False)
    oCtrl = TestBoxController(oSrvGlue)
    try:
        oCtrl.dispatchRequest()
        oSrvGlue.flush()
    except Exception as oXcpt:
        return oSrvGlue.errorPage('Internal error: %s' % (str(oXcpt), ),
                                  sys.exc_info(),
                                  config.g_ksTestBoxDispXpctLog)
    return 0
Esempio n. 4
0
def main():
    """
    Main function a la C/C++. Returns exit code.
    """

    oSrvGlue = WebServerGlueCgi(g_ksValidationKitDir, fHtmlOutput = False);
    oCtrl = TestBoxController(oSrvGlue);
    try:
        oCtrl.dispatchRequest()
        oSrvGlue.flush();
    except Exception as oXcpt:
        return oSrvGlue.errorPage('Internal error: %s' % (str(oXcpt),),
                                  sys.exc_info(),
                                  config.g_ksTestBoxDispXpctLog);
    return 0;
Esempio n. 5
0
def main():
    """
    Main function a la C/C++. Returns exit code.
    """

    oSrvGlue = WebServerGlueCgi(g_ksValidationKitDir, fHtmlOutput=False)
    try:
        oDisp = StatusDispatcher(oSrvGlue)
        oDisp.dispatchRequest()
        oSrvGlue.flush()
    except Exception as oXcpt:
        return oSrvGlue.errorPage('Internal error: %s' % (str(oXcpt), ),
                                  sys.exc_info())

    return 0
Esempio n. 6
0
def main():
    """
    Main function a la C/C++. Returns exit code.
    """

    oSrvGlue = WebServerGlueCgi(g_ksValidationKitDir, fHtmlOutput=True)
    try:
        oSrvGlue.debugInfoPage()
        oSrvGlue.flush()
    except Exception as oXcpt:
        return oSrvGlue.errorPage('Internal error: %s' % (str(oXcpt), ),
                                  sys.exc_info())

    return 0
Esempio n. 7
0
def main():
    """
    Main function a la C/C++. Returns exit code.
    """

    oSrvGlue = WebServerGlueCgi(g_ksValidationKitDir, fHtmlOutput = True);
    try:
        oSrvGlue.debugInfoPage();
        oSrvGlue.flush();
    except Exception as oXcpt:
        return oSrvGlue.errorPage('Internal error: %s' % (str(oXcpt),), sys.exc_info());

    return 0;
Esempio n. 8
0
def main():
    """
    Main function a la C/C++. Returns exit code.
    """

    oSrvGlue = WebServerGlueCgi(g_ksValidationKitDir, fHtmlOutput = True);
    sUserAgent = oSrvGlue.getUserAgent();
    oSrvGlue.setHeaderField('Status', '401 Unauthorized to access the document');
    oSrvGlue.setHeaderField('WWW-authenticate', 'Basic realm="Test Manager"');
    if  (sUserAgent.startswith('Mozilla/') and sUserAgent.find('AppleWebKit/') > 0) \
     or False:
        oSrvGlue.write('<p>Attempting to log out an Apple browser...</p>');
    else:
        oSrvGlue.write('<p>Sorry, not sure this will work...</p>');
        oSrvGlue.write('<p>User-Agent:' + sUserAgent + '</p>');

    oSrvGlue.write('<p><a href="%sadmin.py">Log in</a> under another user name.</p>' %
                   (oSrvGlue.getBaseUrl(),))

    oSrvGlue.write('<hr/><p>debug info:</p>');
    oSrvGlue.debugInfoPage();
    oSrvGlue.flush();

    return 0;
Esempio n. 9
0
def main():
    """
    Main function a la C/C++. Returns exit code.
    """

    oSrvGlue = WebServerGlueCgi(g_ksValidationKitDir, fHtmlOutput = True)
    sUser = oSrvGlue.getLoginName()
    if sUser != oSrvGlue.ksUnknownUser and sUser != 'logout':
        oSrvGlue.write('<p>Broken apache config!\n'
                       'The logout.py script should be configured with .htaccess-logout and require user logout!</p>')
    else:
        oSrvGlue.write('<p>Successfully logged out!</p>')
        oSrvGlue.write('<p><a href="%sadmin.py">Log in</a> under another user name.</p>' %
                       (oSrvGlue.getBaseUrl(),))


        oSrvGlue.write('<hr/><p>debug info:</p>')
        oSrvGlue.debugInfoPage()
    oSrvGlue.flush()

    return 0
Esempio n. 10
0
def main():
    """
    Main function a la C/C++. Returns exit code.
    """

    oSrvGlue = WebServerGlueCgi(g_ksValidationKitDir, fHtmlOutput=True)
    sUserAgent = oSrvGlue.getUserAgent()
    oSrvGlue.setHeaderField('Status',
                            '401 Unauthorized to access the document')
    oSrvGlue.setHeaderField('WWW-authenticate', 'Basic realm="Test Manager"')
    if  (sUserAgent.startswith('Mozilla/') and sUserAgent.find('AppleWebKit/') > 0) \
     or False:
        oSrvGlue.write('<p>Attempting to log out an Apple browser...</p>')
    else:
        oSrvGlue.write('<p>Sorry, not sure this will work...</p>')
        oSrvGlue.write('<p>User-Agent:' + sUserAgent + '</p>')

    oSrvGlue.write(
        '<p><a href="%sadmin.py">Log in</a> under another user name.</p>' %
        (oSrvGlue.getBaseUrl(), ))

    oSrvGlue.write('<hr/><p>debug info:</p>')
    oSrvGlue.debugInfoPage()
    oSrvGlue.flush()

    return 0
Esempio n. 11
0
def main():
    """
    Main function a la C/C++. Returns exit code.
    """

    oSrvGlue = WebServerGlueCgi(g_ksValidationKitDir, fHtmlOutput = True)
    sUser = oSrvGlue.getLoginName()
    if sUser != oSrvGlue.ksUnknownUser and sUser != 'logout':
        oSrvGlue.write('<p>Broken apache config!\n'
                       'The logout.py script should be configured with .htaccess-logout and require user logout!</p>')
    else:
        oSrvGlue.write('<p>Successfully logged out!</p>')
        oSrvGlue.write('<p><a href="%sadmin.py">Log in</a> under another user name.</p>' %
                       (oSrvGlue.getBaseUrl(),))


        oSrvGlue.write('<hr/><p>debug info:</p>')
        oSrvGlue.debugInfoPage()
    oSrvGlue.flush()

    return 0
Esempio n. 12
0
def main():
    """
    Main function a la C/C++. Returns exit code.
    """

    oSrvGlue = WebServerGlueCgi(g_ksValidationKitDir, fHtmlOutput=False)
    try:
        oMain = RestMain(oSrvGlue)
        oMain.dispatchRequest()
        oSrvGlue.flush()
    except RestDispException as oXcpt:
        oSrvGlue.setStatus(oXcpt.iStatus)
        oSrvGlue.setHeaderField('tm-error-message', str(oXcpt))
        oSrvGlue.write('error: ' + str(oXcpt))
        oSrvGlue.flush()
    except Exception as oXcpt:
        return oSrvGlue.errorPage('Internal error: %s' % (str(oXcpt), ),
                                  sys.exc_info(),
                                  config.g_ksTestBoxDispXpctLog)

    return 0