示例#1
0
        def get_response(self, http_request, uri, response_headers):
            uri = URL(uri)

            try:
                callback = uri.get_querystring()['callback'][0]
            except KeyError:
                callback = 'default'

            body = '%s({})' % callback
            response_headers['Content-Type'] = 'application/javascript'

            return self.status, response_headers, body
示例#2
0
        def get_response(self, http_request, uri, response_headers):
            uri = URL(uri)

            try:
                callback = uri.get_querystring()['callback'][0]
            except KeyError:
                callback = 'default'

            body = '%s({})' % callback
            response_headers['Content-Type'] = 'application/javascript'

            return self.status, response_headers, body
示例#3
0
    def get_response(self, http_request, uri, response_headers):
        """
        Overwrite the mock response with one simple objective: add a delay
        which depends on the length of the redos parameter.
        """
        response_headers.update({'status': self.status})
        response_headers.update(self.headers)

        uri = URL(uri)
        qs = uri.get_querystring()
        redos_param = qs.get('redos')[0]

        delay = len(redos_param) / 13.0
        time.sleep(delay)

        return self.status, response_headers, self.body
示例#4
0
    def get_response(self, http_request, uri, response_headers):
        """
        Overwrite the mock response with one simple objective: add a delay
        which depends on the length of the redos parameter.
        """
        response_headers.update({'status': self.status})
        response_headers.update(self.headers)

        uri = URL(uri)
        qs = uri.get_querystring()
        redos_param = qs.get('redos')[0]

        delay = len(redos_param) / 13.0
        time.sleep(delay)

        return self.status, response_headers, self.body
示例#5
0
 def test_url_with_repeated_parameter_names(self):
     u = URL('http://w3af.com/?id=3&id=4')
     self.assertEqual(u.get_querystring(),
                      QueryString([(u'id', [u'3', u'4'])]))
示例#6
0
 def test_url_with_repeated_parameter_names(self):
     u = URL('http://w3af.com/?id=3&id=4')
     self.assertEqual(u.get_querystring(),
                      QueryString([(u'id', [u'3', u'4'])]))