0 Replies Latest reply on Jan 9, 2008 8:45 AM by mtenpow10

    Problem with FileReference.upload and response content-length=0

    mtenpow10
      The FileReference.upload implementation in Adobe Flash Player 9,0,28,0 (and perhaps others) on Mac OS X (Safari and Firefox) seems to dislike receiving responses from the server where the Content-Length header is set to 0.

      Specifically, after an upload (using URLRequestMethod.POST) is initiated, the FileReference object dispatches the Event.OPEN event but fails to dispatch any of the following:

      IOErrorEvent.IO_ERROR
      SecurityErrorEvent.SECURITY_ERROR
      Event.COMPLETE
      DataEvent.UPLOAD_COMPLETE_DATA
      HttpStatusEvent.HTTP_STATUS

      The upload DOES succeed and the Flash player is receiving the response, but none of above-mentioned events are dispatched. The bottom line that it is sometimes impossible to tell if/when the upload completes. Is say impossible because the ProgressEvent.PROGESS event IS dispatched if the upload takes "enough" time. But if the upload completes quickly (small file size, low latency, etc), no PROGRESS events are ever dispatched.

      If the response Content-Length header is set to something greater than 0 and there is a response body - OR - if the Content-Length header is omitted altogether THEN events are dispatched.

      My tests show that this does not happen in Windows. I have NOT tried this in other versions of Flash player on Mac, but I care enough about this specific version that "simply upgrade to 9,0,115,0" is not a good enough solution. Additionally, returning some short body is undesirable as well.

      Here is a sample response below:

      RESPONSE=

      HTTP/1.1 200 OK
      Date: Tue, 08 Jan 2008 20:20:54 GMT
      ETag: "20e444d3f88a131685c4f159ebb709d8"
      Location: http://localhost:8888/test/test.txt
      Content-Length: 0

      Has anybody come across this issue before? How, if it all, did you deal with it?

      Thanks!

      /mtp