caddy-cgi icon indicating copy to clipboard operation
caddy-cgi copied to clipboard

unbuffered output does not work

Open jum opened this issue 1 year ago • 4 comments

if I use the unbuffered output option like this:

cgi /cgi-bin/trace.cgi /usr/lib/cgi-bin/trace.cgi {
        unbuffered_output
}

I see this message in my error log:

Cannot write response without buffer.

apparently the current caddy version does not implement the Flusher interface.

jum avatar Feb 17 '25 21:02 jum

Is it possible you use http3? You might have to use http1.1 or 2 to have that work.

aksdb avatar Feb 20 '25 10:02 aksdb

Hmm, I turned off h3 in my servers config and the output is still buffered. The message is still output that there is no buffer.

jum avatar Feb 20 '25 15:02 jum

I can't reproduce it. It works here with http 1.1, 2.0 and 3.0.

Do you maybe have other plugins installed that intervene or do you otherwise manipulate the middleware chain? Can you maybe retry with a very minimal example?

aksdb avatar Feb 22 '25 19:02 aksdb

Adding a log directive breaks it. Removing it resolves the problem.

Further investigation on logging modes is needed here.

Upd. header causes it too. In fact, any response-manipulating directive probably will.

egormanga avatar Mar 04 '25 15:03 egormanga