Created
February 15, 2011 18:48
-
-
Save rsyring/827989 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from isapi import isapicon, threaded_extension | |
import sys | |
import traceback | |
try: | |
from urllib import urlopen | |
except ImportError: | |
# py3k spelling... | |
from urllib.request import urlopen | |
import win32api | |
# sys.isapidllhandle will exist when we are loaded by the IIS framework. | |
# In this case we redirect our output to the win32traceutil collector. | |
if hasattr(sys, "isapidllhandle"): | |
import win32traceutil | |
from random import random | |
# The ISAPI extension - handles all requests in the site. | |
class Extension(threaded_extension.ThreadPoolExtension): | |
"Python sample Extension" | |
def Dispatch(self, ecb): | |
headers = """Content-Type: text/html\n\n""" | |
ecb.SendResponseHeaders("200 OK", headers, False) | |
ecb.WriteClient('HW from Extension Only %s' % random()) | |
ecb.DoneWithSession() | |
return isapicon.HSE_STATUS_SUCCESS | |
# The entry points for the ISAPI extension. | |
def __ExtensionFactory__(): | |
return Extension() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment