I solved this issue by follow steps:
1. In file ../Freescale MQX 3.5/rtcs/source/httpd/httpd.c
go to function
static void httpd_processreq(HTTPD_STRUCT *server, HTTPD_SESSION_STRUCT *session)
find a line
int cgi = 0, res = 0, auth = 0; // authorization required flag
and change it to
int cgi = 0, res = 0, auth = 1; // authorization required flag
In same file find a function
void httpd_ses_init(HTTPD_STRUCT *server, HTTPD_SESSION_STRUCT *session, const int sock)
and insert line
HTTPD_MEMZERO(session->request.auth, server->params->max_auth);
before
#if HTTPDCFG_POLL_MODE session->line_used = 0;#endif
2. Add to my project authentification callback function like this:
int _http_auth_internal (HTTPD_SESSION_STRUCT* session){ // check user login if (strncmp(session->request.auth, your_login, YOUR_LOGIN_SIZE) != 0) return 1; // check user password if (strncmp(session->request.authPasswd, your_pass, YOUR_PASSWORD_SIZE) != 0) return 1; // all good return 0;}
And attach this callback with
HTTPD_SET_PARAM_AUTH_FN(server, _http_auth_internal);
That's all. Work fine in my project on MQX version 3.5.