summaryrefslogtreecommitdiff
path: root/main/SAPI.h
diff options
context:
space:
mode:
Diffstat (limited to 'main/SAPI.h')
-rw-r--r--main/SAPI.h57
1 files changed, 51 insertions, 6 deletions
diff --git a/main/SAPI.h b/main/SAPI.h
index 7796fc0634..2b76ceae4c 100644
--- a/main/SAPI.h
+++ b/main/SAPI.h
@@ -1,6 +1,9 @@
#ifndef _NEW_SAPI_H
#define _NEW_SAPI_H
+#include "zend.h"
+#include "zend_llist.h"
+
#if WIN32||WINNT
# ifdef SAPI_EXPORTS
@@ -13,14 +16,20 @@
#endif
-typedef struct _sapi_module_struct {
- char *name;
+typedef struct {
+ char *header;
+ uint header_len;
+} sapi_header_struct;
- int (*startup)(struct _sapi_module_struct *sapi_module);
- int (*shutdown)(struct _sapi_module_struct *sapi_module);
- int (*ub_write)(const char *str, unsigned int str_length);
-} sapi_module_struct;
+typedef struct {
+ zend_llist headers;
+ sapi_header_struct content_type;
+ int http_response_code;
+} sapi_headers_struct;
+
+
+typedef struct _sapi_module_struct sapi_module_struct;
extern sapi_module_struct sapi_module; /* true global */
@@ -31,16 +40,24 @@ typedef struct {
char *path_translated;
char *request_uri;
+
+ unsigned char headers_only;
} sapi_request_info;
typedef struct {
void *server_context;
sapi_request_info request_info;
+ sapi_headers_struct sapi_headers;
} sapi_globals_struct;
SAPI_API void sapi_startup(sapi_module_struct *sf);
+SAPI_API void sapi_activate(SLS_D);
+SAPI_API void sapi_deactivate(SLS_D);
+
+SAPI_API int sapi_add_header(const char *header_line, uint header_line_len);
+SAPI_API int sapi_send_headers();
#ifdef ZTS
# define SLS_D sapi_globals_struct *sapi_globals
@@ -61,4 +78,32 @@ extern SAPI_API sapi_globals_struct sapi_globals;
#endif
+
+struct _sapi_module_struct {
+ char *name;
+
+ int (*startup)(struct _sapi_module_struct *sapi_module);
+ int (*shutdown)(struct _sapi_module_struct *sapi_module);
+
+ int (*ub_write)(const char *str, unsigned int str_length);
+
+ int (*header_handler)(sapi_header_struct *sapi_header, sapi_headers_struct *sapi_headers);
+ int (*send_headers)(sapi_headers_struct *sapi_headers SLS_DC);
+ void (*send_header)(void *server_context, sapi_header_struct *sapi_header);
+};
+
+
+
+/* header_handler() constants */
+#define SAPI_HEADER_ADD (1<<0)
+#define SAPI_HEADER_DELETE_ALL (1<<1)
+#define SAPI_HEADER_SEND_NOW (1<<2)
+
+
+#define SAPI_HEADER_SENT_SUCCESSFULLY 1
+#define SAPI_HEADER_DO_SEND 2
+#define SAPI_HEADER_SEND_FAILED 3
+
+#define DEFAULT_CONTENT_TYPE "Content-Type: text/html"
+
#endif /* _NEW_SAPI_H */ \ No newline at end of file