ssvm: fix post request header case mismatch#7445
Conversation
Fixes apache#7442 Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
Codecov Report
@@ Coverage Diff @@
## 4.18 #7445 +/- ##
==========================================
Coverage 12.70% 12.70%
Complexity 8673 8673
==========================================
Files 2717 2715 -2
Lines 256186 256071 -115
Branches 39929 39926 -3
==========================================
Hits 32541 32541
+ Misses 219507 219391 -116
- Partials 4138 4139 +1 see 5 files with indirect coverage changes 📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
|
@blueorangutan package |
|
@shwstppr a Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress. |
|
Packaging result: ✔️ el7 ✔️ el8 ✔️ el9 ✔️ debian ✔️ suse15. SL-JID 5927 |
|
@blueorangutan test |
|
@shwstppr a Trillian-Jenkins test job (centos7 mgmt + kvm-centos7) has been kicked to run smoke tests |
|
Trillian test result (tid-6421)
|
yadvr
left a comment
There was a problem hiding this comment.
LGTM, didn't test it. We must test it manually before merging. cc @borisstoyanov @vladimirpetrov @kiranchavala
| if (HEADER_SIGNATURE.equalsIgnoreCase(entry.getKey())) { | ||
| signature = entry.getValue(); | ||
| } else if (HEADER_METADATA.equalsIgnoreCase(entry.getKey())) { | ||
| metadata = entry.getValue(); | ||
| } else if (HEADER_EXPIRES.equalsIgnoreCase(entry.getKey())) { | ||
| expires = entry.getValue(); | ||
| } else if (HEADER_HOST.equalsIgnoreCase(entry.getKey())) { | ||
| hostname = entry.getValue(); | ||
| } else if (HttpHeaders.Names.CONTENT_LENGTH.equalsIgnoreCase(entry.getKey())) { | ||
| contentLength = Long.parseLong(entry.getValue()); |
There was a problem hiding this comment.
| if (HEADER_SIGNATURE.equalsIgnoreCase(entry.getKey())) { | |
| signature = entry.getValue(); | |
| } else if (HEADER_METADATA.equalsIgnoreCase(entry.getKey())) { | |
| metadata = entry.getValue(); | |
| } else if (HEADER_EXPIRES.equalsIgnoreCase(entry.getKey())) { | |
| expires = entry.getValue(); | |
| } else if (HEADER_HOST.equalsIgnoreCase(entry.getKey())) { | |
| hostname = entry.getValue(); | |
| } else if (HttpHeaders.Names.CONTENT_LENGTH.equalsIgnoreCase(entry.getKey())) { | |
| contentLength = Long.parseLong(entry.getValue()); | |
| switch (entry.getKey().toLowerCase()) { | |
| case HEADER_SIGNATURE: | |
| signature = entry.getValue(); | |
| break; | |
| case HEADER_METADATA: | |
| metadata = entry.getValue(); | |
| break; | |
| case HEADER_EXPIRES: | |
| expires = entry.getValue(); | |
| break; | |
| case HEADER_HOST: | |
| hostname = entry.getValue(); | |
| break; | |
| case CONTENT_LENGTH: | |
| contentLength = Long.parseLong(entry.getValue()); | |
| break; |
I think we should leave the switch case, which is more efficient and readable, and simply use toLowerCase() on the entry. Apart from this suggestion, you would have to define the CONTENT_LENGTH static variable (which should be on lowercase), as it is done with the rest of the headers in this class.
Lastly, down on the writeResponse method, the line response.headers().set(CONTENT_LENGTH, buf.readableBytes()); would have to be changed to response.headers().set(HttpHeaders.Names.CONTENT_LENGTH, buf.readableBytes()); in order to maintain current behavior.
There was a problem hiding this comment.
I prefer current changes for minimal edits
There was a problem hiding this comment.
The change that I proposed would touch only 5 lines of code, instead of 17 😄
Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
JoaoJandre
left a comment
There was a problem hiding this comment.
@shwstppr nice refactoring! just a couple of issues
…udstack/storage/resource/HttpUploadServerHandler.java Co-authored-by: João Jandre <48719461+JoaoJandre@users.noreply.github.com>
…udstack/storage/resource/HttpUploadServerHandler.java Co-authored-by: João Jandre <48719461+JoaoJandre@users.noreply.github.com>
|
@blueorangutan package |
|
@shwstppr a Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress. |
JoaoJandre
left a comment
There was a problem hiding this comment.
CLGTM, but we should still test this manually
|
Packaging result: ✔️ el7 ✔️ el8 ✔️ el9 ✔️ debian ✔️ suse15. SL-JID 5956 |
|
@blueorangutan test |
|
@shwstppr a Trillian-Jenkins test job (centos7 mgmt + kvm-centos7) has been kicked to run smoke tests |
|
Kudos, SonarCloud Quality Gate passed! |
|
Trillian test result (tid-6442)
|
|
Hi. Where can we get the latest image with this fix? We have the same hostname=null issue |
|
@LiThuim sorry for the late response. This PR is merged in 4.18 branch so for the official release you may have to wait for the upcoming 4.18.1 release. |
|
@shwstppr do you perhaps know when the new release will be available? |
|
@LiThuim you may have to follow the mailing lists for the timeline, https://markmail.org/thread/passo7fzhsrzxv5h |








Description
Fixes #7442
With d74f64a2e16 key for the host header was changed to lowercase which is causing host be null while processing upload in SSVM
Types of changes
Feature/Enhancement Scale or Bug Severity
Feature/Enhancement Scale
Bug Severity
Screenshots (if appropriate):
How Has This Been Tested?