|
@@ -795,24 +795,28 @@ void HTTP_SetSettings(char *buf, uint16_t lenBuf)
|
|
|
|
|
|
// Параметры даты и времени
|
|
|
GetParamValue(buf, "ntp=", value, &valueLen);
|
|
|
- SetSntpStateStr(value);
|
|
|
|
|
|
if (strncmp(value, "1", 1) == 0) // Если ntp on устанавливаем параметры
|
|
|
{
|
|
|
+ memset(str, 0, len);
|
|
|
+ GetParamValue(buf, "ntpservip=", str, &valueLen);
|
|
|
+ SetSntpServerIpStr(str);
|
|
|
+ SetSntpStateStr(value);
|
|
|
memset(value, 0, len);
|
|
|
-
|
|
|
- GetParamValue(buf, "ntpservip=", value, &valueLen);
|
|
|
- SetSntpServerIpStr(value);
|
|
|
- memset(value, 0, len);
|
|
|
+ memset(str, 0, len);
|
|
|
}
|
|
|
else if (strncmp(value, "0", 1) == 0){
|
|
|
+ SetSntpStateStr(value);
|
|
|
+ memset(value, 0, len);
|
|
|
GetParamValue(buf, "date=", value, &valueLen);
|
|
|
SetDateStr(value);
|
|
|
memset(value, 0, len);
|
|
|
GetParamValue(buf, "time=", value, &valueLen);
|
|
|
+ memset(str, 0, len);
|
|
|
url_decode(str, sizeof(str), value);
|
|
|
SetTimeStr(str);
|
|
|
memset(value, 0, len);
|
|
|
+ memset(str, 0, len);
|
|
|
}
|
|
|
|
|
|
GetParamValue(buf, "utc=", value, &valueLen);
|
|
@@ -1150,13 +1154,13 @@ int HTTP_ConfirmWebPwd(char *bufIn, char *bufOut, uint16_t lenBufIn, uint16_t *l
|
|
|
if(cnt_err_psw < 4)
|
|
|
strcat(bufOut,"<!DOCTYPE html><html><head><meta charset=\"utf-8\"><meta http-equiv=\"refresh\" content=\"3; url=/rslogin.html\" /></head><center><h2>Не правильный логин или пароль</h2></center></html>");
|
|
|
else
|
|
|
- strcat(bufOut,"<!DOCTYPE html><html><head><meta charset=\"utf-8\"><meta http-equiv=\"refresh\" content=\"3; url=/rslogin.html\" /></head><center><h2>Вход заблокирован!</h2></center></head><center><h2>Повторите попытку через 15 минут</h2></center></html>");
|
|
|
+ strcat(bufOut,"<!DOCTYPE html><html><head><meta charset=\"utf-8\"><meta http-equiv=\"refresh\" content=\"3; url=/rslogin.html\" /></head><center><h2>Вход заблокирован!</h2></center></head><center><h2>Повторите попытку через 1 минуту</h2></center></html>");
|
|
|
}
|
|
|
else{
|
|
|
if(cnt_err_psw < 4)
|
|
|
strcat(bufOut,"<!DOCTYPE html><html><head><meta charset=\"utf-8\"><meta http-equiv=\"refresh\" content=\"3; url=/login.html\" /></head><center><h2>Не правильный логин или пароль</h2></center></html>");
|
|
|
else
|
|
|
- strcat(bufOut,"<!DOCTYPE html><html><head><meta charset=\"utf-8\"><meta http-equiv=\"refresh\" content=\"3; url=/login.html\" /></head><center><h2>Вход заблокирован!</h2></center></head><center><h2>Повторите попытку через 15 минут</h2></center></html>");
|
|
|
+ strcat(bufOut,"<!DOCTYPE html><html><head><meta charset=\"utf-8\"><meta http-equiv=\"refresh\" content=\"3; url=/login.html\" /></head><center><h2>Вход заблокирован!</h2></center></head><center><h2>Повторите попытку через 1 минуту</h2></center></html>");
|
|
|
}
|
|
|
*lenBufOut = strlen(bufOut);
|
|
|
return SEND_REQUIRED_NO;
|
|
@@ -1662,6 +1666,7 @@ void ssl_server_read(void)
|
|
|
|
|
|
// Read decrypted application data
|
|
|
ret = ssl_read(&ssl, (unsigned char*)receiveBuf, receivedBufLen);
|
|
|
+ printf("receive %s \r\n", receiveBuf);
|
|
|
|
|
|
if(ret == POLARSSL_ERR_NET_WANT_READ || ret == POLARSSL_ERR_NET_WANT_WRITE)
|
|
|
continue;
|
|
@@ -1679,14 +1684,14 @@ void ssl_server_read(void)
|
|
|
break;
|
|
|
|
|
|
default:
|
|
|
- //printf("\n\r ssl_read returned %d\n", ret);
|
|
|
+ printf("\n\r ssl_read returned %d\n", ret);
|
|
|
break;
|
|
|
}
|
|
|
break;
|
|
|
}
|
|
|
receivedBufLen = ret;
|
|
|
// Display the length of read data
|
|
|
- //printf("\n\r Successfully read %d bytes from client \n\r",len);
|
|
|
+ printf("\n\r Successfully read %d bytes from client \n\r",receivedBufLen);
|
|
|
}while(0);
|
|
|
}
|
|
|
|
|
@@ -1826,7 +1831,7 @@ void ssl_server(void *pvParameters)
|
|
|
//memcpy(receiveBuf, p->payload , receivedBufLen);
|
|
|
|
|
|
receiveBuf[receivedBufLen] = '\0';
|
|
|
- // printf("receive %s \r\n", receiveBuf);
|
|
|
+ // printf("receive %s \r\n", receiveBuf);
|
|
|
// Get cookie "uname" value
|
|
|
CookiePtr = strstr(receiveBuf, "uname=");
|
|
|
strncpy(CookieBuf, CookiePtr, 50);
|
|
@@ -2111,7 +2116,7 @@ void ssl_server(void *pvParameters)
|
|
|
for(i = TotalData; i < size; i ++)
|
|
|
{
|
|
|
ssl_server_read();
|
|
|
- strncat(sendBuf, DataOffset, receivedBufLen);
|
|
|
+ strncat(sendBuf, receiveBuf, receivedBufLen);
|
|
|
TotalData += receivedBufLen;
|
|
|
}
|
|
|
|
|
@@ -2120,7 +2125,7 @@ void ssl_server(void *pvParameters)
|
|
|
{
|
|
|
DBG printf("State: Received %d bytes\r\n", (int)TotalData);
|
|
|
|
|
|
- DBG printf("receive %s /r/n", sendBuf);
|
|
|
+ // printf("receive %s \r\n", sendBuf);
|
|
|
strncat(sendBuf, " ", 1);
|
|
|
HTTP_SetSettings(sendBuf, strlen(sendBuf));
|
|
|
|