[
https://issues.apache.org/jira/browse/TS-4176?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15134869#comment-15134869
]
ASF GitHub Bot commented on TS-4176:
------------------------------------
Github user shukitchan commented on a diff in the pull request:
https://github.com/apache/trafficserver/pull/455#discussion_r52065719
--- Diff: plugins/experimental/s3_auth/s3_auth.cc ---
@@ -346,26 +349,48 @@ S3Request::authorize(S3Config *s3)
// If the configuration is a "virtual host" (foo.s3.aws ...), extract the
// first portion into the Host: header.
if (s3->virt_host()) {
- host_loc = TSMimeHdrFieldFind(_bufp, _hdr_loc, TS_MIME_FIELD_HOST,
TS_MIME_LEN_HOST);
- if (host_loc) {
- host = TSMimeHdrFieldValueStringGet(_bufp, _hdr_loc, host_loc, -1,
&host_len);
+ field_loc = TSMimeHdrFieldFind(_bufp, _hdr_loc, TS_MIME_FIELD_HOST,
TS_MIME_LEN_HOST);
+ if (field_loc) {
+ host = TSMimeHdrFieldValueStringGet(_bufp, _hdr_loc, field_loc, -1,
&host_len);
host_endp = static_cast<const char *>(memchr(host, '.', host_len));
} else {
return TS_HTTP_STATUS_INTERNAL_SERVER_ERROR;
}
}
+ // Just in case we add Content-MD5 if present
+ field_loc = TSMimeHdrFieldFind(_bufp, _hdr_loc,
TS_MIME_FIELD_CONTENT_MD5, TS_MIME_LEN_CONTENT_MD5);
+ if (field_loc) {
+ con_md5 = TSMimeHdrFieldValueStringGet(_bufp, _hdr_loc, field_loc, -1,
&con_md5_len);
+ }
+
+ // get the Content-Type if available - (buggy) clients may send it
+ // for GET requests too
+ field_loc = TSMimeHdrFieldFind(_bufp, _hdr_loc,
TS_MIME_FIELD_CONTENT_TYPE, TS_MIME_LEN_CONTENT_TYPE);
+ if (field_loc) {
+ con_type = TSMimeHdrFieldValueStringGet(_bufp, _hdr_loc, field_loc,
-1, &con_type_len);
+ }
+
--- End diff --
I think we should do a TSHandleMLocRelease on field_loc after each usage
instead of one at the end.
> s3_auth plugin matrix parameters support
> ----------------------------------------
>
> Key: TS-4176
> URL: https://issues.apache.org/jira/browse/TS-4176
> Project: Traffic Server
> Issue Type: Improvement
> Components: Plugins
> Reporter: Roberto Guimaraes
> Assignee: Kit Chan
> Fix For: 6.2.0
>
>
> Matrix parameters, whenever present, must be included in the HMAC calculation
> of authentication.
> Also, even though Content-Type isn't typically included in GET requests, if
> present (bug) it will break the authentication.
> We will fix these here.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)