Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Content-Length not set on outbound response #14

Closed
cgatian opened this issue Mar 13, 2016 · 6 comments
Closed

Content-Length not set on outbound response #14

cgatian opened this issue Mar 13, 2016 · 6 comments

Comments

@cgatian
Copy link

cgatian commented Mar 13, 2016

When WebpackMiddleware.cs modifies the response stream content to inject a script tag the content length is not set to the new length of the response. This causes the HTTP response to get cutoff prematurely.

image

Content length should be updated to memStream.length the when copying to the new stream.

@xabikos
Copy link
Owner

xabikos commented Mar 13, 2016

Thanks for the input @cgatian

I tried to change the code and set the content length after copying the stream but I got an exception that SetContentLength method is not implemented in FrameResponseStream class.

Then I am not sure that this is the problem. Because I turned off the webpack middleware and in the response there is no Content-Length header too.

Could you provide an example that demonstrates the problem?

@cgatian
Copy link
Author

cgatian commented Mar 13, 2016

All you need to do is set response.Headers.content length = stream.length

@xabikos
Copy link
Owner

xabikos commented Mar 14, 2016

How are you sure that this is the problem? I am just asking as I see that Kestel by default doesn't set this header. Maybe I am mistaken but if this was the problem then the server by default would have set this header for all html requests.

@cgatian
Copy link
Author

cgatian commented Mar 14, 2016

That makes sense.
I cloned the repo and stepped though it. Setting the header ended up fixing it, but maybe there's something else I'm missing.

@xabikos
Copy link
Owner

xabikos commented Mar 14, 2016

Ok I will implement that change then and push a new version in nuget as soon as possible then. Thanks for catching that.

@xabikos
Copy link
Owner

xabikos commented Mar 14, 2016

I just pushed version 1.2.4
Please let me know if you have any other issues or ideas on improving the package

@xabikos xabikos closed this as completed Mar 14, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants