0

We have a web application written in django deployed on heroku. One of our requirements is to get XML from an external source which is pushed to our domain. The XML from the external source is pushed periodicly to a URL using a http push request, which uses chunked transfer encoding. When the push request arrives to django however, the request.body is empty! Testing this, we tried pushing the same exact request, with and without the "Transfer-encoding=chunked" in the header. The body of the request contains the XML when not using chunked, and is empty when using chunked.

From looking on the web, it seems that django doesn't support push requests which use chunked transfer encoding. This is pretty weird. It appears anything using WSGI in python doesn't?

However I see no solution or even discussion about this when using heroku. Does anyone have any experience with this? Any help or ideas about what can be done? Is there some flag which tells heroku to handle chunked transfer encoding?

The only solution I currently see is setting a different app with a framework that supports chunked transfers, or running our own webserver that will create unchunked requests from the chunked requests and redirect it to our application.

Omer
  • 159
  • 2
  • 7
  • See the duplicate question. Bottom line - chunked is possible, but not under WSGI. – Yuval Adam Dec 11 '13 at 14:04
  • I have looked at this answer, but it focuses mostly on the apache mod_wsgi for django. I was talking about deployment on heroku. However a hacked solution can be found from that reply. You indeed need to get the wsgi_input field from environ["wsgi.input"] and use .read() on it. Afterwards you can put the result into requst.body, or replace the wsgi.input field it self with a stream. This is a hacky solution though that depends on the environment where you deploy your code (it works differently on localhost django for example) – Omer Dec 11 '13 at 15:34

0 Answers0