V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
推荐学习书目
Learn Python the Hard Way
Python Sites
PyPI - Python Package Index
http://diveintopython.org/toc/index.html
Pocoo
值得关注的项目
PyPy
Celery
Jinja2
Read the Docs
gevent
pyenv
virtualenv
Stackless Python
Beautiful Soup
结巴中文分词
Green Unicorn
Sentry
Shovel
Pyflakes
pytest
Python 编程
pep8 Checker
Styles
PEP 8
Google Python Style Guide
Code Style from The Hitchhiker's Guide
0xvincebye
V2EX  ›  Python

Python 如何模拟发送 MOVE 方法的报文呢?

  •  
  •   0xvincebye · 2017-08-30 15:27:47 +08:00 · 2176 次点击
    这是一个创建于 2428 天前的主题,其中的信息可能已经有所发展或是发生改变。
    5 条回复    2017-09-02 08:53:25 +08:00
    0xvincebye
        1
    0xvincebye  
    OP
       2017-08-30 15:28:19 +08:00
    shell='MOVE /fileserver/2.txt HTTP/1.1\r\n'
    shell+='Host: 192.168.132.130:8161\r\n'
    shell+='Destination: file:///'+self.get_install_path()+'/webapps/api/s.jsp'+'\r\n'
    shell+='Content-Lenth:0\r\n'
    test_HOST='192.168.132.130'
    test_PORT=8161
    s=socket.socket(socket.AF_INET,socket.SOCK_STREAM)
    try:
    s.connect((test_HOST,test_PORT))
    s.send(shell)
    except Exception,e:
    pass
    finally:
    s.close()
    VicYu
        2
    VicYu  
       2017-08-30 15:36:15 +08:00
    那个的 MOVE 方法?WebDAV?
    0xvincebye
        3
    0xvincebye  
    OP
       2017-08-30 15:42:01 +08:00
    @VicYu 嗯,对
    TimePPT
        4
    TimePPT  
       2017-08-31 13:02:44 +08:00 via iPhone
    0xvincebye
        5
    0xvincebye  
    OP
       2017-09-02 08:53:25 +08:00
    @TimePPT 谢谢,之前看文档错过了这段,我也发现我自己写的错在哪里了,那个 HTTP 协议规定尾部是两个回车,所以应该是\r\n\r\n
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   3535 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 25ms · UTC 04:52 · PVG 12:52 · LAX 21:52 · JFK 00:52
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.