Skip to content
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.

http: write() after end() emits an error. #8422

Closed
wants to merge 1 commit into from

Conversation

misterdjules
Copy link

When calling write() after end() has been called on an OutgoingMessage,
an error is emitted and the write's callback is called with an instance
of Error.

Fix #7477.

When calling write() after end() has been called on an OutgoingMessage,
an error is emitted and the write's callback is called with an instance
of Error.

Fix nodejs#7477.
var self = this;

if (this.finished) {
var err = new Error('write after end');
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any reason not to have this inside the nextTick()?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some properties of the Error instance, like Error.prototype.stack, depends on where the Error instance is created.
Even if this behavior might depend on the implementation, to me it makes sense since the error happens within the write function, not in nextTick's callback.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good to me :-)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some interesting pointers on this matter: https://mail.mozilla.org/pipermail/es-discuss/2014-May/037226.html. It seems it may be standardized someday.

@dougwilson
Copy link
Member

I hate how OutgoingMessage just does nothing right now, which is just weird. I would like to +1 this.

@indutny
Copy link
Member

indutny commented Sep 23, 2014

Landed in 64d6de9

@indutny indutny closed this Sep 23, 2014
@indutny
Copy link
Member

indutny commented Sep 23, 2014

Thank you!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants