-
Notifications
You must be signed in to change notification settings - Fork 25.6k
Clean up request parsing in S3HttpHandler
#126034
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
Clean up request parsing in S3HttpHandler
#126034
Conversation
The `METHOD /path/components?and=query` string representation of a request is becoming increasingly difficult to parse, with slight variations in parsing between the implementation in `S3HttpHandler` and the various other implementations. This commit gets rid of the string-concatenate-and-split behaviour in favour of a proper object that has predicates for testing all the different kinds of request that might be made against S3.
|
Pinging @elastic/es-distributed-coordination (Team:Distributed Coordination) |
DiannaHohensee
left a comment
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.
Couple nits, lgtm 👍
| } | ||
|
|
||
| public boolean isHeadObjectRequest() { | ||
| return "HEAD".equals(method) && path.startsWith("/" + S3HttpHandler.this.bucketAndBasePath + "/"); |
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.
Is path.startsWith("/" + S3HttpHandler.this.bucketAndBasePath + "/") the same as isUnderBucketRootAndBasePath()?
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.
Ah yeah missed that one
| this.bucketAndBasePath = bucket + (Strings.hasText(basePath) ? "/" + basePath : ""); | ||
| } | ||
|
|
||
| private static final Set<String> NO_REQUEST_BODY_METHODS = Set.of("GET", "HEAD", "DELETE"); |
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.
This name doesn't make sense. It's only a list of method strings. Maybe document how it's used instead?
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.
Fair, yeah, renamed & commented in dc61076
💔 Backport failed
You can use sqren/backport to manually backport by running |
The `METHOD /path/components?and=query` string representation of a request is becoming increasingly difficult to parse, with slight variations in parsing between the implementation in `S3HttpHandler` and the various other implementations. This commit gets rid of the string-concatenate-and-split behaviour in favour of a proper object that has predicates for testing all the different kinds of request that might be made against S3. Backport of elastic#126034 to 8.x
The `METHOD /path/components?and=query` string representation of a request is becoming increasingly difficult to parse, with slight variations in parsing between the implementation in `S3HttpHandler` and the various other implementations. This commit gets rid of the string-concatenate-and-split behaviour in favour of a proper object that has predicates for testing all the different kinds of request that might be made against S3. Backport of #126034 to 8.x
The
METHOD /path/components?and=querystring representation of arequest is becoming increasingly difficult to parse, with slight
variations in parsing between the implementation in
S3HttpHandlerandthe various other implementations. This commit gets rid of the
string-concatenate-and-split behaviour in favour of a proper object that
has predicates for testing all the different kinds of request that might
be made against S3.