为什么pypi上传在POST请求数据中包含\ r \ n? [英] Why does pypi upload include \r\n in POST request data?

查看:103
本文介绍了为什么pypi上传在POST请求数据中包含\ r \ n?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近将Mac升级到了El Capitan.升级后,当我运行"python setup.py upload"

I recently upgraded my Mac to El Capitan. After the upgrade I started seeing strange behavior when I run "python setup.py upload"

由上载命令生成的POST请求现在在每个数据字段中插入\ r \ n.

The POST request generated by the upload command now inserts \r\n into each of the data fields.

上传到python.org/pypi/不会引起任何问题,但是我使用的是djangopypi(github.com/benliles/djangopypi/),并且库会对该发布请求数据进行字符串比较.我已经在djangopypi实例上发布了一个补丁程序,该补丁程序仅剥离POST请求数据,但是我仍然不明白为什么我的操作系统要添加这些字符?

It doesn't cause any issues uploading to python.org/pypi/ but I am using djangopypi (github.com/benliles/djangopypi/) and the library does string compares on that post request data. I've pushed a patch to my instance of djangopypi where it just strips the POST request data, but I still don't understand why my OS is adding those characters?

这里是服务器端发布数据的示例.

Here is an example of what the post data looks like on the server side.

 {u'comment': [u'\r\n\r'], 
u'license': [u'\r\nUNKNOWN\r'], 
u'protcol_version': [u'\r\n1\r'], 
u'metadata_version': [u'\r\n1.0\r'], 
u'author': [u'\r\nMe\r'], 
u'home_page': [u'\r\nhttp://me@sample.com\r'], 
u'md5_digest': [u'\r\nesdfg2345f361b982345sdfg9952a\r'], 
u'filetype': [u'\r\nsdist\r'], 
u':action': [u'\r\nfile_upload\r'], 
u'download_url': [u'\r\nUNKNOWN\r'], 
u'name': [u'\r\nsample.app\r'], 
u'platform': [u'\r\nUNKNOWN\r'], 
u'version': [u'\r\n2.0\r'], 
u'pyversion': [u'\r\n\r'], 
u'keywords': [u'\r\ndjango sample\r'], 
u'author_email': [u'\r\nme@sample.com\r'], 
u'summary': [u'\r\nSample Summary\r'],}

我不知道如何从客户端看待它,对此的帮助也将很有帮助.

I don't know how to look at it from my client side, help with that would also be helpful.

推荐答案

我找到了造成这种情况的根本原因.

I found the root cause of this.

Distutils已在2014年9月更新

Distutils was updated in Sept of 2014

https://bugs.python.org/issue10510

这篇关于为什么pypi上传在POST请求数据中包含\ r \ n?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆