add AQCGI_Request_Get/Set/Add/DelFlags()

This commit is contained in:
Martin Preuss
2025-10-23 20:56:52 +02:00
parent 34b25ca4da
commit 2689e72f5e
4 changed files with 53 additions and 5 deletions

View File

@@ -63,7 +63,7 @@
</headers>
<headers dist="true" >
<headers dist="true" install="$(pkgincludedir)" >
api.h
cgi.h
request.h

View File

@@ -1,6 +1,6 @@
/****************************************************************************
* This file is part of the project AqCGI.
* AqCGI (c) by 2024 Martin Preuss, all rights reserved.
* AqCGI (c) by 2025 Martin Preuss, all rights reserved.
*
* The license for this file can be found in the file COPYING which you
* should have received along with this file.
@@ -65,7 +65,9 @@ GWEN_BUFFER *AQCGI_Request_GetBufferResponseHeader(const AQCGI_REQUEST *rq)
void AQCGI_Request_AddResponseHeaderData(AQCGI_REQUEST *rq, const char *s)
{
if (rq && s && *s) {
GWEN_Buffer_AppendString(rq->bufferResponseHeader, s);
GWEN_Buffer_AppendArgs(rq->bufferResponseHeader, "%s\n", s);
if (strncasecmp(s, "Content-type:", 13)==0)
rq->flags|=AQCGI_FLAGS_HAS_CONTENT_HEADER;
}
}
@@ -261,5 +263,39 @@ void AQCGI_Request_SetResponseRedirect(AQCGI_REQUEST *rq, const char *s)
uint32_t AQCGI_Request_GetFlags(const AQCGI_REQUEST *rq)
{
return rq?(rq->flags):0;
}
void AQCGI_Request_SetFlags(AQCGI_REQUEST *rq, uint32_t f)
{
if (rq)
rq->flags=f;
}
void AQCGI_Request_AddFlags(AQCGI_REQUEST *rq, uint32_t f)
{
if (rq)
rq->flags|=f;
}
void AQCGI_Request_SubFlags(AQCGI_REQUEST *rq, uint32_t f)
{
if (rq)
rq->flags&=~f;
}

View File

@@ -1,6 +1,6 @@
/****************************************************************************
* This file is part of the project AqCGI.
* AqCGI (c) by 2024 Martin Preuss, all rights reserved.
* AqCGI (c) by 2025 Martin Preuss, all rights reserved.
*
* The license for this file can be found in the file COPYING which you
* should have received along with this file.
@@ -17,6 +17,10 @@
#include <gwenhywfar/db.h>
#define AQCGI_FLAGS_HAS_CONTENT_HEADER 0x0001
enum {
AQCGI_REQUEST_METHOD_GET=0,
AQCGI_REQUEST_METHOD_POST
@@ -69,4 +73,11 @@ AQCGI_API const char *AQCGI_Request_GetResponseRedirect(const AQCGI_REQUEST *rq)
AQCGI_API void AQCGI_Request_SetResponseRedirect(AQCGI_REQUEST *rq, const char *s);
AQCGI_API uint32_t AQCGI_Request_GetFlags(const AQCGI_REQUEST *rq);
AQCGI_API void AQCGI_Request_SetFlags(AQCGI_REQUEST *rq, uint32_t f);
AQCGI_API void AQCGI_Request_AddFlags(AQCGI_REQUEST *rq, uint32_t f);
AQCGI_API void AQCGI_Request_SubFlags(AQCGI_REQUEST *rq, uint32_t f);
#endif

View File

@@ -1,6 +1,6 @@
/****************************************************************************
* This file is part of the project AqCGI.
* AqCGI (c) by 2024 Martin Preuss, all rights reserved.
* AqCGI (c) by 2025 Martin Preuss, all rights reserved.
*
* The license for this file can be found in the file COPYING which you
* should have received along with this file.
@@ -30,6 +30,7 @@ struct AQCGI_REQUEST {
char *responseText;
char *responseRedirect;
uint32_t flags;
};