zoukankan      html  css  js  c++  java
  • anyproxy的安装与使用

    anyproxy -i -r fxweb.js > test.log

    启动语句比平时多了一句,both "-i(--intercept)" and rule.beforeDealHttpsRequest are specified, the "-i" option will be ignored,这句话的意思就是如果rule规则文件中定义了beforeDealHttpsRequest函数, 那么是否代理https将完全由这个函数的返回来决定;如果没有定义这个函数,那么是否代理https就由启动anyproxy时是否传入i参数来决定;所以说这第一个anyproxy实例其实是不能代理https的。那么这里要开的第二个anyproxy实例的rule规则文件可以修改为注释掉beforeDealHttpsRequest函数,

    其中fxweb.js内容如下:

    var logMap = {}
    var fs = require('fs');
    var logger = fs.createWriteStream(__dirname + '/urlLog.log', {
      flags: 'a' // 'a' means appending (old data will be preserved)
    })
    function logPageFile(url) {
        if (!logMap[url]) {
            logMap[url] = true;
            logger.write(url + '
    ');
        }
    }
    module.exports = {
      // 模块介绍
      summary: 'my customized rule for AnyProxy',
      // 发送请求前拦截处理
      *beforeSendRequest(requestDetail) {  
            if( requestDetail.url.indexOf(".mp4?token=") != -1 ){
                logPageFile(requestDetail.url)
            }
        },
      // 发送响应前处理
      *beforeSendResponse(requestDetail, responseDetail) { /* ... */ },
      // 是否处理https请求
      *beforeDealHttpsRequest(requestDetail) { /* ... */ },
      // 请求出错的事件
      *onError(requestDetail, error) { /* ... */ },
      // https连接服务器出错
      *onConnectError(requestDetail, error) { /* ... */ }
    };
  • 相关阅读:
    防采集策略『blueidea』
    关于进程和线程『整理』
    数据采集『blueidea』
    搜索引擎营销的一些策略『来源:点石互动搜索引擎优化博』
    AJAX之通讯技术简介
    使用AJAX技术构建更优秀的Web应用程序
    AJAX相关JS代码片段和浏览器模型『』
    RDLC报表:每页显示N条记录
    ObjectMapper .NET
    How to Hash Data with Salt
  • 原文地址:https://www.cnblogs.com/lingwang3/p/15470722.html
Copyright © 2011-2022 走看看