Commit 66cb87d0 by 罗长华

调整SDK签名参数

parent 938a1950
...@@ -22,6 +22,8 @@ public class SignUtils { ...@@ -22,6 +22,8 @@ public class SignUtils {
public static final String CONTENT_TYPE = "Content-Type"; public static final String CONTENT_TYPE = "Content-Type";
public static final String DATE = "Date";
public static final String NEW_LINE = "\n"; public static final String NEW_LINE = "\n";
public static String buildCanonicalString(String method, String resourcePath, Map<String, String> headers, Map<String, String> parameters) { public static String buildCanonicalString(String method, String resourcePath, Map<String, String> headers, Map<String, String> parameters) {
...@@ -37,6 +39,8 @@ public class SignUtils { ...@@ -37,6 +39,8 @@ public class SignUtils {
String lowerKey = header.getKey().toLowerCase(); String lowerKey = header.getKey().toLowerCase();
if (lowerKey.equals(CONTENT_TYPE.toLowerCase())) { if (lowerKey.equals(CONTENT_TYPE.toLowerCase())) {
fixedHeadersToSign.put(lowerKey, header.getValue().trim()); fixedHeadersToSign.put(lowerKey, header.getValue().trim());
} else if (lowerKey.equals(DATE.toLowerCase())) {
fixedHeadersToSign.put(lowerKey, header.getValue().trim());
} else if (lowerKey.startsWith(IM_PREFIX)) { } else if (lowerKey.startsWith(IM_PREFIX)) {
canonicalizedImHeadersToSign.put(lowerKey, header.getValue().trim()); canonicalizedImHeadersToSign.put(lowerKey, header.getValue().trim());
} }
......
...@@ -45,6 +45,8 @@ public class SignUtils { ...@@ -45,6 +45,8 @@ public class SignUtils {
String lowerKey = header.getKey().toLowerCase(); String lowerKey = header.getKey().toLowerCase();
if (lowerKey.equals(HttpHeaders.CONTENT_TYPE.toLowerCase())) { if (lowerKey.equals(HttpHeaders.CONTENT_TYPE.toLowerCase())) {
fixedHeadersToSign.put(lowerKey, header.getValue().trim()); fixedHeadersToSign.put(lowerKey, header.getValue().trim());
} else if (lowerKey.equals(HttpHeaders.DATE.toLowerCase())) {
fixedHeadersToSign.put(lowerKey, header.getValue().trim());
} else if (lowerKey.startsWith(IM_PREFIX)) { } else if (lowerKey.startsWith(IM_PREFIX)) {
canonicalizedImHeadersToSign.put(lowerKey, header.getValue().trim()); canonicalizedImHeadersToSign.put(lowerKey, header.getValue().trim());
} }
......
...@@ -16,7 +16,7 @@ public interface HttpHeaders { ...@@ -16,7 +16,7 @@ public interface HttpHeaders {
public static final String CONTENT_MD5 = "Content-MD5"; public static final String CONTENT_MD5 = "Content-MD5";
public static final String CONTENT_TYPE = "Content-Type"; public static final String CONTENT_TYPE = "Content-Type";
public static final String TRANSFER_ENCODING = "Transfer-Encoding"; public static final String TRANSFER_ENCODING = "Transfer-Encoding";
public static final String DATE = "x-im-Date"; public static final String DATE = "Date";
public static final String ETAG = "ETag"; public static final String ETAG = "ETag";
public static final String EXPIRES = "Expires"; public static final String EXPIRES = "Expires";
public static final String HOST = "Host"; public static final String HOST = "Host";
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment