aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/fastcgi.cpp44
1 files changed, 22 insertions, 22 deletions
diff --git a/src/fastcgi.cpp b/src/fastcgi.cpp
index 58d886d..7d0cf3d 100644
--- a/src/fastcgi.cpp
+++ b/src/fastcgi.cpp
@@ -60,7 +60,7 @@ void Bu::FastCgi::read( Bu::Socket &s, Bu::FastCgi::Record &r )
60 60
61void Bu::FastCgi::write( Bu::Socket &s, Bu::FastCgi::Record r ) 61void Bu::FastCgi::write( Bu::Socket &s, Bu::FastCgi::Record r )
62{ 62{
63 sio << "Out -> " << r << sio.nl; 63// sio << "Out -> " << r << sio.nl;
64 r.uRequestId = htons( r.uRequestId ); 64 r.uRequestId = htons( r.uRequestId );
65 r.uContentLength = htons( r.uContentLength ); 65 r.uContentLength = htons( r.uContentLength );
66 s.write( &r, sizeof(Record) ); 66 s.write( &r, sizeof(Record) );
@@ -138,7 +138,7 @@ Bu::Formatter &Bu::operator<<( Bu::Formatter &f, const Bu::FastCgi::Record &r )
138 138
139void Bu::FastCgi::run() 139void Bu::FastCgi::run()
140{ 140{
141 sio << "sizeof(Bu::FastCgi::Record) = " << sizeof(Record) << sio.nl; 141// sio << "sizeof(Bu::FastCgi::Record) = " << sizeof(Record) << sio.nl;
142 bRunning = true; 142 bRunning = true;
143 while( bRunning ) 143 while( bRunning )
144 { 144 {
@@ -148,7 +148,7 @@ void Bu::FastCgi::run()
148 148
149 Bu::Socket s( iSock ); 149 Bu::Socket s( iSock );
150 s.setBlocking( true ); 150 s.setBlocking( true );
151 sio << "Got connection, blocking? " << s.isBlocking() << sio.nl; 151// sio << "Got connection, blocking? " << s.isBlocking() << sio.nl;
152 try 152 try
153 { 153 {
154 for(;;) 154 for(;;)
@@ -188,15 +188,15 @@ void Bu::FastCgi::run()
188 pChan = aChannel[r.uRequestId-1]; 188 pChan = aChannel[r.uRequestId-1];
189 } 189 }
190 190
191 sio << "Record (id=" << r.uRequestId << ", len=" << 191// sio << "Record (id=" << r.uRequestId << ", len=" <<
192 r.uContentLength << ", pad=" << 192// r.uContentLength << ", pad=" <<
193 (unsigned int)r.uPaddingLength << "): "; 193// (unsigned int)r.uPaddingLength << "): ";
194 fflush( stdout ); 194// fflush( stdout );
195 195
196 switch( (RequestType)r.uType ) 196 switch( (RequestType)r.uType )
197 { 197 {
198 case typeBeginRequest: 198 case typeBeginRequest:
199 sio << "Begin Request."; 199// sio << "Begin Request.";
200 { 200 {
201 BeginRequestBody b; 201 BeginRequestBody b;
202 read( s, b ); 202 read( s, b );
@@ -210,7 +210,7 @@ void Bu::FastCgi::run()
210 break; 210 break;
211 211
212 case typeParams: 212 case typeParams:
213 sio << "Params."; 213// sio << "Params.";
214 if( r.uContentLength == 0 ) 214 if( r.uContentLength == 0 )
215 { 215 {
216 pChan->uFlags |= chflgParamsDone; 216 pChan->uFlags |= chflgParamsDone;
@@ -226,7 +226,7 @@ void Bu::FastCgi::run()
226 break; 226 break;
227 227
228 case typeStdIn: 228 case typeStdIn:
229 sio << "StdIn."; 229// sio << "StdIn.";
230 if( r.uContentLength == 0 ) 230 if( r.uContentLength == 0 )
231 { 231 {
232 pChan->uFlags |= chflgStdInDone; 232 pChan->uFlags |= chflgStdInDone;
@@ -240,8 +240,8 @@ void Bu::FastCgi::run()
240 size_t iRead = s.read( 240 size_t iRead = s.read(
241 buf, r.uContentLength-iTotal ); 241 buf, r.uContentLength-iTotal );
242 iTotal += iRead; 242 iTotal += iRead;
243 sio << " (read " << iRead << " " << iTotal 243// sio << " (read " << iRead << " " << iTotal
244 << "/" << r.uContentLength << ")"; 244// << "/" << r.uContentLength << ")";
245 pChan->sStdIn.append( buf, iRead ); 245 pChan->sStdIn.append( buf, iRead );
246 } while( iTotal < r.uContentLength ); 246 } while( iTotal < r.uContentLength );
247 delete[] buf; 247 delete[] buf;
@@ -249,7 +249,7 @@ void Bu::FastCgi::run()
249 break; 249 break;
250 250
251 case typeData: 251 case typeData:
252 sio << "Data."; 252// sio << "Data.";
253 if( r.uContentLength == 0 ) 253 if( r.uContentLength == 0 )
254 { 254 {
255 pChan->uFlags |= chflgDataDone; 255 pChan->uFlags |= chflgDataDone;
@@ -268,19 +268,19 @@ void Bu::FastCgi::run()
268 case typeEndRequest: 268 case typeEndRequest:
269 case typeAbortRequest: 269 case typeAbortRequest:
270 case typeGetValuesResult: 270 case typeGetValuesResult:
271 sio << "Scary."; 271// sio << "Scary.";
272 // ??? we shouldn't get these. 272 // ??? we shouldn't get these.
273 break; 273 break;
274 274
275 } 275 }
276 276
277 sio << sio.nl; 277// sio << sio.nl;
278 278
279 if( pChan ) 279 if( pChan )
280 { 280 {
281 if( pChan->uFlags == chflgAllDone ) 281 if( pChan->uFlags == chflgAllDone )
282 { 282 {
283 sio << "All done, generating output." << sio.nl; 283// sio << "All done, generating output." << sio.nl;
284 Bu::MemBuf mStdOut, mStdErr; 284 Bu::MemBuf mStdOut, mStdErr;
285 int iRet = onRequest( 285 int iRet = onRequest(
286 pChan->hParams, pChan->sStdIn, 286 pChan->hParams, pChan->sStdIn,
@@ -308,8 +308,8 @@ void Bu::FastCgi::run()
308 write( s, rOut ); 308 write( s, rOut );
309 int iAmnt = s.write( 309 int iAmnt = s.write(
310 sStdOut.getStr()+iPos, iSize ); 310 sStdOut.getStr()+iPos, iSize );
311 sio << "Wrote " << iAmnt << 311// sio << "Wrote " << iAmnt <<
312 " of " << iSize << sio.nl; 312// " of " << iSize << sio.nl;
313 } 313 }
314 } 314 }
315 rOut.uContentLength = 0; 315 rOut.uContentLength = 0;
@@ -328,8 +328,8 @@ void Bu::FastCgi::run()
328 write( s, rOut ); 328 write( s, rOut );
329 int iAmnt = s.write( 329 int iAmnt = s.write(
330 sStdErr.getStr()+iPos, iSize ); 330 sStdErr.getStr()+iPos, iSize );
331 sio << "Wrote " << iAmnt << 331// sio << "Wrote " << iAmnt <<
332 " of " << iSize << sio.nl; 332// " of " << iSize << sio.nl;
333 } 333 }
334 } 334 }
335 rOut.uContentLength = 0; 335 rOut.uContentLength = 0;
@@ -352,8 +352,8 @@ void Bu::FastCgi::run()
352 } 352 }
353 catch( Bu::SocketException &e ) 353 catch( Bu::SocketException &e )
354 { 354 {
355 sio << "Bu::SocketException: " << e.what() << sio.nl << 355// sio << "Bu::SocketException: " << e.what() << sio.nl <<
356 "\tSocket open: " << s.isOpen() << sio.nl; 356// "\tSocket open: " << s.isOpen() << sio.nl;
357 } 357 }
358 } 358 }
359} 359}