@@ -75,10 +75,6 @@ AWSClient4::~AWSClient4() {
75
75
delete[] awsKeyID;
76
76
}
77
77
78
- char * AWSClient4::createHost () {
79
- // return "example.com";
80
- return awsDomain;
81
- }
82
78
83
79
char * AWSClient4::createCanonicalHeaders () {
84
80
// headers, alphabetically sorted, lowercase, eg: key:value
@@ -88,7 +84,7 @@ char* AWSClient4::createCanonicalHeaders() {
88
84
// x-amz-date:date
89
85
char canonical_headers[500 ] = " " ;
90
86
sprintf (canonical_headers, " %scontent-type:%s\n " , canonical_headers, contentType);
91
- sprintf (canonical_headers, " %shost:%s\n " , canonical_headers, createHost () );
87
+ sprintf (canonical_headers, " %shost:%s\n " , canonical_headers, awsDomain );
92
88
// sprintf(canonical_headers, "%srange:bytes=0-9\n", canonical_headers); // s3
93
89
sprintf (canonical_headers, " %sx-amz-content-sha256:%s\n " , canonical_headers, payloadHash);
94
90
sprintf (canonical_headers, " %sx-amz-date:%sT%sZ\n\n " , canonical_headers, awsDate, awsTime);
@@ -100,7 +96,7 @@ char* AWSClient4::createRequestHeaders(char* signature) {
100
96
sprintf (headers, " %sContent-Type: %s\r\n " , headers, contentType);
101
97
sprintf (headers, " %sConnection: close\r\n " , headers);
102
98
sprintf (headers, " %sContent-Length: %d\r\n " , headers, strlen (payload.getCStr ()));
103
- sprintf (headers, " %sHost: %s\r\n " , headers, createHost () );
99
+ sprintf (headers, " %sHost: %s\r\n " , headers, awsDomain );
104
100
sprintf (headers, " %sx-amz-content-sha256: %s\r\n " , headers, payloadHash);
105
101
sprintf (headers, " %sx-amz-date: %sT%sZ\r\n " , headers, awsDate, awsTime);
106
102
sprintf (headers, " %sAuthorization: AWS4-HMAC-SHA256 Credential=%s/%s/%s/%s/aws4_request,SignedHeaders=%s,Signature=%s\r\n " , headers, awsKeyID, awsDate, awsRegion, awsService, signedHeaders, signature);
@@ -216,19 +212,19 @@ char* AWSClient4::createRequest(MinimalString &reqPayload) {
216
212
char *headers = createRequestHeaders (signature);
217
213
218
214
// get the host/domain
219
- char *host = createHost ();
215
+ // char *host = createHost();
220
216
221
217
// create the request with all the vars
222
- char * request = new char [strlen (method) + strlen (host ) + strlen (awsPath) + strlen (headers) + strlen (reqPayload.getCStr ()) + 16 ]();
218
+ char * request = new char [strlen (method) + strlen (awsDomain ) + strlen (awsPath) + strlen (headers) + strlen (reqPayload.getCStr ()) + 16 ]();
223
219
sprintf (request, " %s %s HTTP/1.1\r\n %s\r\n %s\r\n\r\n " , method, awsPath, headers, reqPayload.getCStr ());
224
220
225
221
return request;
226
222
}
227
223
228
224
char * AWSClient4::sendData (const char * data) {
229
- char * server = createHost ();
225
+ // char* server = createHost();
230
226
int port = httpS ? 443 : 80 ;
231
- char * response = httpClient->send (data, server , port);
232
- delete[] server;
227
+ char * response = httpClient->send (data, awsDomain , port);
228
+ // delete[] server;
233
229
return response;
234
230
}
0 commit comments