MQX 4.1 HTTPSRV_cgi_write unhandled exception

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

MQX 4.1 HTTPSRV_cgi_write unhandled exception

872 Views
justinancheta
Contributor I

I have recently run into an issue when I call HTTPSRV_cgi_write. An unhandled exception occurs seemingly at _task_block.

Call Stack:

callstack.JPG

I basically followed what I found in the web_hvac example and my function that calls HTTPSRV_cgi_write (s32_CGI_Post_Nav) never gets to its return statement

Code snippet from s32_CGI_Post_Nav

...

HTTPSRV_CGI_RES_STRUCT st_Response;

...

st_Response.ses_handle = pst_Param->ses_handle;

st_Response.content_type = HTTPSRV_CONTENT_TYPE_HTML;

st_Response.status_code = 200;

st_Response.data = "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\">"

"<html><head><title>Navigation NONE Response</title>"

"<meta http-equiv=\"REFRESH\" content=\"0;url=index.html\"></head>\n<body>\n"

"<br><br>\n</body></html>";

st_Response.data_length = strlen( st_Response.data );

st_Response.content_length = 0;

HTTPSRV_cgi_write( &st_Response );

return ( st_Response.content_length );

I am ultimately trying to reload a certain page after a form post but nothing is ever getting sent back to the browser.

I do a HTTPSRV_cgi_read before setting the response and i have verified all data has been read.

I am using the K64 Freedom Board. CPU: MK64FN1M0VLL12

Labels (1)
0 Kudos
3 Replies

564 Views
danielchen
NXP TechSupport
NXP TechSupport

Hi

I think the unhandled exception maybe related to memory issue, I suggest you check the st_Response.data buff, there is a reference code under the folder rtcs\examples\httpsrv.

Regards

Daniel

0 Kudos

564 Views
justinancheta
Contributor I

I think i was going off the hvac example because the httpsrv has only GET examples and no POST ones. I also ran into the same kind of error with the HTTPSRV_ssi_write command. I was finally able to figure out that HTTPSRVCFG_TX_BUFFER_SIZE and HTTPSRVCFG_SES_BUFFER_SIZE were too small for what i was trying. I also get an error if HTTPSRVCFG_SES_BUFFER_SIZE is larger than HTTPSRVCFG_TX_BUFFER_SIZE  (if HTTPSRVCFG_SES_BUFFER_SIZE  is more full than HTTPSRVCFG_TX_BUFFER_SIZE  is big). Am I correct in my findings?

I am just now coming back to the cgi stuff because I had other things to do so Ill be trying them again with the increased buffer sizes.

0 Kudos

564 Views
danielchen
NXP TechSupport
NXP TechSupport

  HTTPSRVCFG_SES_BUFFER_SIZE is size of session buffer. Session buffer is used for buffering user data (CGI, SSI, files from file system etc.) for both sending and receiving.
  HTTPSRVCFG_TX_BUFFER_SIZE value is set with setsockopt function as OPT_TBSIZE for each session socket.

Generally speaking, HTTPSRVCFG_SES_BUFFER_SIZE should be less than HTTPSRVCFG_TX_BUFFER_SIZE

0 Kudos