Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upload returns HTTP 200 and xml.parser.expat.ExpatError #167

Open
benvmfarms opened this issue Jul 28, 2015 · 1 comment
Open

Upload returns HTTP 200 and xml.parser.expat.ExpatError #167

benvmfarms opened this issue Jul 28, 2015 · 1 comment

Comments

@benvmfarms
Copy link

I am running Localshop 0.9.3 on top of a standard stack:

  • CentOS 6
  • Nginx 1.0.15
  • Supervisor
  • Gunicorn 19.1.1
  • Python 2.7.6 / 2.7.10

I can access the web interface and download packages without any problems.

However, I cannot upload packages. Uploads appear to succeed:

$ python setup.py sdist upload -r localshop.example.org
running sdist
running egg_info
writing requirements to sample.egg-info/requires.txt
writing sample.egg-info/PKG-INFO
writing top-level names to sample.egg-info/top_level.txt
writing dependency_links to sample.egg-info/dependency_links.txt
writing entry points to sample.egg-info/entry_points.txt
reading manifest file 'sample.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
writing manifest file 'sample.egg-info/SOURCES.txt'
creating sample-1.2.0
creating sample-1.2.0/sample
creating sample-1.2.0/sample.egg-info
making hard links in sample-1.2.0...
hard linking DESCRIPTION.rst -> sample-1.2.0
hard linking MANIFEST.in -> sample-1.2.0
hard linking README.rst -> sample-1.2.0
hard linking setup.cfg -> sample-1.2.0
hard linking setup.py -> sample-1.2.0
hard linking sample/__init__.py -> sample-1.2.0/sample
hard linking sample/package_data.dat -> sample-1.2.0/sample
hard linking sample.egg-info/PKG-INFO -> sample-1.2.0/sample.egg-info
hard linking sample.egg-info/SOURCES.txt -> sample-1.2.0/sample.egg-info
hard linking sample.egg-info/dependency_links.txt -> sample-1.2.0/sample.egg-info
hard linking sample.egg-info/entry_points.txt -> sample-1.2.0/sample.egg-info
hard linking sample.egg-info/requires.txt -> sample-1.2.0/sample.egg-info
hard linking sample.egg-info/top_level.txt -> sample-1.2.0/sample.egg-info
copying setup.cfg -> sample-1.2.0
Writing sample-1.2.0/setup.cfg
tar -cf dist/sample-1.2.0.tar sample-1.2.0
gzip -f9 dist/sample-1.2.0.tar
tar -cf dist/sample-1.2.0.tar sample-1.2.0
gzip -f9 dist/sample-1.2.0.tar
removing 'sample-1.2.0' (and everything under it)
running upload
Submitting dist/sample-1.2.0.tar.gz to http://localshop.example.org/
Server response (200): OK

but the response actually contains an xml.parsers.expat.ExpatError syntax error:

HTTP/1.1 200 OK
Server: nginx/1.0.15
Date: Tue, 28 Jul 2015 19:26:13 GMT
Content-Type: application/xml
Transfer-Encoding: chunked
Connection: keep-alive
Vary: Cookie
Set-Cookie: csrftoken=T1ZYef7txHwFPYqCx7mzUQagFbjNsTgx; expires=Tue, 26-Jul-2016 19:26:12 GMT; Max-Age=31449600; Path=/
Set-Cookie: sessionid=gykwtc8c6h1ah3v08jnuqalgy1yf1a40; expires=Tue, 11-Aug-2015 19:26:12 GMT; httponly; Max-Age=1209600; Path=/

14a
<?xml version='1.0'?>
<methodResponse>
<fault>
<value><struct>
<member>
<name>faultCode</name>
<value><int>1</int></value>
</member>
<member>
<name>faultString</name>
<value><string>&lt;class 'xml.parsers.expat.ExpatError'&gt;:syntax error: line 2, column 0</string></value>
</member>
</struct></value>
</fault>
</methodResponse>

0

Setuptools hides the error message because the status code is 200. I discovered it by inspecting web traffic on the loopback interface, since Nginx proxies to Gunicorn on localhost:8080.

tcpdump -A -s 0 'tcp port 80 and (((ip[2:2] - ((ip[0]&0xf)<<2)) - ((tcp[12]&0xf0)>>2)) != 0)' -i lo

I can reproduce this reliably:

  • with any package (sample package)
  • using SQLite or Postgres as a database backend
  • using Python 2.7.6 and 2.7.10

Here are the contents of the virtualenv:

$ pip freeze --local
amqp==1.4.6
anyjson==0.3.3
billiard==3.3.0.20
celery==3.1.17
Django==1.7.1
django-celery==3.1.16
django-configurations==0.8
django-environ==0.3.0
django-guardian==1.3
django-model-utils==2.2
django-storages==1.1.8
django-userena==1.3.1
django-uuidfield==0.5.0
docutils==0.11
easy-thumbnails==2.2
eventlet==0.10.0
greenlet==0.4.7
gunicorn==19.1.1
html2text==2015.6.21
kombu==3.0.24
localshop==0.9.3
netaddr==0.7.12
ordereddict==1.1
Pillow==2.6.1
psycopg2==2.6.1
Pygments==2.0.2
python-dateutil==1.5
pytz==2015.4
requests==2.5.1
six==1.9.0
South==1.0
Versio==0.2.1
wheel==0.24.0

This particular instance was upgraded from 0.4.1 to 0.9.3 (through 0.5.0 to access the South migrations). Uploads have worked since the upgrade, but stopped working this weekend (July 25).

Any ideas how to resolve this issue?

@benvmfarms
Copy link
Author

My colleague discovered the issue.

My ~/.pypirc contained the following repo:

[localshop.example.org]
repository: https://localshop.example.org/

Whereas his contained the following configuration:

[localshop.example.org]
repository: https://localshop.example.org/simple/

It is still curious that the response was 200 OK. How would setuptools handle a 404?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant