当前位置: 首页>>代码示例>>Python>>正文


Python HTTPResponse.from_httplib_resp方法代码示例

本文整理汇总了Python中w3af.core.data.url.HTTPResponse.HTTPResponse.from_httplib_resp方法的典型用法代码示例。如果您正苦于以下问题:Python HTTPResponse.from_httplib_resp方法的具体用法?Python HTTPResponse.from_httplib_resp怎么用?Python HTTPResponse.from_httplib_resp使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在w3af.core.data.url.HTTPResponse.HTTPResponse的用法示例。


在下文中一共展示了HTTPResponse.from_httplib_resp方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: http_response

# 需要导入模块: from w3af.core.data.url.HTTPResponse import HTTPResponse [as 别名]
# 或者: from w3af.core.data.url.HTTPResponse.HTTPResponse import from_httplib_resp [as 别名]
    def http_response(self, request, response):

        if self._plugin_list:
            # Create the HTTPResponse object
            http_resp = HTTPResponse.from_httplib_resp(response)

            for plugin in self._plugin_list:
                plugin.mangle_response(http_resp)

            response = self._http_resp_2_httplib(response, http_resp)

        return response
开发者ID:EnDe,项目名称:w3af,代码行数:14,代码来源:mangle.py

示例2: _handle_send_success

# 需要导入模块: from w3af.core.data.url.HTTPResponse import HTTPResponse [as 别名]
# 或者: from w3af.core.data.url.HTTPResponse.HTTPResponse import from_httplib_resp [as 别名]
    def _handle_send_success(self, req, res, grep, original_url,
                             original_url_inst, start_time):
        """
        Handle the case in "def _send" where the request was successful and
        we were able to get a valid HTTP response.
        
        :return: An HTTPResponse object.
        """
        # Everything went well!
        rdata = req.get_data()
        if not rdata:
            msg = ('%s %s returned HTTP code "%s"' %
                   (req.get_method(),
                    urllib.unquote_plus(original_url),
                    res.code))
        else:
            printable_data = urllib.unquote_plus(rdata)
            if len(rdata) > 75:
                printable_data = '%s...' % printable_data[:75]
                printable_data = printable_data.replace('\n', ' ')
                printable_data = printable_data.replace('\r', ' ')
                
            msg = ('%s %s with data: "%s" returned HTTP code "%s"'
                   % (req.get_method(),
                      original_url,
                      printable_data,
                      res.code))

        from_cache = hasattr(res, 'from_cache') and res.from_cache
        flags = ' (id=%s,from_cache=%i,grep=%i)' % (res.id, from_cache,
                                                    grep)
        msg += flags
        om.out.debug(msg)

        http_resp = HTTPResponse.from_httplib_resp(res,
                                                   original_url=original_url_inst)
        http_resp.set_id(res.id)
        http_resp.set_wait_time(time.time() - start_time)
        http_resp.set_from_cache(from_cache)

        # Clear the log of failed requests; this request is DONE!
        req_id = id(req)
        if req_id in self._error_count:
            del self._error_count[req_id]
        self._zero_global_error_count()

        if grep:
            self._grep(req, http_resp)

        return http_resp
开发者ID:aricciard,项目名称:w3af,代码行数:52,代码来源:extended_urllib.py

示例3: _log_req_resp

# 需要导入模块: from w3af.core.data.url.HTTPResponse import HTTPResponse [as 别名]
# 或者: from w3af.core.data.url.HTTPResponse.HTTPResponse import from_httplib_resp [as 别名]
    def _log_req_resp(self, request, response):
        """
        Send the request and the response to the output manager.
        """
        if not isinstance(response, HTTPResponse):
            url = request.url_object
            resp = HTTPResponse.from_httplib_resp(response,
                                                  original_url=url)
            resp.set_id(response.id)
        else:
            resp = response
            
        if not isinstance(request, HTTPRequest):
            msg = 'There is something odd going on in OutputManagerHandler,'\
                  ' request should be of type HTTPRequest got %s'\
                  ' instead.'
            raise TypeError(msg % type(request))

        om.out.log_http(request, resp)
开发者ID:0x554simon,项目名称:w3af,代码行数:21,代码来源:output_manager.py

示例4: store_in_cache

# 需要导入模块: from w3af.core.data.url.HTTPResponse import HTTPResponse [as 别名]
# 或者: from w3af.core.data.url.HTTPResponse.HTTPResponse import from_httplib_resp [as 别名]
    def store_in_cache(request, response):
        # Create the http response object
        resp = HTTPResponse.from_httplib_resp(response,
                                              original_url=request.url_object)
        resp.set_id(response.id)
        resp.set_alias(gen_hash(request))

        hi = HistoryItem()
        hi.request = request
        hi.response = resp

        # Now save them
        try:
            hi.save()
        except sqlite3.Error, e:
            msg = 'A sqlite3 error was raised: "%s".' % e
            
            if 'disk' in str(e).lower():
                msg += ' Please check if your disk is full.'
                
            raise ScanMustStopException(msg)
开发者ID:0x554simon,项目名称:w3af,代码行数:23,代码来源:db.py


注:本文中的w3af.core.data.url.HTTPResponse.HTTPResponse.from_httplib_resp方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。