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) { /* ... */ }
    };
  • 相关阅读:
    OSI结构和TCP/IP模型
    将[4,3,2,5,4,3]分割成[4,3,2]、[5,4,3]两个List的算法
    Mybatis增加对象属性不增加mapper.xml的情况
    以脚本方式直接执行修改密码的passwd命令
    Raphael的鼠标over move out事件
    Raphael的Braille例子
    Raphael的set使用
    Raphael的transform用法
    Raphael的text及对齐方式
    Raphael初始化,path,circle,rect,ellipse,image
  • 原文地址:https://www.cnblogs.com/lingwang3/p/15470722.html
Copyright © 2011-2022 走看看