Update LiteSpeed SAPI code to V6.4

This commit is contained in:
George Wang 2013-11-05 16:14:49 -05:00
parent 3720fd77b5
commit 01bc13212e
4 changed files with 2746 additions and 1208 deletions

File diff suppressed because it is too large Load Diff

View File

@ -1,25 +1,5 @@
/*
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2013 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available at through the world-wide-web at the following url: |
| http://www.php.net/license/3_01.txt. |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
| Author: George Wang <gwang@litespeedtech.com> |
+----------------------------------------------------------------------+
*/
/*
Copyright (c) 2007, Lite Speed Technologies Inc.
Copyright (c) 2005, Lite Speed Technologies Inc.
All rights reserved.
Redistribution and use in source and binary forms, with or without
@ -50,6 +30,13 @@ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/***************************************************************************
$Id: lsapidef.h,v 1.17 2012/12/01 19:23:31 gwang Exp $
-------------------
begin : Thu Feb 10 2005
author : George Wang
email : gwang@litespeedtech.com
***************************************************************************/
#ifndef _LSAPIDEF_H_
#define _LSAPIDEF_H_
@ -113,12 +100,14 @@ enum
#define LSAPI_RESP_END 5
#define LSAPI_STDERR_STREAM 6
#define LSAPI_REQ_RECEIVED 7
#define LSAPI_CONN_CLOSE 8
#define LSAPI_INTERNAL_ERROR 9
#define LSAPI_MAX_HEADER_LEN 65535
#define LSAPI_MAX_DATA_PACKET_LEN 16384
#define LSAPI_RESP_HTTP_HEADER_MAX 4096
#define LSAPI_RESP_HTTP_HEADER_MAX 32768
#define LSAPI_PACKET_HEADER_LEN 8

File diff suppressed because it is too large Load Diff

View File

@ -1,24 +1,5 @@
/*
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2013 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available at through the world-wide-web at the following url: |
| http://www.php.net/license/3_01.txt. |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
| Author: George Wang <gwang@litespeedtech.com> |
+----------------------------------------------------------------------+
*/
/*
Copyright (c) 2007, Lite Speed Technologies Inc.
Copyright (c) 2013, Lite Speed Technologies Inc.
All rights reserved.
Redistribution and use in source and binary forms, with or without
@ -49,6 +30,13 @@ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/***************************************************************************
lsapilib.h - description
-------------------
begin : Mon Feb 21 2005
copyright : (C) 2005 by George Wang
email : gwang@litespeedtech.com
***************************************************************************/
#ifndef _LSAPILIB_H_
@ -118,7 +106,8 @@ typedef struct lsapi_request
char * m_pRequestMethod;
int m_totalLen;
int m_reqState;
int m_reqBodyRead;
off_t m_reqBodyLen;
off_t m_reqBodyRead;
int m_bufProcessed;
int m_bufRead;
@ -126,6 +115,7 @@ typedef struct lsapi_request
struct lsapi_resp_header m_respHeader;
short m_respHeaderLen[LSAPI_MAX_RESP_HEADERS];
void * m_pAppData;
}LSAPI_Request;
@ -170,22 +160,30 @@ int LSAPI_ForeachSpecialEnv_r( LSAPI_Request * pReq,
char * LSAPI_GetEnv_r( LSAPI_Request * pReq, const char * name );
int LSAPI_ReadReqBody_r( LSAPI_Request * pReq, char * pBuf, int len );
ssize_t LSAPI_ReadReqBody_r( LSAPI_Request * pReq, char * pBuf, size_t len );
int LSAPI_ReqBodyGetChar_r( LSAPI_Request * pReq );
int LSAPI_ReqBodyGetLine_r( LSAPI_Request * pReq, char * pBuf, int bufLen, int *getLF );
int LSAPI_ReqBodyGetLine_r( LSAPI_Request * pReq, char * pBuf, size_t bufLen, int *getLF );
int LSAPI_FinalizeRespHeaders_r( LSAPI_Request * pReq );
int LSAPI_Write_r( LSAPI_Request * pReq, const char * pBuf, int len );
ssize_t LSAPI_Write_r( LSAPI_Request * pReq, const char * pBuf, size_t len );
int LSAPI_Write_Stderr_r( LSAPI_Request * pReq, const char * pBuf, int len );
ssize_t LSAPI_sendfile_r( LSAPI_Request * pReq, int fdIn, off_t* off, size_t size );
ssize_t LSAPI_Write_Stderr_r( LSAPI_Request * pReq, const char * pBuf, size_t len );
int LSAPI_Flush_r( LSAPI_Request * pReq );
int LSAPI_AppendRespHeader_r( LSAPI_Request * pHeader, char * pBuf, int len );
int LSAPI_AppendRespHeader_r( LSAPI_Request * pReq, const char * pBuf, int len );
int LSAPI_AppendRespHeader2_r( LSAPI_Request * pReq, const char * pHeaderName,
const char * pHeaderValue );
int LSAPI_ErrResponse_r( LSAPI_Request * pReq, int code, const char ** pRespHeaders,
const char * pBody, int bodyLen );
static inline int LSAPI_SetRespStatus_r( LSAPI_Request * pReq, int code )
{
@ -195,6 +193,21 @@ static inline int LSAPI_SetRespStatus_r( LSAPI_Request * pReq, int code )
return 0;
}
static inline int LSAPI_SetAppData_r( LSAPI_Request * pReq, void * data )
{
if ( !pReq )
return -1;
pReq->m_pAppData = data;
return 0;
}
static inline void * LSAPI_GetAppData_r( LSAPI_Request * pReq )
{
if ( !pReq )
return NULL;
return pReq->m_pAppData;
}
static inline char * LSAPI_GetQueryString_r( LSAPI_Request * pReq )
{
if ( pReq )
@ -228,21 +241,22 @@ static inline char * LSAPI_GetRequestMethod_r( LSAPI_Request * pReq)
static inline int LSAPI_GetReqBodyLen_r( LSAPI_Request * pReq )
static inline off_t LSAPI_GetReqBodyLen_r( LSAPI_Request * pReq )
{
if ( pReq )
return pReq->m_pHeader->m_reqBodyLen;
return pReq->m_reqBodyLen;
return -1;
}
static inline int LSAPI_GetReqBodyRemain_r( LSAPI_Request * pReq )
static inline off_t LSAPI_GetReqBodyRemain_r( LSAPI_Request * pReq )
{
if ( pReq )
return pReq->m_pHeader->m_reqBodyLen - pReq->m_reqBodyRead;
return pReq->m_reqBodyLen - pReq->m_reqBodyRead;
return -1;
}
int LSAPI_Is_Listen(void);
static inline int LSAPI_Accept( void )
@ -282,13 +296,13 @@ static inline char * LSAPI_GetScriptName()
static inline char * LSAPI_GetRequestMethod()
{ return LSAPI_GetRequestMethod_r( &g_req ); }
static inline int LSAPI_GetReqBodyLen()
static inline off_t LSAPI_GetReqBodyLen()
{ return LSAPI_GetReqBodyLen_r( &g_req ); }
static inline int LSAPI_GetReqBodyRemain()
static inline off_t LSAPI_GetReqBodyRemain()
{ return LSAPI_GetReqBodyRemain_r( &g_req ); }
static inline int LSAPI_ReadReqBody( char * pBuf, int len )
static inline ssize_t LSAPI_ReadReqBody( char * pBuf, size_t len )
{ return LSAPI_ReadReqBody_r( &g_req, pBuf, len ); }
static inline int LSAPI_ReqBodyGetChar()
@ -302,10 +316,15 @@ static inline int LSAPI_ReqBodyGetLine( char * pBuf, int len, int *getLF )
static inline int LSAPI_FinalizeRespHeaders(void)
{ return LSAPI_FinalizeRespHeaders_r( &g_req ); }
static inline int LSAPI_Write( const char * pBuf, int len )
static inline ssize_t LSAPI_Write( const char * pBuf, ssize_t len )
{ return LSAPI_Write_r( &g_req, pBuf, len ); }
static inline int LSAPI_Write_Stderr( const char * pBuf, int len )
static inline ssize_t LSAPI_sendfile( int fdIn, off_t* off, size_t size )
{
return LSAPI_sendfile_r(&g_req, fdIn, off, size );
}
static inline ssize_t LSAPI_Write_Stderr( const char * pBuf, ssize_t len )
{ return LSAPI_Write_Stderr_r( &g_req, pBuf, len ); }
static inline int LSAPI_Flush()
@ -317,6 +336,9 @@ static inline int LSAPI_AppendRespHeader( char * pBuf, int len )
static inline int LSAPI_SetRespStatus( int code )
{ return LSAPI_SetRespStatus_r( &g_req, code ); }
static inline int LSAPI_ErrResponse( int code, const char ** pRespHeaders, const char * pBody, int bodyLen )
{ return LSAPI_ErrResponse_r( &g_req, code, pRespHeaders, pBody, bodyLen ); }
int LSAPI_IsRunning(void);
int LSAPI_CreateListenSock( const char * pBind, int backlog );
@ -341,7 +363,13 @@ void LSAPI_Set_Server_Max_Idle_Secs( int serverMaxIdle );
void LSAPI_Set_Max_Process_Time( int secs );
void LSAPI_Init_Env_Parameters( fn_select_t fp );
int LSAPI_Init_Env_Parameters( fn_select_t fp );
void LSAPI_Set_Slow_Req_Msecs( int msecs );
int LSAPI_Get_Slow_Req_Msecs( );
int LSAPI_is_suEXEC_Daemon();
#if defined (c_plusplus) || defined (__cplusplus)
}