No callback on HTTP response.end? #435
Replies: 5 comments
-
Posted at 2015-07-06 by @gfwilliams Hmm, I didn't know that was even possible - it feels a bit iffy - for instance if you're trying to serve up a file containing a JS function, if you try and serve up a variable containing the function rather than a variable containing a string representing the function, it'll get executed :s I'm pretty sure you can just use the 'close' event though?
If you're interested, source of the HTTP module is here - it it's in C. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2015-07-06 by Mr.Peu
I'm not sure to understand what you mean. The callback is always the latest of the given arguments. If
I will try this.
Thanks. It will spare me to ask useless questions :) |
Beta Was this translation helpful? Give feedback.
-
Posted at 2015-07-06 by @gfwilliams
Just that if you have the following:
But you do this:
Then the behaviour is totally different. It just sounds pretty dangerous - maybe you intended to send the function to the client as a JS file when writing the code, but actually without warning or error it executes it on the server! |
Beta Was this translation helpful? Give feedback.
-
Posted at 2015-07-06 by Mr.Peu Well you should never just execute any code coming from outside, that's for sure. You always have to make some sanity check on the received data. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2015-07-06 by Mr.Peu
|
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Posted at 2015-07-05 by Mr.Peu
Is that normal that a function as only parameter of response.end is not called. I was expecting the same behavior as on Node .
I don't find the sources of http module. But it seems to always consider first arg as data.
Is there another way to achieve this?
Beta Was this translation helpful? Give feedback.
All reactions