The method below was posted to this list earlier this year as a fix for problems in the ITK Shell where large requests would result in 400 Bad Request errors. Facing these 400 errors, I've installed this method and am still seeing them on a "larger" requests. For example in testing it is failing on a request whose content length is 21242 (not really that big). I'm trying to figure out why this is failing. What I've done is capture the full request and write it to file in A4D_PreStreamExecuteHook. Then I write the content of $data after the call to ITK_TCPRecvBlob in the method below. What I am finding is that with this test request, the contents of $data is only written once and it is the last chunk of the request. In other words the first part of the request never appears to be processed, which I why I think I'm still getting 400 errors. I also note that when tracing this method with the same data $receivingHeader always evaluates to TRUE. I wouldn't think that it should?

-- Brad Perkins

`METHOD: A4D_ITK_ReceiveCallback(
`                      inStream: Longint;
`                      inStopString: Str255;
`                      inMaxLen: Longint;
`                      inTimeout: Longint) -> BLOB


`Part of Active4D, the ultimate 4D web environment `Copyright � Aparajita Fishman, All Rights Reserved


`v4.0.0 build 2 2005-01-22 ` `30-Mar-2005, bdp, Installed into A4D 3.0 ITK Shell


C_LONGINT($1;$inStream;$3;$inMaxLen;$4;$inTimeout) C_STRING(255;$2;$inStopString) C_BLOB($0) $inStream:=$1 $inStopString:=$2 $inMaxLen:=$3 $inTimeout:=$4


C_LONGINT($result) C_BLOB($data) C_BOOLEAN($receivingHeader) $receivingHeader:=(Length($inStopString)>0)


While ($inMaxLen>0)
`Receive up to $inMaxLen bytes, don't release the stream when done, append to $da
$result:=ITK_TCPRecvBlob ($inStream;$data;$inMaxLen;0;3;$inStopString;$inTimeout)


Case of
  : ($result<0)
    SET BLOB SIZE($0;0)
    LONGINT TO BLOB(0;$0;Macintosh byte ordering )
      : ($result=0) | ($receivingHeader)
    $inMaxLen:=0
      Else
    $inMaxLen:=$inMaxLen-$result
End case
End while

$0:=$data
SET BLOB SIZE($data;0)

----------------------------------------------
Is this the right method?
Is this code dependent on other shell changes that I probably don't have?
_______________________________________________
Active4D-dev mailing list
[email protected]
http://mailman.aparajitaworld.com/mailman/listinfo/active4d-dev
Archives: http://mailman.aparajitaworld.com/archive/active4d-dev/

Reply via email to