mirror of
https://github.com/php/php-src.git
synced 2025-08-18 06:58:55 +02:00
(Removed Makefile, added accidentally.)
Eliminated mod_msession in ext/session, and moved that code into msesion.c
This commit is contained in:
parent
f45555e62f
commit
d1a1ef3d9b
3 changed files with 81 additions and 23 deletions
|
@ -1,16 +0,0 @@
|
|||
top_srcdir = /local/projects/php/php4
|
||||
top_builddir = /local/projects/php/php4
|
||||
srcdir = /local/projects/php/php4/ext/msession
|
||||
builddir = /local/projects/php/php4/ext/msession
|
||||
VPATH = /local/projects/php/php4/ext/msession
|
||||
# $Id$
|
||||
|
||||
LTLIBRARY_NAME = libmsession.la
|
||||
LTLIBRARY_SOURCES = msession.c
|
||||
LTLIBRARY_SHARED_NAME = msession.la
|
||||
|
||||
LTLIBRARY_SHARED_LIBADD = $(PHOENIX_LIB)
|
||||
|
||||
EXTRA_INCLUDES = $(PHOENIX_INCLUDE)
|
||||
|
||||
include $(top_srcdir)/build/dynlib.mk
|
|
@ -2,7 +2,7 @@
|
|||
+----------------------------------------------------------------------+
|
||||
| msession 1.0 |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 2001 Mark L. Woodward (Mohawk Software) |
|
||||
| Copyright (c) 1997-2001 The PHP Group |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 2.02 of the PHP license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
|
@ -20,10 +20,34 @@
|
|||
#include "php_ini.h"
|
||||
#include "php_msession.h"
|
||||
#include "reqclient.h"
|
||||
#include "../session/php_session.h"
|
||||
|
||||
#ifndef TRUE
|
||||
#define TRUE 1
|
||||
#endif
|
||||
#ifndef FALSE
|
||||
#define FALSE 0
|
||||
#endif
|
||||
|
||||
// #define ERR_DEBUG
|
||||
|
||||
#ifdef ERR_DEBUG
|
||||
#define ELOG( str ) php_log_err( str )
|
||||
#else
|
||||
#define ELOG( str )
|
||||
#endif
|
||||
|
||||
char g_msession[]="Msession";
|
||||
|
||||
|
||||
#if HAVE_MSESSION
|
||||
|
||||
PS_FUNCS(msession);
|
||||
|
||||
ps_module ps_mod_msession = {
|
||||
PS_MOD(msession)
|
||||
};
|
||||
|
||||
// #define ERR_DEBUG
|
||||
|
||||
/* If you declare any globals in php_msession.h uncomment this:
|
||||
|
@ -97,6 +121,8 @@ PHP_MINIT_FUNCTION(msession)
|
|||
g_conn = NULL;
|
||||
g_host = g_defhost;
|
||||
|
||||
php_session_register_module(&ps_mod_msession);
|
||||
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -160,7 +186,7 @@ PHP_FUNCTION(confirm_msession_compiled)
|
|||
g_port);
|
||||
RETURN_STRINGL(string, len, 1);
|
||||
}
|
||||
int PHPMsessionConnect(char *szhost, int nport)
|
||||
int PHPMsessionConnect(const char *szhost, int nport)
|
||||
{
|
||||
if(!g_reqb)
|
||||
g_reqb = AllocateRequestBuffer(2048);
|
||||
|
@ -209,7 +235,7 @@ void PHPMsessionDisconnect()
|
|||
}
|
||||
}
|
||||
|
||||
char *PHPMsessionGetData(char *session)
|
||||
char *PHPMsessionGetData(const char *session)
|
||||
{
|
||||
char *ret = NULL;
|
||||
|
||||
|
@ -229,7 +255,7 @@ char *PHPMsessionGetData(char *session)
|
|||
ret = safe_estrdup(g_reqb->req.datum);
|
||||
return ret;
|
||||
}
|
||||
int PHPMsessionSetData(char *session, char *data)
|
||||
int PHPMsessionSetData(const char *session, const char *data)
|
||||
{
|
||||
int ret=0;
|
||||
#ifdef ERR_DEBUG
|
||||
|
@ -246,7 +272,7 @@ int PHPMsessionSetData(char *session, char *data)
|
|||
return ret;
|
||||
}
|
||||
|
||||
int PHPMsessionDestroy(char *session)
|
||||
int PHPMsessionDestroy(const char *session)
|
||||
{
|
||||
int ret=0;
|
||||
if(!g_reqb)
|
||||
|
@ -799,4 +825,52 @@ PHP_FUNCTION(msession_setdata)
|
|||
}
|
||||
}
|
||||
|
||||
PS_OPEN_FUNC(msession)
|
||||
{
|
||||
ELOG( "ps_open_msession");
|
||||
PS_SET_MOD_DATA((void *)1); // session.c needs a non-zero here!
|
||||
return PHPMsessionConnect(save_path, 8086) ? SUCCESS : FAILURE;
|
||||
}
|
||||
|
||||
PS_CLOSE_FUNC(msession)
|
||||
{
|
||||
PHPMsessionDisconnect();
|
||||
ELOG( "ps_close_msession");
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
PS_READ_FUNC(msession)
|
||||
{
|
||||
ELOG( "ps_read_msession");
|
||||
*val = PHPMsessionGetData(key);
|
||||
if(*val)
|
||||
{
|
||||
*vallen = strlen(*val);
|
||||
}
|
||||
else
|
||||
{
|
||||
*val = emalloc(1);
|
||||
**val=0;
|
||||
*vallen = 0;
|
||||
}
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
PS_WRITE_FUNC(msession)
|
||||
{
|
||||
ELOG( "ps_write_msession");
|
||||
return (PHPMsessionSetData(key,val)) ? SUCCESS : FAILURE;
|
||||
}
|
||||
|
||||
PS_DESTROY_FUNC(msession)
|
||||
{
|
||||
ELOG( "ps_destroy_msession");
|
||||
return (PHPMsessionDestroy(key)) ? SUCCESS : FAILURE;
|
||||
}
|
||||
|
||||
PS_GC_FUNC(msession)
|
||||
{
|
||||
ELOG( "ps_gc_msession");
|
||||
return SUCCESS;
|
||||
}
|
||||
#endif /* HAVE_MSESSION */
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
+----------------------------------------------------------------------+
|
||||
| msession 1.0 |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 2001 Mark L. Woodward (Mohawk Software) |
|
||||
| Copyright (c) 1997-2001 The PHP Group |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 2.02 of the PHP license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
|
@ -82,7 +82,7 @@ void FreeRequestBuffer(REQB *req);
|
|||
REQB *SizeRequestBuffer(REQB *req, unsigned int size);
|
||||
REQB *StaticRequestBuffer(char *buffer, unsigned int cb);
|
||||
|
||||
int FormatRequest(REQB **buffer, int stat, char *session, char *name, char *value, int param);
|
||||
int FormatRequest(REQB **buffer, int stat, const char *session, const char *name, const char *value, int param);
|
||||
int FormatRequestMulti(REQB **buffer, int stat, char *session, int n, char **pairs, int param);
|
||||
int DoSingleRequest(char *hostname, int port, REQB **preq);
|
||||
void *OpenReqConn(char *hostname, int port);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue