﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
10117	Test server sometimes causes 'Connection reset by peer' when retrieving POST data	Almad	nobody	"When I create a view that returns 401 Unauthorized:

{{{
from django.http import HttpResponse
class HttpResponseNotAuthorized(HttpResponse):
    status_code = 401

def return_not_authorized(request):
    return HttpResponseNotAuthorized(""401 Not Authorized"")

}}}

and I wan't to POST some data using urllib2:

{{{
        for i in xrange(1, 10):
            response = urllib2.urlopen(url='http://%(host)s:%(port)s/return_not_authorized/' % {
                'host' : 'localhost',
                'port' : 8000
            },
            data='data')

}}}

I non-deterministically (thus the xrange cycle) get 'Connection reset by peer':

{{{
  File ""//usr/lib/python2.5/urllib2.py"", line 124, in urlopen
    return _opener.open(url, data)
  File ""//usr/lib/python2.5/urllib2.py"", line 381, in open
    response = self._open(req, data)
  File ""//usr/lib/python2.5/urllib2.py"", line 399, in _open
    '_open', req)
  File ""//usr/lib/python2.5/urllib2.py"", line 360, in _call_chain
    result = func(*args)
  File ""//usr/lib/python2.5/urllib2.py"", line 1107, in http_open
    return self.do_open(httplib.HTTPConnection, req)
  File ""//usr/lib/python2.5/urllib2.py"", line 1082, in do_open
    raise URLError(err)
urllib2.URLError: <urlopen error (104, 'Connection reset by peer')>
}}}

Tested on both 1.0 and SVN HEAD. Send agains server run by ./manage.py runserver.

"		closed	HTTP handling	1.0		duplicate			Unreviewed	0	0	0	0	0	0
