Why does pypi upload include \r\n in POST request data?

大憨熊 提交于 2020-01-07 05:48:04

问题


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

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

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.


回答1:


I found the root cause of this.

Distutils was updated in Sept of 2014

https://bugs.python.org/issue10510



来源:https://stackoverflow.com/questions/33349391/why-does-pypi-upload-include-r-n-in-post-request-data

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!