summaryrefslogtreecommitdiff
path: root/sapi/litespeed/lsapilib.h
diff options
context:
space:
mode:
Diffstat (limited to 'sapi/litespeed/lsapilib.h')
-rw-r--r--sapi/litespeed/lsapilib.h100
1 files changed, 64 insertions, 36 deletions
diff --git a/sapi/litespeed/lsapilib.h b/sapi/litespeed/lsapilib.h
index 9d6255b327..b0638fd436 100644
--- a/sapi/litespeed/lsapilib.h
+++ b/sapi/litespeed/lsapilib.h
@@ -1,24 +1,5 @@
-
-/*
- +----------------------------------------------------------------------+
- | PHP Version 5 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2014 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)
}