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
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
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
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