Hi all,
I start a server with a URI handler called cmgmRequestHandler. First time
cmgmRequestHandler will return MG_REQUEST_CALL_AGAIN and send a request to
another web server via mg_connect call. After download success from another
server the Request Handler will call mg_send_data to give browser a
response which content comes from another server.
I find that after download success and call mg_send_data the request
handler return MG_REQUEST_PROCESSED, the browser can not catch the response.
Anyone can give me a right solution? Thanks very much!
static int cmgmRequestHandler(struct mg_connection *conn)
{
static ConnectionParam param;
if (isIdle(¶m))
{
if (isConnect(conn))
{
printf("Connect Control Module!\n");
mg_connect(server, "127.0.0.1", 8090, 0, ts1, ¶m);
param.status = MG_PARAM_CONNECTING;
return MG_REQUEST_CALL_AGAIN;
}
else
{
printf("Other Request!\n");
return MG_REQUEST_NOT_PROCESSED;
}
}
if (isConnecting(¶m) || isConnected(¶m))
{
printf("Connecting Control Module!\n");
return MG_REQUEST_CALL_AGAIN;
}
else if (isDownloadSuccess(¶m))
{
printf("Control Module Download Success!\n");
mg_send_data(conn, param.content, strlen(param.content));
param.status = MG_PARAM_ERROR;
return MG_REQUEST_PROCESSED;
}
return MG_REQUEST_NOT_PROCESSED;
}
--
You received this message because you are subscribed to the Google Groups
"mongoose-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/mongoose-users.
For more options, visit https://groups.google.com/groups/opt_out.