Changes between Initial Version and Version 1 of Ticket #20238, comment 3


Ignore:
Timestamp:
07/11/2013 10:06:48 AM (5 years ago)
Author:
Joeri Bekker
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #20238, comment 3

    initial v1  
    22
    33The problem occurs typically when, within a request/response cycle, another request is done to the same `StoppableWSGIServer`. Now, the first request can never finish because the second request is waiting for the `StoppableWSGIServer` to respond (but it never will because it's waiting for the first request...)
     4
     5{{{
     6# view
     7def index(self, request):
     8    if request.GET.get('inner_request') == 'true':
     9        # Within a request/response, perform another request to the same live server.
     10        # This one get's stuck.
     11        urllib.urlopen(request.build_absolute_uri())
     12    return HttpResponse()
     13
     14# test
     15class LiveServerTests(LiveServerTestCase):
     16    def test_request_within_request(self):
     17        response = requests.get(self.live_server_url, params={'inner_request': 'true'})
     18
     19        # This code is never reached (or the live server throws a timeout)
     20        self.assertEqual(response.status_code, 200)
     21}}}
     22
     23The use case is somewhat fictional.
Back to Top