-
Notifications
You must be signed in to change notification settings - Fork 29.9k
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
[v12.x] http: runtime deprecate legacy HTTP parser #37603
Conversation
Another way would be to emit the warning from the C++ layer which would emit the deprecation even if someone did diff --git a/src/node_http_parser_impl.h b/src/node_http_parser_impl.h
index 7c39bc15c7..6aaba922b5 100644
--- a/src/node_http_parser_impl.h
+++ b/src/node_http_parser_impl.h
@@ -26,6 +26,9 @@
#include "node.h"
#include "node_buffer.h"
+#ifndef NODE_EXPERIMENTAL_HTTP
+#include "node_process.h"
+#endif /* NODE_EXPERIMENTAL_HTTP */
#include "util.h"
#include "async_wrap-inl.h"
@@ -1021,6 +1024,10 @@ void InitializeHttpParser(Local<Object> target,
#ifndef NODE_EXPERIMENTAL_HTTP
static uv_once_t init_once = UV_ONCE_INIT;
uv_once(&init_once, InitMaxHttpHeaderSizeOnce);
+ ProcessEmitDeprecationWarning(
+ env,
+ "The legacy HTTP parser deprecated.",
+ "DEP0131").IsNothing();
#endif /* NODE_EXPERIMENTAL_HTTP */
} |
8828d65
to
50b3ce8
Compare
@richardlau I think that approach makes sense, changed to that. |
The legacy HTTP parser, used by default in versions of Node.js prior to 12.0.0, is deprecated. The legacy HTTP parser cannot be guaranteed to be supported after April 2021. This commit introduces a deprecation warning for the legacy HTTP parser.
50b3ce8
to
b2ee22f
Compare
We may also want to update the documentation for the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
I would recommend a few more reviews by the @nodejs/tsc team. Also, cc @nodejs/http |
Adding a runtime deprecation is typically semver-major and not something we would typically backport, especially not into an LTS line. In this case, there's likely a good reason for us to go ahead and do it given the complete switch over to llhttp. This should at least be a semver-minor. |
The legacy HTTP parser, used by default in versions of Node.js prior to 12.0.0, is deprecated. The legacy HTTP parser cannot be guaranteed to be supported after April 2021. This commit introduces a deprecation warning for the legacy HTTP parser. PR-URL: #37603 Refs: #31441 Reviewed-By: Richard Lau <[email protected]> Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]> Reviewed-By: Michaël Zasso <[email protected]>
Landed in a0b6104 ( |
The legacy HTTP parser, used by default in versions of Node.js prior to
12.0.0, is deprecated. The legacy HTTP parser cannot be guaranteed to be
supported after April 2021. This commit introduces a deprecation warning
for the legacy HTTP parser.
Refs: #31441
I wasn't sure whether the warning should be emitted upon load or when
--http-parser=legacy
is specified as an option (similar to https://github.com/nodejs/node/blob/master/src/node_options.cc#L41). Happy to move the deprecation to there, if that is preferred.