More work on aqhome-cgi.

listing devices and values works.
This commit is contained in:
Martin Preuss
2025-09-12 15:09:00 +02:00
parent 757f4fca4f
commit 3bda196b79
12 changed files with 584 additions and 72 deletions

View File

@@ -108,10 +108,12 @@ int _handlePath(AQH_SERVICE *sv, AQCGI_REQUEST *rq, const char *sPathStaticFiles
{
AQH_MODULE *mRoot;
AQH_MODULE *mParent;
AQH_SESSION *session;
const GWEN_STRINGLIST *sl;
mRoot=AQH_ModRoot_new(sv, sPathStaticFiles);
mParent=mRoot;
session=AQH_ModService_ReadSession(mRoot, rq);
sl=AQCGI_Request_GetStringlistPath(rq);
if (sl) {
@@ -129,8 +131,9 @@ int _handlePath(AQH_SERVICE *sv, AQCGI_REQUEST *rq, const char *sPathStaticFiles
AQH_MODULE *m;
DBG_ERROR(NULL, "Entry: %s (%s)", s, seNext?"not last":"last");
m=AQH_ModService_LoadSubModule(mParent, rq, s);
if (m==NULL) {
m=AQH_ModService_LoadSubModule(mParent, rq, session, s);
if (m==NULL) {
AQH_Session_free(session);
AQH_Module_free(mRoot);
AQCGI_SendResponseWithStatus(rq, 404, "Not found");
return GWEN_ERROR_GENERIC;
@@ -141,9 +144,10 @@ int _handlePath(AQH_SERVICE *sv, AQCGI_REQUEST *rq, const char *sPathStaticFiles
int rv;
/* last, let module handle remaining part */
rv=AQH_ModService_HandleRequest(mParent, rq, s);
rv=AQH_ModService_HandleRequest(mParent, rq, session, s);
if (rv<0) {
DBG_INFO(NULL, "here (%d)", rv);
AQH_Session_free(session);
AQH_Module_free(mRoot);
return rv;
}
@@ -153,10 +157,12 @@ int _handlePath(AQH_SERVICE *sv, AQCGI_REQUEST *rq, const char *sPathStaticFiles
se=seNext;
}
AQH_Session_free(session);
AQH_Module_free(mRoot);
return 0;
}
else {
AQH_Session_free(session);
AQH_Module_free(mRoot);
return GWEN_ERROR_GENERIC;
}