Exemplo n.º 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""
Exemplo n.º 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""
Exemplo n.º 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
Exemplo n.º 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
Exemplo n.º 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
Exemplo n.º 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
Exemplo n.º 7
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
Exemplo n.º 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
Exemplo n.º 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
Exemplo n.º 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
Exemplo n.º 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
Exemplo n.º 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
Exemplo n.º 13
0
 def __init__(self, *args, **kw):
     Request.__init__(self,*args, **kw)
Exemplo n.º 14
0
 def __init__(self, *args, **kw):
     Request.__init__(self, *args, **kw)
     self.context = Context(self)
Exemplo n.º 15
0
 def __init__(self, args, **kw):
     Request.__init__(self, *args, **kw)
     self.transmit_parameter = {}
Exemplo n.º 16
0
 def __init__(self, channel, queued):
     return Request.__init__(self, channel, queued)
Exemplo n.º 17
0
 def __init__(self, site, *args, **kw):
     Request.__init__(self, *args, **kw)
     self.site = site
     self.authenticated_entity = None
     self.start_time = 0
Exemplo n.º 18
0
 def __init__(self, site, *args, **kw):
     Request.__init__(self, *args, **kw)
     self.site = site
     self.authenticated_entity = None
     self.start_time = 0
Exemplo n.º 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)
Exemplo n.º 21
0
 def __init__(self, channel, queued):
     return Request.__init__(self, channel, queued)