View Single Post

  #1 (permalink)  
Old 06-26-2003
Daniel Griscom
 
Posts: n/a
Default Flash-Apache conflict: error 416?

I'm developing a Macromedia Flash-based product which runs on a Pocket
PC (a Dell Axim X5). At one point in the startup procedure, the product
loads a new Flash file from an Apache server (2.0.44 running on OS X
10.2.6). Problem: the load fails every other time time with a 416
response code ("Requested Range Not Satisfiable").

Using Ethereral (cool program!) on the server, I grabbed the relevant
packets. First, a successful transaction. Flash's request:

> GET /flash/main.swf HTTP/1.1\r\n
> Referer: http://server/flash/main.swf\r\n
> User-Agent: Shockwave Flash\r\n
> Host: server\r\n
> \r\n


Apache's response:

> HTTP/1.1 200 OK\r\n
> Date: Thu, 26 Jun 2003 02:34:44 GMT\r\n
> Server: Apache/2.0.44 (Unix) DAV/2 PHP/4.3.1\r\n
> Last-Modified: Mon, 23 Jun 2003 13:51:51 GMT\r\n
> ETag: "11f8ea-b94-c6c42bc0"\r\n
> Accept-Ranges: bytes\r\n
> Content-Length: 2964\r\n
> Content-Type: application/x-shockwave-flash\r\n
> \r\n


Now, a failed transaction. Flash's request:

> GET /flash/main.swf HTTP/1.1\r\n
> Referer: http://server/flash/main.swf\r\n
> Range: bytes=2964-\r\n
> Unless-Modified-Since: Mon, 23 Jun 2003 13:51:51 GMT\r\n
> If-Range: "11f8ea-b94-c6c42bc0"\r\n
> User-Agent: Shockwave Flash\r\n
> Host: server\r\n
> \r\n


Apache's response:

> HTTP/1.1 416 Requested Range Not Satisfiable\r\n
> Date: Thu, 26 Jun 2003 02:35:19 GMT\r\n
> Server: Apache/2.0.44 (Unix) DAV/2 PHP/4.3.1\r\n
> Transfer-Encoding: chunked\r\n
> Content-Type: text/html; charset=iso-8859-1\r\n
> \r\n
> Data (414 bytes)


(Note that this is on an isolated network, with "server" hardwired to
the server's IP address.)

I'm on the hairy edge of my expertise, but it seems that the Flash
program is requesting bytes 2964 and on of a 2964-byte file, and Apache
is objecting because the final byte number is 2963. Watching the log,
the failures and successes exactly alternate. What I'd like is for Flash
to request the file, and Apache to respond with (I think) a code 304
("Use your Cached Copy, Dude").

To keep the code 416 from happening, it seems I either have to persuade
Flash to stop getting funky with its request, or persuade Apache to be
more tolerant. Using the first approach, I added a "?randomVar=XXXXX"
suffix to each request to make Flash see each fetch as a new item. This
worked, except that Flash dutifully started caching all these
"different" files, ending with megabytes of useless cached files, which
is a memory and performance problem on a poor little palmtop. So, now
I'm stumped.


Any ideas?


Many thanks,
Dan

--
Daniel T. Griscom Work: (781) 665-0053
Suitable Systems Fax: (781) 665-7106
152 Cochrane Street griscom@suitable.com
Melrose, MA 02176-1433 http://www.suitable.com/