Beispiel #1
0
    def __init__(self, counter, method, path, headers, content):

        channel = HTTPChannel()
        host = IPv4Address(b"TCP", b"127.0.0.1", 80)
        channel.makeConnection(StringTransport(hostAddress=host))

        Request.__init__(self, channel, False)

        # An extra attribute for identifying this fake request
        self._counter = counter

        # Attributes a Request is supposed to have but we have to set ourselves
        # because the base class mixes together too much other logic with the
        # code that sets them.
        self.prepath = []
        self.requestHeaders = headers
        self.content = BytesIO(content)

        self.requestReceived(method, path, b"HTTP/1.1")

        # requestReceived initializes the path attribute for us (but not
        # postpath).
        self.postpath = list(map(unquote, self.path[1:].split(b'/')))

        # Our own notifyFinish / finish state because the inherited
        # implementation wants to write confusing stuff to the transport when
        # the request gets finished.
        self._finished = False
        self._finishedChannel = EventChannel()

        # Our own state for the response body so we don't have to dig it out of
        # the transport.
        self._responseBody = b""
Beispiel #2
0
    def __init__(self, counter, method, path, headers, content):

        channel = HTTPChannel()
        host = IPv4Address(b"TCP", b"127.0.0.1", 80)
        channel.makeConnection(StringTransport(hostAddress=host))

        Request.__init__(self, channel, False)

        # An extra attribute for identifying this fake request
        self._counter = counter

        # Attributes a Request is supposed to have but we have to set ourselves
        # because the base class mixes together too much other logic with the
        # code that sets them.
        self.prepath = []
        self.requestHeaders = headers
        self.content = BytesIO(content)

        self.requestReceived(method, path, b"HTTP/1.1")

        # requestReceived initializes the path attribute for us (but not
        # postpath).
        self.postpath = list(map(unquote, self.path[1:].split(b'/')))

        # Our own notifyFinish / finish state because the inherited
        # implementation wants to write confusing stuff to the transport when
        # the request gets finished.
        self._finished = False
        self._finishedChannel = EventChannel()

        # Our own state for the response body so we don't have to dig it out of
        # the transport.
        self._responseBody = b""
Beispiel #3
0
    def __init__(self, channel, *args, **kw):
        Request.__init__(self, channel, *args, **kw)
        self.site = channel.site
        self._channel = channel  # this is used by the tests
        self.start_time = 0.0

        # The requester, if authenticated. For federation requests this is the
        # server name, for client requests this is the Requester object.
        self.requester = None  # type: Optional[Union[Requester, str]]

        # we can't yet create the logcontext, as we don't know the method.
        self.logcontext = None  # type: Optional[LoggingContext]

        global _next_request_seq
        self.request_seq = _next_request_seq
        _next_request_seq += 1

        # whether an asynchronous request handler has called processing()
        self._is_processing = False

        # the time when the asynchronous request handler completed its processing
        self._processing_finished_time = None

        # what time we finished sending the response to the client (or the connection
        # dropped)
        self.finish_time = None
Beispiel #4
0
    def __init__(self, *args, **kwargs):

        Request.__init__(self, *args, **kwargs)

        self.is_hydrus_client = True
        self.hydrus_args = None
        self.hydrus_response_context = None
        self.hydrus_request_data_usage = 0
Beispiel #5
0
    def __init__(self, *args, **kwargs):

        Request.__init__(self, *args, **kwargs)

        self.start_time = time.clock()
        self.is_hydrus_client = True
        self.hydrus_args = None
        self.hydrus_response_context = None
Beispiel #6
0
    def __init__(self, *args, **kwargs):

        Request.__init__(self, *args, **kwargs)

        self.is_hydrus_client = True
        self.hydrus_args = None
        self.hydrus_response_context = None
        self.hydrus_request_data_usage = 0
    def __init__(self, *args, **kwargs):

        Request.__init__(self, *args, **kwargs)

        self.start_time = time.clock()
        self.parsed_request_args = None
        self.hydrus_response_context = None
        self.hydrus_account = None
Beispiel #8
0
    def __init__(self, site, *args, **kw):
        Request.__init__(self, *args, **kw)
        self.site = site
        self.authenticated_entity = None
        self.start_time = 0

        global _next_request_seq
        self.request_seq = _next_request_seq
        _next_request_seq += 1
Beispiel #9
0
 def __init__( self, *args, **kwargs ):
     
     Request.__init__( self, *args, **kwargs )
     
     self.start_time = HydrusData.GetNowPrecise()
     self.parsed_request_args = None
     self.hydrus_response_context = None
     self.hydrus_account = None
     self.client_api_permissions = None
Beispiel #10
0
    def __init__(self, site, *args, **kw):
        Request.__init__(self, *args, **kw)
        self.site = site
        self.authenticated_entity = None
        self.start_time = 0

        global _next_request_seq
        self.request_seq = _next_request_seq
        _next_request_seq += 1
Beispiel #11
0
    def __init__(self, channel, *args, **kw):
        Request.__init__(self, channel, *args, **kw)
        self.site = channel.site
        self._channel = channel  # this is used by the tests
        self.authenticated_entity = None
        self.start_time = 0

        # we can't yet create the logcontext, as we don't know the method.
        self.logcontext = None

        global _next_request_seq
        self.request_seq = _next_request_seq
        _next_request_seq += 1

        # whether an asynchronous request handler has called processing()
        self._is_processing = False

        # the time when the asynchronous request handler completed its processing
        self._processing_finished_time = None

        # what time we finished sending the response to the client (or the connection
        # dropped)
        self.finish_time = None
Beispiel #12
0
    def __init__(self, site, channel, *args, **kw):
        Request.__init__(self, channel, *args, **kw)
        self.site = site
        self._channel = channel     # this is used by the tests
        self.authenticated_entity = None
        self.start_time = 0

        # we can't yet create the logcontext, as we don't know the method.
        self.logcontext = None

        global _next_request_seq
        self.request_seq = _next_request_seq
        _next_request_seq += 1

        # whether an asynchronous request handler has called processing()
        self._is_processing = False

        # the time when the asynchronous request handler completed its processing
        self._processing_finished_time = None

        # what time we finished sending the response to the client (or the connection
        # dropped)
        self.finish_time = None
Beispiel #13
0
 def __init__(self, *args, **kw):
     Request.__init__(self,*args, **kw)
Beispiel #14
0
 def __init__(self, *args, **kw):
     Request.__init__(self, *args, **kw)
     self.context = Context(self)
Beispiel #15
0
 def __init__(self, args, **kw):
     Request.__init__(self, *args, **kw)
     self.transmit_parameter = {}
Beispiel #16
0
 def __init__(self, channel, queued):
     return Request.__init__(self, channel, queued)
Beispiel #17
0
 def __init__(self, site, *args, **kw):
     Request.__init__(self, *args, **kw)
     self.site = site
     self.authenticated_entity = None
     self.start_time = 0
Beispiel #18
0
 def __init__(self, site, *args, **kw):
     Request.__init__(self, *args, **kw)
     self.site = site
     self.authenticated_entity = None
     self.start_time = 0
Beispiel #19
0
 def __init__(self, *args, **kw):
     Request.__init__(self, *args, **kw)
	def __init__(self, *args, **kwargs):
		Request.__init__(self, *args, **kwargs)
		self._authenticated_callbacks = []
		self.__fix_twisted()
		self.notify_on_authenticated(self.__store_ip_in_session)
		self.notify_on_authenticated(self.__add_sso_session)
Beispiel #21
0
 def __init__(self, channel, queued):
     return Request.__init__(self, channel, queued)