예제 #1
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
예제 #2
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;
예제 #3
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;
예제 #4
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
예제 #5
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
예제 #6
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