Skip to content

Commit c50c46d

Browse files
committed
Improving https verification
1 parent 6d8dfe6 commit c50c46d

1 file changed

Lines changed: 3 additions & 8 deletions

File tree

Http.cpp

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -178,14 +178,9 @@ Result HTTP::setHTTPSession(const char *uri){
178178
if (sendCmdAndWaitForResp(httpPara, OK, 2000) == FALSE)
179179
result = ERROR_HTTP_PARA;
180180

181-
if (strncmp(HTTPS_PREFIX, uri, strlen(HTTPS_PREFIX)) == 0) {
182-
if (sendCmdAndWaitForResp(HTTPS_ENABLE, OK, 2000) == FALSE) {
183-
result = ERROR_HTTPS_ENABLE;
184-
}
185-
} else {
186-
if (sendCmdAndWaitForResp(HTTPS_DISABLE, OK, 2000) == FALSE) {
187-
result = ERROR_HTTPS_DISABLE;
188-
}
181+
bool https = strncmp(HTTPS_PREFIX, uri, strlen(HTTPS_PREFIX)) == 0;
182+
if (sendCmdAndWaitForResp(https ? HTTPS_ENABLE : HTTPS_DISABLE, OK, 2000) == FALSE) {
183+
result = https ? ERROR_HTTPS_ENABLE : ERROR_HTTPS_DISABLE;
189184
}
190185

191186
if (sendCmdAndWaitForResp(HTTP_CONTENT, OK, 2000) == FALSE)

0 commit comments

Comments
 (0)