Ejemplo n.º 1
0
	def render_GET(self, request):
		"""
		For GET requests, return a 1x1 GIF in N seconds, where N is
		determined by the ?wait= parameter in the URL.
		"""
		waitTime = requestToWaitTime(request)

		blankGif = (
			'GIF89a\x01\x00\x01\x00\x80\x00\x00\xff\xff\xff\x00\x00\x00!\xf9\x04\x00'
			'\x00\x00\x00\x00,\x00\x00\x00\x00\x01\x00\x01\x00\x00\x02\x02D\x01\x00;')

		setNoCacheNoStoreHeaders(request)
		request.responseHeaders.setRawHeaders('content-type', ['image/gif'])
		request.responseHeaders.setRawHeaders('access-control-allow-origin', ['*'])

		def writeAndFinish():
			request.write(blankGif)
			request.finish()

		dc = self._clock.callLater(waitTime, writeAndFinish)

		d = request.notifyFinish()
		d.addErrback(lambda _: dc.cancel())

		return server.NOT_DONE_YET
Ejemplo n.º 2
0
    def render_GET(self, request):
        """
		For GET requests, return a 1x1 GIF in N seconds, where N is
		determined by the ?wait= parameter in the URL.
		"""
        waitTime = requestToWaitTime(request)

        blankGif = (
            'GIF89a\x01\x00\x01\x00\x80\x00\x00\xff\xff\xff\x00\x00\x00!\xf9\x04\x00'
            '\x00\x00\x00\x00,\x00\x00\x00\x00\x01\x00\x01\x00\x00\x02\x02D\x01\x00;'
        )

        setNoCacheNoStoreHeaders(request)
        request.responseHeaders.setRawHeaders('content-type', ['image/gif'])
        request.responseHeaders.setRawHeaders('access-control-allow-origin',
                                              ['*'])

        def writeAndFinish():
            request.write(blankGif)
            request.finish()

        dc = self._clock.callLater(waitTime, writeAndFinish)

        d = request.notifyFinish()
        d.addErrback(lambda _: dc.cancel())

        return server.NOT_DONE_YET
Ejemplo n.º 3
0
	def render_POST(self, request):
		"""
		For POST requests, return a psuedo-HTML file in N seconds,
		where N is determined by
		"""
		waitTime = requestToWaitTime(request)

		setNoCacheNoStoreHeaders(request)
		request.responseHeaders.setRawHeaders('access-control-allow-origin', ['*'])

		def writeAndFinish():
			request.write("// Done after %d seconds." % (waitTime,))
			request.finish()

		dc = self._clock.callLater(waitTime, writeAndFinish)

		d = request.notifyFinish()
		d.addErrback(lambda _: dc.cancel())

		return server.NOT_DONE_YET
Ejemplo n.º 4
0
    def render_POST(self, request):
        """
		For POST requests, return a psuedo-HTML file in N seconds,
		where N is determined by
		"""
        waitTime = requestToWaitTime(request)

        setNoCacheNoStoreHeaders(request)
        request.responseHeaders.setRawHeaders('access-control-allow-origin',
                                              ['*'])

        def writeAndFinish():
            request.write("// Done after %d seconds." % (waitTime, ))
            request.finish()

        dc = self._clock.callLater(waitTime, writeAndFinish)

        d = request.notifyFinish()
        d.addErrback(lambda _: dc.cancel())

        return server.NOT_DONE_YET