ruby-lsapi 2.9 → 3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/ext/lsapi/lsapilib.c +72 -6
- data/ext/lsapi/lsapilib.h +7 -0
- metadata +2 -2
data/ext/lsapi/lsapilib.c
CHANGED
@@ -91,7 +91,7 @@ static const char *CGI_HEADERS[H_TRANSFER_ENCODING+1] =
|
|
91
91
|
"HTTP_IF_NONE_MATCH",
|
92
92
|
"HTTP_IF_RANGE",
|
93
93
|
"HTTP_IF_UNMODIFIED_SINCE",
|
94
|
-
"
|
94
|
+
"HTTP_KEEP_ALIVE",
|
95
95
|
"HTTP_RANGE",
|
96
96
|
"HTTP_X_FORWARDED_FOR",
|
97
97
|
"HTTP_VIA",
|
@@ -100,8 +100,9 @@ static const char *CGI_HEADERS[H_TRANSFER_ENCODING+1] =
|
|
100
100
|
|
101
101
|
static int CGI_HEADER_LEN[H_TRANSFER_ENCODING+1] =
|
102
102
|
{ 11, 19, 20, 20, 18, 15, 12, 14, 11, 12, 9, 11, 12, 15, 18,
|
103
|
-
22, 13, 18, 13, 24,
|
104
|
-
|
103
|
+
22, 13, 18, 13, 24, 15, 10, 20, 8, 22 };
|
104
|
+
|
105
|
+
|
105
106
|
static const char *HTTP_HEADERS[H_TRANSFER_ENCODING+1] =
|
106
107
|
{
|
107
108
|
"Accept", "Accept-Charset",
|
@@ -116,13 +117,17 @@ static const char *HTTP_HEADERS[H_TRANSFER_ENCODING+1] =
|
|
116
117
|
"If-None-Match",
|
117
118
|
"If-Range",
|
118
119
|
"If-Unmodified-Since",
|
119
|
-
"
|
120
|
+
"Keep-Alive",
|
120
121
|
"Range",
|
121
122
|
"X-Forwarded-For",
|
122
123
|
"Via",
|
123
124
|
"Transfer-Encoding"
|
124
125
|
};
|
125
|
-
|
126
|
+
|
127
|
+
static int HTTP_HEADER_LEN[H_TRANSFER_ENCODING+1] =
|
128
|
+
{ 6, 14, 15, 15, 13, 10, 12, 14, 6, 7, 4, 6, 7, 10, //user-agent
|
129
|
+
13,17, 8, 13, 8, 19, 10, 5, 15, 3, 17
|
130
|
+
};
|
126
131
|
|
127
132
|
static void lsapi_sigpipe( int sig )
|
128
133
|
{
|
@@ -1139,6 +1144,58 @@ char * LSAPI_GetEnv_r( LSAPI_Request * pReq, const char * name )
|
|
1139
1144
|
return NULL;
|
1140
1145
|
}
|
1141
1146
|
|
1147
|
+
int LSAPI_ForeachOrgHeader_r( LSAPI_Request * pReq,
|
1148
|
+
LSAPI_CB_EnvHandler fn, void * arg )
|
1149
|
+
{
|
1150
|
+
int i;
|
1151
|
+
int len = 0;
|
1152
|
+
char * pValue;
|
1153
|
+
int ret;
|
1154
|
+
int count = 0;
|
1155
|
+
if ( !pReq || !fn )
|
1156
|
+
return -1;
|
1157
|
+
for( i = 0; i < H_TRANSFER_ENCODING; ++i )
|
1158
|
+
{
|
1159
|
+
if ( pReq->m_pHeaderIndex->m_headerOff[i] )
|
1160
|
+
{
|
1161
|
+
len = pReq->m_pHeaderIndex->m_headerLen[i];
|
1162
|
+
pValue = pReq->m_pHttpHeader + pReq->m_pHeaderIndex->m_headerOff[i];
|
1163
|
+
*(pValue + len ) = 0;
|
1164
|
+
ret = (*fn)( HTTP_HEADERS[i], HTTP_HEADER_LEN[i],
|
1165
|
+
pValue, len, arg );
|
1166
|
+
++count;
|
1167
|
+
if ( ret <= 0 )
|
1168
|
+
return ret;
|
1169
|
+
}
|
1170
|
+
}
|
1171
|
+
if ( pReq->m_pHeader->m_cntUnknownHeaders > 0 )
|
1172
|
+
{
|
1173
|
+
char achHeaderName[256];
|
1174
|
+
char *p;
|
1175
|
+
char *pKey;
|
1176
|
+
char *pKeyEnd ;
|
1177
|
+
int keyLen;
|
1178
|
+
struct lsapi_header_offset * pCur, *pEnd;
|
1179
|
+
pCur = pReq->m_pUnknownHeader;
|
1180
|
+
pEnd = pCur + pReq->m_pHeader->m_cntUnknownHeaders;
|
1181
|
+
while( pCur < pEnd )
|
1182
|
+
{
|
1183
|
+
pKey = pReq->m_pHttpHeader + pCur->nameOff;
|
1184
|
+
keyLen = pCur->nameLen;
|
1185
|
+
|
1186
|
+
pValue = pReq->m_pHttpHeader + pCur->valueOff;
|
1187
|
+
*(pValue + pCur->valueLen ) = 0;
|
1188
|
+
ret = (*fn)( pKey, keyLen,
|
1189
|
+
pValue, pCur->valueLen, arg );
|
1190
|
+
if ( ret <= 0 )
|
1191
|
+
return ret;
|
1192
|
+
++pCur;
|
1193
|
+
}
|
1194
|
+
}
|
1195
|
+
return count + pReq->m_pHeader->m_cntUnknownHeaders;
|
1196
|
+
|
1197
|
+
}
|
1198
|
+
|
1142
1199
|
|
1143
1200
|
int LSAPI_ForeachHeader_r( LSAPI_Request * pReq,
|
1144
1201
|
LSAPI_CB_EnvHandler fn, void * arg )
|
@@ -2000,10 +2057,19 @@ void LSAPI_No_Check_ppid()
|
|
2000
2057
|
s_ppid = 0;
|
2001
2058
|
}
|
2002
2059
|
|
2060
|
+
#if defined(macintosh) || defined(__APPLE__) || defined(__APPLE_CC__)
|
2061
|
+
#include <crt_externs.h>
|
2062
|
+
#else
|
2003
2063
|
extern char ** environ;
|
2064
|
+
#endif
|
2004
2065
|
static void unset_lsapi_envs()
|
2005
2066
|
{
|
2006
|
-
char **env
|
2067
|
+
char **env;
|
2068
|
+
#if defined(macintosh) || defined(__APPLE__) || defined(__APPLE_CC__)
|
2069
|
+
env = *_NSGetEnviron();
|
2070
|
+
#else
|
2071
|
+
env = environ;
|
2072
|
+
#endif
|
2007
2073
|
while( env != NULL && *env != NULL )
|
2008
2074
|
{
|
2009
2075
|
if (!strncmp(*env, "LSAPI_", 6) || !strncmp( *env, "PHP_LSAPI_", 10 ) )
|
data/ext/lsapi/lsapilib.h
CHANGED
@@ -146,6 +146,9 @@ char * LSAPI_GetHeader_r( LSAPI_Request * pReq, int headerIndex );
|
|
146
146
|
int LSAPI_ForeachHeader_r( LSAPI_Request * pReq,
|
147
147
|
LSAPI_CB_EnvHandler fn, void * arg );
|
148
148
|
|
149
|
+
int LSAPI_ForeachOrgHeader_r( LSAPI_Request * pReq,
|
150
|
+
LSAPI_CB_EnvHandler fn, void * arg );
|
151
|
+
|
149
152
|
int LSAPI_ForeachEnv_r( LSAPI_Request * pReq,
|
150
153
|
LSAPI_CB_EnvHandler fn, void * arg );
|
151
154
|
|
@@ -242,6 +245,10 @@ static inline char * LSAPI_GetHeader( int headerIndex )
|
|
242
245
|
static inline int LSAPI_ForeachHeader( LSAPI_CB_EnvHandler fn, void * arg )
|
243
246
|
{ return LSAPI_ForeachHeader_r( &g_req, fn, arg ); }
|
244
247
|
|
248
|
+
static inline int LSAPI_ForeachOrgHeader(
|
249
|
+
LSAPI_CB_EnvHandler fn, void * arg )
|
250
|
+
{ return LSAPI_ForeachOrgHeader_r( &g_req, fn, arg ); }
|
251
|
+
|
245
252
|
static inline int LSAPI_ForeachEnv( LSAPI_CB_EnvHandler fn, void * arg )
|
246
253
|
{ return LSAPI_ForeachEnv_r( &g_req, fn, arg ); }
|
247
254
|
|
metadata
CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.4
|
|
3
3
|
specification_version: 1
|
4
4
|
name: ruby-lsapi
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: "
|
7
|
-
date: 2008-01-
|
6
|
+
version: "3.0"
|
7
|
+
date: 2008-01-31 00:00:00 -05:00
|
8
8
|
summary: A ruby extension for fast communication with LiteSpeed Web Server.
|
9
9
|
require_paths:
|
10
10
|
- lib
|