|
@@ -129,6 +129,7 @@ static const char Content_Length[17] =
|
|
|
{0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x2d, 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x3a, 0x20, };
|
|
|
|
|
|
const char HTTP_304_NOT_MODIFIED[] = "HTTP/1.1 304 Not Modified\r\n\r\n";
|
|
|
+const char HTTP_401_NO_AUTH[] = "HTTP/1.1 401 No authorization\r\n\r\n";
|
|
|
const char HTTP_403_NOT_WHITE_LIST[] = "HTTP/1.1 403 Forbidden\r\n\r\n";
|
|
|
const char HTTP_500_SERVER_ERROR[] = "HTTP/1.1 500 Internal Server Error\r\n\r\n";
|
|
|
const char HTTP_200_OK[] = "HTTP/1.1 200 OK\r\n\r\n";
|
|
@@ -339,9 +340,12 @@ static err_t http_recv(void *arg, struct tcp_pcb *pcb, struct pbuf *p, err_t er
|
|
|
#endif
|
|
|
#ifdef HTTP_AUTH_ENABLE
|
|
|
if (h->accsess == TIME_ACCESS && !Authenticated) {
|
|
|
- fs_open("/login.html", &file);
|
|
|
- hs->file = file.data;
|
|
|
- hs->left = file.len;
|
|
|
+ strcpy(sendBuf, HTTP_401_NO_AUTH);
|
|
|
+ strcat(sendBuf,
|
|
|
+ "<!DOCTYPE html><html lang=""><head><meta http-equiv=\"refresh\" content=\"0;url=/login.html\"/></head></html>\r\n");
|
|
|
+ sendBufLoadLen = strlen(sendBuf);
|
|
|
+ hs->file = sendBuf;
|
|
|
+ hs->left = sendBufLoadLen;
|
|
|
send_data(pcb, hs);
|
|
|
tcp_sent(pcb, http_sent);
|
|
|
tcp_err(pcb, http_err);
|
|
@@ -1509,9 +1513,9 @@ char *HTTP_UPSshutdown(uint32_t reqNum, char *bufIn, char *bufOut, uint16_t lenB
|
|
|
strcpy(log_string, name_login);
|
|
|
strcat(log_string, " (Останов)");
|
|
|
log_event_data(LOG_SHUTDOWN_UPS, log_string);
|
|
|
- strcat(bufOut, "Выключение нагрузки ИБП отменено!");
|
|
|
+ strcat(bufOut, "Команда \"Отмена выключения нагрузки\" принята ИБП!");
|
|
|
} else {
|
|
|
- strcat(bufOut, "Выключение нагрузки ИБП не удалось отменить!");
|
|
|
+ strcat(bufOut, "Команда \"Отмена выключения нагрузки\" отклонена ИБП!");
|
|
|
}
|
|
|
} else if (strncmp(tempValue, "off", 5) == 0) {
|
|
|
memset(tempValue2, 0, 50);
|
|
@@ -1519,10 +1523,10 @@ char *HTTP_UPSshutdown(uint32_t reqNum, char *bufIn, char *bufOut, uint16_t lenB
|
|
|
TimeParamFloat = atof(tempValue2);
|
|
|
res = ups_metac_service_pdu(ups_shutdown);
|
|
|
if (res == 1) {
|
|
|
- strcat(bufOut, "Отключение нагрузки ИБП!");
|
|
|
+ strcat(bufOut, "Команда \"Отключения нагрузки\" принята ИБП!");
|
|
|
log_event_data(LOG_SHUTDOWN_UPS, name_login);
|
|
|
} else {
|
|
|
- strcat(bufOut, "Отключение нагрузки ИБП не удалось!");
|
|
|
+ strcat(bufOut, "Команда \"Отключения нагрузки\" отклонена ИБП!");
|
|
|
}
|
|
|
}
|
|
|
*lenBufOut = strlen(bufOut);
|