http: defines all the fields in the constructor#9116
http: defines all the fields in the constructor#9116vitkarpov wants to merge 1 commit intonodejs:masterfrom
Conversation
lib/_http_client.js
Outdated
There was a problem hiding this comment.
This change doesn't affect anything, but I found two different ways across the single constructor: self and this. Seems it should be consistent but I don't know the agreement about it.
There was a problem hiding this comment.
@bnoordhuis didn't you mention in another issue recently that we should prefer this and an arrow function over self?
lib/_http_client.js
Outdated
There was a problem hiding this comment.
If we're setting this to zero now, we should both remove ClientRequest.prototype.aborted = undefined; and change the if (this.aborted === undefined) check to if (!this.aborted) below.
lib/_http_client.js
Outdated
There was a problem hiding this comment.
Perhaps we should also change delete req.res later in this file to req.res = null?
|
@mscdex made some fixes after review:
Also, started to use |
|
Guys, why do windows tests fail? Seems it's not the result of this changes, considering it's about JavaScript code, isn't it? |
|
@vitkarpov In this case, the Windows failure is the result of a CI infrastructure issue and is unrelated to this PR. I'm not sure why aix failed though, it seems it couldn't find the built node binary for some reason. /cc @mhdawson ? The ARM failure looks unrelated. |
|
Yep, I've noticed that some other prs behave the same. |
c133999 to
83c7a88
Compare
|
Guys, what's gonna happen with this pr? I'm ready to rebase the branch when it will be about to be merged, but I'm not sure about the process (there's not milestone tag or something). |
|
Minimally, this needs a rebase, collaborator approval, and a new CI run. |
|
@cjihrig rebased |
|
@vitkarpov
var called = false;
if (self.socketPath) {
// ...
this.timeoutCb = null;
this.upgradeOrConnect = false; |
|
@mscdex Done. |
|
CI is green, except for an unrelated CI infrastructure failure. LGTM. /cc @nodejs/collaborators |
|
I think there are additional properties to add:
|
lib/_http_client.js
Outdated
There was a problem hiding this comment.
It's usually helpful to add a little comment on these, as it helps in the long run (see _readableState as an example).
There was a problem hiding this comment.
@mcollina I'm sorry, but I'm not sure I get it right, do you mean this comment?
Hm, I greped a bit and found even more fields. Seems this needs to be processed the same way, doesn't it? @jasnell @cjihrig Also, maybe it's a good idea to make some special setter-methods for such cases or it's overkill? (so the outer code doesn't set anything to request instance directly, because it's hard to control beyond) |
|
@targos is right, those additional properties seem to also be used on the ClientRequest object, although I would suggest using |
|
As this has not been backported I'm setting to |
In Refs, http.Server's maxHeadersCount field was defined in the constructor to make hidden class stable and so on. Also in https.Server, we can use maxHeadersCount the same as http via connectionListener. So, defines it in the constructor and documentation. Refs: nodejs#9116
In Refs, http.Server's maxHeadersCount field was defined in the constructor to make hidden class stable and so on. Also in https.Server, we can use maxHeadersCount the same as http via connectionListener. So, defines it in the constructor and documentation. Refs: #9116 PR-URL: #20359 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
In Refs, http.Server's maxHeadersCount field was defined in the constructor to make hidden class stable and so on. Also in https.Server, we can use maxHeadersCount the same as http via connectionListener. So, defines it in the constructor and documentation. Refs: #9116 PR-URL: #20359 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
In Refs, http.Server's maxHeadersCount field was defined in the constructor to make hidden class stable and so on. Also in https.Server, we can use maxHeadersCount the same as http via connectionListener. So, defines it in the constructor and documentation. Refs: #9116 PR-URL: #20359 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
In Refs, http.Server's maxHeadersCount field was defined in the constructor to make hidden class stable and so on. Also in https.Server, we can use maxHeadersCount the same as http via connectionListener. So, defines it in the constructor and documentation. Refs: #9116 PR-URL: #20359 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Checklist
make -j8 test(UNIX), orvcbuild test nosign(Windows) passesDescription of change
res and abort fields are now defined in the constructor and not suddenly appear during the runtime. This makes hidden class stable and the heap snapshot more verbose.
Ref: #8912
PR-URL: #9116