Java problem and my Fix

Bruce M Krawetz (bmk@wdl.lmco.com)
Wed, 2 Oct 1996 10:44:25 -0700

Date: Wed, 2 Oct 1996 10:44:25 -0700
From: bmk@wdl.lmco.com (Bruce M Krawetz)
Message-Id: <199610021744.KAA12035@box.wdl.lmco.com>
To: fastcgi-developers@openmarket.com
Subject: Java problem and my Fix


Hello everybody.  (yes, i just joined)

I was having problems with my FCGI Java scripts:  It was giving me at
most one response, then dying.  (Looking at the mail arcives, I see one
other having a similar problem, but no fixes).  After fiddling with
"FCGIInputStream.java" and "FCGIMessage.java",  I got thing working.  I
hope i done good.

BTW, this is base on the 1.5 kit, and runs on a Sparc with Solaris2.4




===============================
diff -c FCGIInputStream.javaX FCGIInputStream.java
*** FCGIInputStream.javaX       Tue Sep 17 18:37:05 1996
--- FCGIInputStream.java        Tue Sep 17 18:37:52 1996
***************
*** 177,183 ****
                        setException(e);
                        return;
                        }
!               if (count == 0) {
                        setFCGIError(FCGIGlobalDefs.def_FCGIProtocolError);
                        return;
                        }
--- 177,184 ----
                        setException(e);
                        return;
                        }
!               //if (count == 0) {     //} HACK OUT 
!               if (count <= 0) {               // HACK IN
                        setFCGIError(FCGIGlobalDefs.def_FCGIProtocolError);
                        return;
                        }
***************
*** 381,384 ****
                return stop - rdNext + in.available();
        }
         
! }
\ No newline at end of file
--- 382,385 ----
                return stop - rdNext + in.available();
        }
         
! }






==================================
diff -c FCGIMessage.javaX FCGIMessage.java
*** FCGIMessage.javaX   Tue Sep 17 13:44:43 1996
--- FCGIMessage.java    Tue Sep 17 14:10:55 1996
***************
*** 106,118 ****
  
             h_version                  = (int)hdrBuf[0] & 0x000000ff;
             h_type                     = (int)hdrBuf[1] & 0x000000ff;
!            h_requestID                =  (hdrBuf[2] << 8) + hdrBuf[3]; 
             if ((hdrBuf[3] & 0x80) != 0  && (hdrBuf[2] & 0xff) == 0){
                        h_requestID = h_requestID & 0x000000ff;
             } else {
                        h_requestID = h_requestID & 0x0000ffff;
                        }
!            h_contentLength            =  (hdrBuf[4] << 8) + hdrBuf[5];
             if ((hdrBuf[5] & 0x80) != 0  && (hdrBuf[4] & 0xff) == 0){
                        h_contentLength = h_contentLength & 0x000000ff;
             } else {
--- 106,120 ----
  
             h_version                  = (int)hdrBuf[0] & 0x000000ff;
             h_type                     = (int)hdrBuf[1] & 0x000000ff;
!            //h_requestID              =  (hdrBuf[2] << 8) + hdrBuf[3]; 
!            h_requestID                =  ((int)(hdrBuf[2]) << 8) + ((int)(hdrBuf[3]) & 0x000000ff); 
             if ((hdrBuf[3] & 0x80) != 0  && (hdrBuf[2] & 0xff) == 0){
                        h_requestID = h_requestID & 0x000000ff;
             } else {
                        h_requestID = h_requestID & 0x0000ffff;
                        }
!            //h_contentLength          =  (hdrBuf[4] << 8) + hdrBuf[5];
!            h_contentLength            =  ((int)(hdrBuf[4]) << 8) + ((int)(hdrBuf[5]) & 0x000000ff);
             if ((hdrBuf[5] & 0x80) != 0  && (hdrBuf[4] & 0xff) == 0){
                        h_contentLength = h_contentLength & 0x000000ff;
             } else {
***************
*** 424,427 ****
  
  
  
!  } //end class
\ No newline at end of file
--- 426,429 ----
  
  
  
!  } //end class