AnsweredAssumed Answered

MQX 4.1 HTTP Server question

Question asked by igor-imx on Mar 3, 2014
Latest reply on Mar 5, 2014 by igor-imx

Hi Everyone

I just downloaded and got MQX 4.1 up and running with our new board, however i have noticed something strange.

Before this, we used MQX 4.0 with the older HTTP server implementation, however mqx 4.0 had a function "httpd_get_varval" which allowed me to extract the key/value pairs submitted through the http web form.

I can't seem to find this or an alternative function in the MQX 4.1. Am i missing something? how can i achieve the same functionality so i can port the rest of the code we have?

We are using this for device configuration through the web screens.

Any help will be highly appreciated. I also paste the example code of how the old function was used.




  //Get the current configuration for this device

  UINT  uiLen                             = 0, i=0;

  CHAR  sClearFault[6][55]          = {0};

  CHAR                      * ucpBuffer   = NULL;

  INT     iError = SUCCESS;




  if(!ucpBuffer){iError = HTML_ERROR_INTERNAL; LRETURN;}

  if(!session->request.content_len) {iError = HTML_ERROR_MISSING_OR_INVALID_PARAMS; LRETURN;}



  uiLen = session->request.content_len;

  uiLen = httpd_read(session, ucpBuffer, (INT)((uiLen > MAX_HTTP_BUFFER_SIZE) ? MAX_HTTP_BUFFER_SIZE : uiLen));

  ucpBuffer[uiLen] = 0;

  session->request.content_len -= uiLen;


  if (


        httpd_get_varval(session, ucpBuffer, "Rf_d1", sClearFault[0], sizeof(sClearFault[0])) ||

        httpd_get_varval(session, ucpBuffer, "Rf_d2", sClearFault[1], sizeof(sClearFault[1])) ||

        httpd_get_varval(session, ucpBuffer, "Rf_d3", sClearFault[2], sizeof(sClearFault[2])) ||

        httpd_get_varval(session, ucpBuffer, "Rf_d4", sClearFault[3], sizeof(sClearFault[3])) ||

        httpd_get_varval(session, ucpBuffer, "Rf_d5", sClearFault[4], sizeof(sClearFault[4])) ||

        httpd_get_varval(session, ucpBuffer, "Rf_d6", sClearFault[5], sizeof(sClearFault[5]))




    iError = HTML_ERROR_MISSING_OR_INVALID_PARAMS; LRETURN; //Missing or invalid params







      gsaDevs[i].ucToFaultCnt = 0;







  CGI_sendHttpResultMessage(session,SUCCESS, DEVICE_STATUS_PAGE_PATH);



  iError = session->request.content_len;

  return iError;




Thank you