-
Notifications
You must be signed in to change notification settings - Fork 25.6k
Generalize S3HttpHandler request matching
#125670
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
Generalize S3HttpHandler request matching
#125670
Conversation
The pattern-matching in `S3HttpHandler` is overly specific and carefully crafted to handle the exact requests that the AWS SDK v1 makes. It turns out that the AWS SDK v2 makes requests that are slightly different. This commit generalizes the pattern-matching to handle both SDKs.
|
Pinging @elastic/es-distributed-coordination (Team:Distributed Coordination) |
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
| || Regex.simpleMatch("GET /" + bucket + "/?uploads&max-uploads=*&prefix=*", request); | ||
| || Regex.simpleMatch("GET /" + bucket + "/?uploads&max-uploads=*&prefix=*", request) | ||
| || Regex.simpleMatch("GET /" + bucket + "?uploads&prefix=*", request) | ||
| || Regex.simpleMatch("GET /" + bucket + "?uploads&max-uploads=*&prefix=*", request); |
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.
A duplicate match for /?uploads&max-uploads=*&prefix=*? line 358.
Pattern.compile("GET \/bucket(\/)?\?uploads&(max-uploads=.*&)?prefix=.*")? Who needs simpleMatch when you can do complex match?:)
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.
not a duplicate, one has an extra / :)
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
|
|
||
| private boolean isUploadPartRequest(String request) { | ||
| return Regex.simpleMatch("PUT /" + path + "/*?uploadId=*&partNumber=*", request) | ||
| || Regex.simpleMatch("PUT /" + path + "/*?partNumber=*&uploadId=*", request); |
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.
Could you distinguish between the V1 vs V2 request formats in the methods, and add a todo someplace? I'm imagining that we should clean up and remove the V1 formats after the upgrade.
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.
I opened ES-11379. Honestly this is all hideous, we should be parsing the request properly, but it's only a test fixture...
The pattern-matching in `S3HttpHandler` is overly specific and carefully crafted to handle the exact requests that the AWS SDK v1 makes. It turns out that the AWS SDK v2 makes requests that are slightly different. This commit generalizes the pattern-matching to handle both SDKs.
💚 Backport successful
|
The pattern-matching in `S3HttpHandler` is overly specific and carefully crafted to handle the exact requests that the AWS SDK v1 makes. It turns out that the AWS SDK v2 makes requests that are slightly different. This commit generalizes the pattern-matching to handle both SDKs.
The pattern-matching in `S3HttpHandler` is overly specific and carefully crafted to handle the exact requests that the AWS SDK v1 makes. It turns out that the AWS SDK v2 makes requests that are slightly different. This commit generalizes the pattern-matching to handle both SDKs.
The pattern-matching in
S3HttpHandleris overly specific and carefullycrafted to handle the exact requests that the AWS SDK v1 makes. It turns
out that the AWS SDK v2 makes requests that are slightly different. This
commit generalizes the pattern-matching to handle both SDKs.