Skip to content

Workaround for hg controller with chunked Transfer-Encoding

Georges Racinet requested to merge topic/heptapod/hgserve-chunked into branch/heptapod

The inner Hg WSGI machinery uses Transfer-Encoding: chunked for most bundle-related operations. This is in general masked by the hg serve command (not sure it's 100%), which is not suited for production ops.

Gunicorn, and probably other production-grade WSGI servers just honor the chunked encoding.

However, it turns out that the way we use HTTParty and/or Rails base classes has the effect of "dechunking" the body, without clearing the header, making the response invalid. In normal GitLab operation, gitlab-workhorse, the inner layer of reverse proxy simply truncates the body.

The present change is just a workaround: it solves the invalidity of the response, instead of the true issue. Instead, we should stream the Hg response in its native chunked form, something like ActionController::Live (https://api.rubyonrails.org/classes/ActionController/Live.html)

Whether that is an effect of HTTParty forcing the whole body read or of send_data or how they interact remains to be found.

--HG-- branch : heptapod

Merge request reports

Loading