comparison sat_pubsub/gateway.py @ 275:9c74cd2635f6

Fix getPageWithFactory
author Christopher Zorn <tofu@thetofu.com>
date Thu, 01 Aug 2013 16:22:14 -0700
parents 6641ea7990ee
children 002c59dbc23f
comparison
equal deleted inserted replaced
274:6641ea7990ee 275:9c74cd2635f6
733 error. 733 error.
734 734
735 See HTTPClientFactory to see what extra args can be passed. 735 See HTTPClientFactory to see what extra args can be passed.
736 """ 736 """
737 737
738 scheme, host, port, path = client._parse(url)
739 factory = client.HTTPClientFactory(url, *args, **kwargs) 738 factory = client.HTTPClientFactory(url, *args, **kwargs)
740 factory.protocol.handleStatus_204 = lambda self: self.handleStatus_200() 739 factory.protocol.handleStatus_204 = lambda self: self.handleStatus_200()
741 740
742 if scheme == 'https': 741 if factory.scheme == 'https':
743 from twisted.internet import ssl 742 from twisted.internet import ssl
744 if contextFactory is None: 743 if contextFactory is None:
745 contextFactory = ssl.ClientContextFactory() 744 contextFactory = ssl.ClientContextFactory()
746 reactor.connectSSL(host, port, factory, contextFactory) 745 reactor.connectSSL(factory.host, factory.port, factory, contextFactory)
747 else: 746 else:
748 reactor.connectTCP(host, port, factory) 747 reactor.connectTCP(factory.host, factory.port, factory)
749 return factory 748 return factory
750 749
751 750
752 751
753 class CallbackResource(resource.Resource): 752 class CallbackResource(resource.Resource):