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

add setting ignore-illegal-header-for #687 #1942

Merged
merged 18 commits into from
May 7, 2018
Merged

add setting ignore-illegal-header-for #687 #1942

merged 18 commits into from
May 7, 2018

Conversation

shnmorimoto
Copy link
Contributor

Ref #687

@akka-ci
Copy link

akka-ci commented Mar 16, 2018

Thank you for your pull request! After a quick sanity check one of the team will reply with 'OK TO TEST' to kick off our automated validation on Jenkins. This compiles the project, runs the tests, and checks for things like binary compatibility and source code formatting. When two team members have also manually reviewed and (perhaps after asking for some amendments) accepted your contribution, it should be good to be merged.

For more details about our contributing process, check out CONTRIBUTING.md - and feel free to ask!

@ktoso
Copy link
Member

ktoso commented Mar 16, 2018

OK TO TEST

@ktoso ktoso self-assigned this Mar 16, 2018
@ktoso
Copy link
Member

ktoso commented Mar 16, 2018

Another PR from the hackathon, please review @raboof @johanandren ? :)

@akka-ci akka-ci added validating PR that is currently being validated by Jenkins needs-attention Indicates a PR validation failure (set by CI infrastructure) and removed validating PR that is currently being validated by Jenkins labels Mar 16, 2018
@akka-ci
Copy link

akka-ci commented Mar 16, 2018

Test FAILed.

@raboof
Copy link
Member

raboof commented Mar 16, 2018

Thanks for your contribution @shnmorimoto, this is indeed something people run into a lot, and it would be great if we could give them more fine-grained tools to suppress such warnings.

You might have noticed the builds failed, this is because of our automated binary incompatibility checks:

[error]  * abstract method getIgnoreIllegalHeaderFor()scala.collection.immutable.Set in class akka.http.javadsl.settings.ParserSettings is present only in current version
[error]    filter with: ProblemFilters.exclude[ReversedMissingMethodProblem]("akka.http.javadsl.settings.ParserSettings.getIgnoreIllegalHeaderFor")
[error]  * method copy(java.lang.String,java.lang.String)akka.http.scaladsl.model.ErrorInfo in class akka.http.scaladsl.model.ErrorInfo does not have a correspondent in current version
[error]    filter with: ProblemFilters.exclude[DirectMissingMethodProblem]("akka.http.scaladsl.model.ErrorInfo.copy")
[error]  * method this(java.lang.String,java.lang.String)Unit in class akka.http.scaladsl.model.ErrorInfo does not have a correspondent in current version
[error]    filter with: ProblemFilters.exclude[DirectMissingMethodProblem]("akka.http.scaladsl.model.ErrorInfo.this")
[error]  * method apply(java.lang.String,java.lang.String)akka.http.scaladsl.model.ErrorInfo in object akka.http.scaladsl.model.ErrorInfo does not have a correspondent in current version
[error]    filter with: ProblemFilters.exclude[DirectMissingMethodProblem]("akka.http.scaladsl.model.ErrorInfo.apply")
[error]  * abstract method ignoreIllegalHeaderFor()scala.collection.immutable.Set in class akka.http.scaladsl.settings.ParserSettings is present only in current version
[error]    filter with: ProblemFilters.exclude[ReversedMissingMethodProblem]("akka.http.scaladsl.settings.ParserSettings.ignoreIllegalHeaderFor")

The warnings on ParserSettings can be ignored because ParserSettings is marked @DoNotInherit (we have an issue open to automate this logic). You can add them to the list of ignored warnings as described in CONTRIBUTING.md.

The warnings on ErrorInfo are a bit more tricky: these pop up because ErrorInfo is a case class, and the automatically-generated methods on this case class changed because the fields changed. I think it would be fine to turn ErrorInfo into a regular class and hand-implemented the missing API's (perhaps private?) You can see something similar has been done to RouterSettings in ababace.

Would you be up for fixing those?

@shnmorimoto
Copy link
Contributor Author

@raboof Thank you for your review.

I understood about the reason for the builds failed.

I will check the reference code and I will fix it.

@akka-ci akka-ci added validating PR that is currently being validated by Jenkins tested PR that was successfully built and tested by Jenkins and removed needs-attention Indicates a PR validation failure (set by CI infrastructure) validating PR that is currently being validated by Jenkins labels Mar 16, 2018
@akka-ci
Copy link

akka-ci commented Mar 16, 2018

Test PASSed.

@shnmorimoto
Copy link
Contributor Author

@raboof cc: @ktoso I fix binary incompatibility.

Copy link
Member

@raboof raboof left a comment

Choose a reason for hiding this comment

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

Starting to look good, added a couple of additional comments!

@@ -86,3 +86,5 @@ ProblemFilters.exclude[ReversedMissingMethodProblem]("akka.http.javadsl.TimeoutA
ProblemFilters.exclude[ReversedMissingMethodProblem]("akka.http.scaladsl.TimeoutAccess.timeout")
ProblemFilters.exclude[ReversedMissingMethodProblem]("akka.http.scaladsl.TimeoutAccess.getTimeout")

ProblemFilters.exclude[ReversedMissingMethodProblem]("akka.http.javadsl.settings.ParserSettings.getIgnoreIllegalHeaderFor")
ProblemFilters.exclude[ReversedMissingMethodProblem]("akka.http.scaladsl.settings.ParserSettings.ignoreIllegalHeaderFor")
Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't we introduce a 10.1.0.backwards.excludes?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

move configuration to 10.1.0.backwards.excludes.

@@ -386,6 +386,9 @@ akka.http {
# `error-logging-verbosity`.
illegal-header-warnings = on

# TODO comment
Copy link
Member

Choose a reason for hiding this comment

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

Describe the setting here

Copy link
Contributor Author

Choose a reason for hiding this comment

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

add comment.

def withSummary(newSummary: String) = copy(summary = newSummary)
def withSummaryPrepended(prefix: String) = withSummary(if (summary.isEmpty) prefix else prefix + ": " + summary)
def withHeaderNamePrepend(headerName: String) = setErrorHeaderName(errorHeaderName = headerName)
Copy link
Member

Choose a reason for hiding this comment

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

This doesn't actually prepend the header name, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Surely you are right. rename method.

new ErrorInfo(summary, detail, errorHeaderName)
}

private[akka] def setErrorHeaderName(errorHeaderName: String): ErrorInfo = new ErrorInfo(summary, detail, errorHeaderName)
Copy link
Member

Choose a reason for hiding this comment

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

Perhaps make this public and call it withErrorHeaderName?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Surely you are right. delete this method and rename withHeaderNamePrepend method to withErrorHeaderName.

@@ -26,6 +54,10 @@ object ErrorInfo {
* Used for example when catching exceptions generated by the header value parser, which doesn't provide
* summary/details information but structures its exception messages accordingly.
*/
private[akka] def apply(summary: String = "", detail: String = ""): ErrorInfo = new ErrorInfo(summary, detail, "")
Copy link
Member

Choose a reason for hiding this comment

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

You introduced these new methods between the existing scaladoc documentation and the method they document below - can you reorder that?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I made a mistake. reorder methods. thanks.

@akka-ci akka-ci added validating PR that is currently being validated by Jenkins and removed tested PR that was successfully built and tested by Jenkins labels Mar 17, 2018
@shnmorimoto
Copy link
Contributor Author

shnmorimoto commented Mar 17, 2018

I'd like to consult one point.
Should we check the header name in settings sensitive? Or insensitive?

When set 'user-agent' in settings, ignore warn.
But set 'User-agent' in settings, logged warn now.

@akka-ci akka-ci added tested PR that was successfully built and tested by Jenkins and removed validating PR that is currently being validated by Jenkins labels Mar 17, 2018
@akka-ci
Copy link

akka-ci commented Mar 17, 2018

Test PASSed.

@ktoso
Copy link
Member

ktoso commented Mar 17, 2018

As per the HTTP spec header names should be treated case insensitive :) good question

@shnmorimoto
Copy link
Contributor Author

Thanks! I will fix it.

@akka-ci akka-ci added validating PR that is currently being validated by Jenkins tested PR that was successfully built and tested by Jenkins and removed tested PR that was successfully built and tested by Jenkins validating PR that is currently being validated by Jenkins labels Mar 17, 2018
@akka-ci
Copy link

akka-ci commented Mar 17, 2018

Test PASSed.

@akka-ci akka-ci added validating PR that is currently being validated by Jenkins tested PR that was successfully built and tested by Jenkins and removed tested PR that was successfully built and tested by Jenkins validating PR that is currently being validated by Jenkins labels Apr 25, 2018
@akka-ci
Copy link

akka-ci commented Apr 25, 2018

Test PASSed.

@shnmorimoto
Copy link
Contributor Author

@ktoso I will be glad if you review at your convenience.

Copy link
Member

@raboof raboof left a comment

Choose a reason for hiding this comment

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

Looks good to me, thanks for contributing this feature!

@ktoso
Copy link
Member

ktoso commented May 7, 2018

Looking great now, thanks! Updated branch and can merge after validation

@akka-ci akka-ci added validating PR that is currently being validated by Jenkins tested PR that was successfully built and tested by Jenkins and removed tested PR that was successfully built and tested by Jenkins validating PR that is currently being validated by Jenkins labels May 7, 2018
@akka-ci
Copy link

akka-ci commented May 7, 2018

Test PASSed.

@ktoso ktoso merged commit 78e5b1f into akka:master May 7, 2018
@ktoso
Copy link
Member

ktoso commented May 7, 2018

Thanks a lot and sorry this took such a long time to merge! :-)

@shnmorimoto
Copy link
Contributor Author

@ktoso @raboof @johanandren
Thank you for merge.
And thank you for advising me on the review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tested PR that was successfully built and tested by Jenkins
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants