#!/usr/bin/python2.7

# coding: utf-8
import sys,os,stat
import transport
def redirect_url(line,concurrent):
  list = line.split(' ')
  if concurrent:
    old_url = list[0]
  else:
    old_url = list[1]
 # f = open('/etc/squid3/abc.txt','w')
 # f.write('old_url:'+old_url)
 # f.close()
  new_url = '\n'
  if old_url.endswith('.avi/'):
    new_url = 'http://www.baidu.com/' + new_url
   # f = open('/etc/squid3/abc.txt','w')
   # f.write('old_url:'+old_url)
   # f.close()
  elif old_url.endswith('.exe/'):
    new_url = 'http://www.google.com/' + new_url
  return new_url
 
def main(concurrent=True):
  line = sys.stdin.readline().strip()
  while line:
       # f = open('/etc/squid3/abc.txt','w')
       # f.write('line:'+line)
       # f.close()
    new_url = redirect_url(line,concurrent)
    id=''
    if concurrent:
      id+=line.split(' ')[0]+' '
    new_url = id + new_url
   # f = open('/etc/squid3/abc.txt','w')
   # f.write('new_url:'+ new_url)
   # f.close()
    sys.stdout.write(new_url)
    sys.stdout.flush()
    line = sys.stdin.readline().strip()
if __name__=='__main__':
  main(len(sys.argv)>1 and sys.argv[1]=='-c')

最新文章

  1. 11.14 T2 小x的旅行(小x的旅行)
  2. CmdBuild
  3. Dubbox监控在服务器中的安装
  4. 200多个js技巧代码
  5. 软件工程 speedsnail 冲刺7
  6. linux下valgrind的使用概述
  7. 04_SSM框架整合(Spring+SpringMVC+MyBatis)
  8. 也谈android开发图像压缩
  9. android studio 无法在可视化页面预览布局文件
  10. 关于js事件冒泡和时间捕获
  11. codecomb 2093【牛宫】
  12. Android 启动过程的底层实现
  13. iOS 内存泄漏
  14. 利刃 MVVMLight 8:DispatchHelper在多线程和调度中的使用
  15. FiddlerCoreAPI开发(二)截获HTTPS流量
  16. Redis --> Redis架构设计
  17. JS 存储
  18. [转] babel-plugin-react-css-modules配置
  19. gridview导excel及解决导出中文乱码的方法
  20. 持续集成之二:搭建SVN服务器(整合Apache+Subversion)

热门文章

  1. 迭代器模式及php实现
  2. new操作符具体干了什么
  3. ES6学习笔记(6)----函数的扩展
  4. 64位系统上32位进程拷贝文件到System32目录时的重定向
  5. axios的简单封装及在组件内使用
  6. JQuery 获得绝对,相对位置的坐标方法
  7. JDO
  8. android和IOS长连接区别
  9. mount nfs 各版本之间的转换
  10. linux部署全流程(未完)