about summary refs log tree commit diff stats
path: root/source/http.c
diff options
context:
space:
mode:
authorKelly Rauchenberger <fefferburbia@gmail.com>2017-10-15 13:07:39 -0400
committerKelly Rauchenberger <fefferburbia@gmail.com>2017-10-15 13:07:39 -0400
commit7a22cab34332707ea2fe5d3e690033c424886c9b (patch)
treeb2ee4fa5d5bd308a4d31c75dc993e789a9a45917 /source/http.c
parent4be9c4dadc54197eedded43825995dec9f524cfc (diff)
downloadgen3uploader-7a22cab34332707ea2fe5d3e690033c424886c9b.tar.gz
gen3uploader-7a22cab34332707ea2fe5d3e690033c424886c9b.tar.bz2
gen3uploader-7a22cab34332707ea2fe5d3e690033c424886c9b.zip
Changed auth password to token
Diffstat (limited to 'source/http.c')
-rw-r--r--source/http.c17
1 files changed, 5 insertions, 12 deletions
diff --git a/source/http.c b/source/http.c index be62dce..2ac10fb 100644 --- a/source/http.c +++ b/source/http.c
@@ -146,23 +146,13 @@ int submitToApi(
146 WOLFSSL_CTX* sslContext, 146 WOLFSSL_CTX* sslContext,
147 cJSON* data, 147 cJSON* data,
148 const char* username, 148 const char* username,
149 const char* password) 149 const char* token)
150{ 150{
151 // Form request body. 151 // Form request body.
152 cJSON* jRequestBody = cJSON_CreateObject(); 152 cJSON* jRequestBody = cJSON_CreateObject();
153 153
154 cJSON_AddItemToObject(jRequestBody, "game", data); 154 cJSON_AddItemToObject(jRequestBody, "game", data);
155 155
156 cJSON_AddItemToObject(
157 jRequestBody,
158 "username",
159 cJSON_CreateString(username));
160
161 cJSON_AddItemToObject(
162 jRequestBody,
163 "password",
164 cJSON_CreateString(password));
165
166 const char* requestBody = cJSON_PrintUnformatted(jRequestBody); 156 const char* requestBody = cJSON_PrintUnformatted(jRequestBody);
167 157
168 // Gather data from endpoint URL. 158 // Gather data from endpoint URL.
@@ -304,7 +294,10 @@ int submitToApi(
304 r += sprintf(r, "POST %s HTTP/1.1\r\n", httpPath); 294 r += sprintf(r, "POST %s HTTP/1.1\r\n", httpPath);
305 r += sprintf(r, "Host: %s\r\n", httpHost); 295 r += sprintf(r, "Host: %s\r\n", httpHost);
306 r += sprintf(r, "Content-Type: application/json\r\n"); 296 r += sprintf(r, "Content-Type: application/json\r\n");
307 r += sprintf(r, "Content-Length: %d\r\n\r\n", strlen(requestBody)); 297 r += sprintf(r, "Content-Length: %d\r\n", strlen(requestBody));
298 r += sprintf(r, "X-User-Login: %s\r\n", username);
299 r += sprintf(r, "X-User-Token: %s\r\n", token);
300 r += sprintf(r, "\r\n");
308 301
309 int result = tcpWrite( 302 int result = tcpWrite(
310 secure, 303 secure,