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

In Node, piping a post results in garbage added #130

Closed
scripting opened this issue Sep 2, 2019 · 2 comments

Comments

@scripting
Copy link
Owner

commented Sep 2, 2019

I have a server running in Node that responds to HTTP POSTs.

It's being invoked through PagePark using its ability to delegate requests. Here's the actual code that does the delegation.

The message is transmitted to the proper server, it handles it properly, responds as it's supposed to, and PagePark transmits the response, with one problem. It adds extra characters before and after the response.

Here's a gist containing the actual response.

The characters added at the beginning of the response: 1f7

And at the end: 0

I have to admit I don't understand what the piping is doing, and I haven't found a way to debug this. So I'm looking for either possible answers, or possible ways to debug.

@scripting scripting changed the title In node piping a post results in schmootz being added In Node, piping a post results in garbage added Sep 2, 2019

@PeterJudge-PSC

This comment has been minimized.

Copy link

commented Sep 2, 2019

It's http chunking. Note the transfer-encoding header and lack of content-length. It's in the rfc https://tools.ietf.org/html/rfc7230#section-4.1

@scripting

This comment has been minimized.

Copy link
Owner Author

commented Sep 2, 2019

@PeterJudge-PSC -- thank you. That was exactly right.

I added a Content-Length header to the response from the server, and now it all works well.

Interesting to note -- It's an XML-RPC handler, and the XML-RPC spec clearly says the response must include a content-length header. Also it was a bug in my implementation of the client side that it didn't understand chunks. And my discomfort with pipes led me to believe the problem was probably there. It wasn't. ;-)

image

@scripting scripting closed this Sep 2, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.