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

MINOR: Remove Deadcode in NioTransport CORS #34324

Merged

Conversation

original-brownbear
Copy link
Member

@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-distributed

Copy link
Member

@danielmitterdorfer danielmitterdorfer left a comment

Choose a reason for hiding this comment

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

I left comments around the removal of null origins.

@@ -167,11 +167,6 @@ private void setPreflightHeaders(final HttpResponse response) {
private boolean setOrigin(final HttpResponse response) {
final String origin = request.headers().get(HttpHeaderNames.ORIGIN);
if (!Strings.isNullOrEmpty(origin)) {
if ("null".equals(origin) && config.isNullOriginAllowed()) {
Copy link
Member

Choose a reason for hiding this comment

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

This seems needed? Or is this handled in a different way?

@@ -201,10 +196,6 @@ private boolean validateOrigin() {
return true;
}

if ("null".equals(origin) && config.isNullOriginAllowed()) {
Copy link
Member

Choose a reason for hiding this comment

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

This seems needed? Or is this handled in a different way?

Copy link
Member Author

Choose a reason for hiding this comment

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

@danielmitterdorfer actually this is always false (there's no code assigning anything to that field in the builder) so this must be handled a different way or we have a bug on our hands ... (looking into that)
Looking at the Netty code it's unused there as well ... I guess I could drop this logic there also?

Copy link
Member

Choose a reason for hiding this comment

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

It appears unused indeed and I think we don't want/need it but maybe @tbrooks8 or @jasontedor can chime in here?

Copy link
Member Author

@original-brownbear original-brownbear Oct 5, 2018

Choose a reason for hiding this comment

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

I can't find a single usage of allowNullOrigin() (which would set the return of isNullOriginAllowed to true) in git in any revision. I also don't see why we'd want to support "null" for the origin really? (plus it seems this was never set to true before anyway)

@Tim-Brooks
Copy link
Contributor

I’ll take a look at this in the next few days.

For context, I’m pretty sure that this class is copied from netty. So that is why there is unused code.

At some point we need to consolidate this into a single class that lives in server and operates on the elasticsearch request object.

@original-brownbear
Copy link
Member Author

@tbrooks8 ping :)

For what it's worth I'm pretty sure this is copied from Netty since this method was never used so we're probably good removing it here and then eventually just drying this class up as you suggest?

@Tim-Brooks
Copy link
Contributor

I'll take a look at this tomorrow.

@colings86 colings86 added v6.6.0 and removed v6.5.0 labels Oct 25, 2018
Copy link
Contributor

@Tim-Brooks Tim-Brooks left a comment

Choose a reason for hiding this comment

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

LGTM

@original-brownbear
Copy link
Member Author

@tbrooks8 thanks!

@original-brownbear original-brownbear merged commit 71dddfd into elastic:master Oct 27, 2018
@original-brownbear original-brownbear deleted the deadcode-nio-http branch October 27, 2018 12:54
original-brownbear added a commit to original-brownbear/elasticsearch that referenced this pull request Oct 27, 2018
* Same as elastic#34324 for the Netty transport, the `isNullOriginAllowed` setting is always false
kcm pushed a commit that referenced this pull request Oct 30, 2018
original-brownbear added a commit that referenced this pull request Nov 5, 2018
* Same as #34324 for the Netty transport, the `isNullOriginAllowed` setting is always false
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Distributed/Network Http and internode communication implementations >non-issue v6.6.0 v7.0.0-beta1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants