1
Vote

wrong content length when exception occurs

description

Hi,

I found an error in procedure sendErrorToClientAndCloseResponse ( RestHttpHandler.cs ).
The content length is calculated in characters instead of bytes so json exception object is not serializable.

I changed following code :
       byte[] utfBytes = Encoding.UTF8.GetBytes(sbuilder.ToString());
        //m_response.AddHeader("Content-Length", sbuilder.Length.ToString());
        m_response.AddHeader("Content-Length", utfBytes.Length.ToString());
Regards,

Gregory

comments