Comments on: CGI requires content-length
REBOL Technologies

Comments on: CGI requires content-length

Carl Sassenrath, CTO
REBOL Technologies
30-Jan-2016 16:50 GMT

Article #0553
Main page || Index || Prior Article [0552] || Next Article [0554] || 3 Comments || Send feedback

I've noticed that various Rebol CGI website scripts hang. Apparently, HTTP POST on newer servers (or clients actually) keeps the socket open in such a way that the standard read-cgi function hangs.

The fix I use in newer scripts is to use the CGI content-length field to terminate the read.

If you have insights into this problem, please comment. I'd like to fix read-cgi in the next release.



30-Jan-2016 19:48:45
You can disable persistent connections with:

Connection: close

added to the HTTP headers. See:

I guess servers now default to HTTP/1.1 at least and assume CGI scripts can handle that (though... it seems strange that the would on good old CGI... I wonder if there's something else going on).

Note also that you can support keep alive connections on scripts even if you don't know the output Content-Length in advance using the chunked transfer encoding:

Eudy Dhe
19-Nov-2018 9:15:36
The most essential output for a CGI program is a straightforward report in either plain text or HTML, which the browser shows as it would any document on the Web. Visit
28-Dec-2019 11:59:33
Write for usIf yo we're searching for Technology write for us, or technology guest posts, you come to the right blog. We will help you publish your article.

Post a Comment:

You can post a comment here. Keep it on-topic.


Blog id:



 Note: HTML tags allowed for: b i u li ol ul font p br pre tt blockquote

This is a technical blog related to the above topic. We reserve the right to remove comments that are off-topic, irrelevant links, advertisements, spams, personal attacks, politics, religion, etc.

Updated 22-Feb-2024   -   Copyright Carl Sassenrath   -   WWW.REBOL.COM   -   Edit   -   Blogger Source Code