Content-Length: 0 with OWIN

What is the proper way to handle Content-Length when writing body content in Owin middleware?

We are currently using

 context.Response.Write(data); // data is a string. 

In most cases, this works, but in some (IIS host on Win 2012 R2) the Content-Length is set to 0.

I thought that setting the Content-Length header or whether Transfer-Encoding: chuncked could be used depends on how the host is handled, but it looks like I missed something.

What is the correct way to handle Content-Length when writing body content to an OWIN response stream?

We also discussed a bug in the github issue .

+4
source share
1 answer

This is mainly the concern of the owners. An application can choose a content length setting if it knows exactly what it will be, but otherwise the application should allow the server to choose a content length or fragmentation setting.

0
source

All Articles