Browse Source

* fix for OS X not having MSG_NOSIGNAL.

git-svn-id: trunk@13279 -
marco 16 years ago
parent
commit
5f13f1873f
1 changed files with 11 additions and 2 deletions
  1. 11 2
      packages/fcl-web/src/custfcgi.pp

+ 11 - 2
packages/fcl-web/src/custfcgi.pp

@@ -87,6 +87,15 @@ uses
 {$endif}
 {$endif}
   Sockets;
   Sockets;
 
 
+{$undef nosignal}
+
+{$if defined(FreeBSD) or defined(Linux)}
+  {$define nosignal}
+{$ifend}
+
+Const 
+   NoSignalAttr =  {$ifdef nosignal} MSG_NOSIGNAL{$else}0{$endif};
+
 { TFCGIHTTPRequest }
 { TFCGIHTTPRequest }
 
 
 procedure TFCGIRequest.ReadContent;
 procedure TFCGIRequest.ReadContent;
@@ -243,7 +252,7 @@ var BytesToWrite : word;
     BytesWritten  : Integer;
     BytesWritten  : Integer;
 begin
 begin
   BytesToWrite := BEtoN(ARecord^.contentLength) + ARecord^.paddingLength+sizeof(FCGI_Header);
   BytesToWrite := BEtoN(ARecord^.contentLength) + ARecord^.paddingLength+sizeof(FCGI_Header);
-  BytesWritten := sockets.fpsend(TFCGIRequest(Request).Handle, ARecord, BytesToWrite, {$ifdef unix} MSG_NOSIGNAL{$else}0{$endif});
+  BytesWritten := sockets.fpsend(TFCGIRequest(Request).Handle, ARecord, BytesToWrite, NoSignalAttr);
   Assert(BytesWritten=BytesToWrite);
   Assert(BytesWritten=BytesToWrite);
 end;
 end;
 
 
@@ -359,7 +368,7 @@ var Header : FCGI_Header;
    result := False;
    result := False;
     if ByteAmount>0 then
     if ByteAmount>0 then
       begin
       begin
-      BytesRead := sockets.fpRecv(FHandle, ReadBuf, ByteAmount, {$ifdef unix} MSG_NOSIGNAL{$else}0{$endif});
+      BytesRead := sockets.fpRecv(FHandle, ReadBuf, ByteAmount, NoSignalAttr);
       if BytesRead<>ByteAmount then
       if BytesRead<>ByteAmount then
         begin
         begin
 //        SendDebug('FCGIRecord incomplete');
 //        SendDebug('FCGIRecord incomplete');