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. 


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to