safari terminates the session after use html5 audio

543 views Asked by At

I am trying to play *.wav with html5 audio. client side js looks like

<script>    
    document.getElementById("player").src = "/moh/play/?track_id=1";
    document.getElementById("player").play();
</script>

Server side php+Zend 1.8 looks like

public function responceWav(MyNameSpace_Model_Track $model_track)
    {
        $this->getResponse()->setHeader("Content-Length", @filesize($model_track->getWAVPath()))
            ->setHeader("Connection", "Keep-Alive")
            ->setHeader("Content-Disposition", "attachment; filename=\"" . $model_track->getFileName() . "\".wav")
            ->setHeader("ETag", md5($model_track->getWAVPath() . time()))
            ->setHeader("Content-Type", "audio/x-wav");

        @readfile($model_track->getWAVPath());

        $this->view->layout()->disableLayout();
        $this->_helper->viewRenderer->setNoRender(true);

    }

In FF it work pretty nice, but in Safari 6.0.1 when I try to get track, the session (by cookies) is terminates. dump by wireshark:

1 request by safari

GET /moh/play/?track_id=1 HTTP/1.1
Host: domain.com
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_2) AppleWebKit/536.26.14 (KHTML, like Gecko) Version/6.0.1 Safari/536.26.14
Accept: */*
Range: bytes=0-1
Accept-Encoding: identity
Referer: http://domain.com/
X-Playback-Session-Id: E8F45DB5-D018-4088-8BD3-9077ECE23F31
Cookie: PHPSESSID=d0hl91519jfm2jopklbdcsre14
Connection: keep-alive

HTTP/1.1 200 OK
Date: Thu, 11 Oct 2012 08:31:14 GMT
Server: Apache/2.2.15 (CentOS)
X-Powered-By: PHP/5.3.3
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
Set-Cookie: PHPSESSID=aksnmpn4vquid961jp5rbthrk6; expires=Thu, 11-Oct-2012 09:01:14 GMT; path=/
Content-Length: 4118616
Connection: Keep-Alive, close
Content-Disposition: attachment; filename="cbde895a22ad1824b700f7118263bc08".wav
Etag: e1e7c9fad8c9a607ecdd5c045d5fd0bd
Content-Type: audio/x-wav

2nd request by AppleCoreMedia

GET /moh/play/?track_id=1 HTTP/1.1
Host: domain.com
User-Agent: AppleCoreMedia/1.0.0.12C54 (Macintosh; U; Intel Mac OS X 10_8_2; ru_ru)
Accept: */*
Range: bytes=0-1
Accept-Encoding: identity
Cookie: PHPSESSID=aksnmpn4vquid961jp5rbthrk6
Connection: keep-alive

HTTP/1.1 200 OK
Date: Thu, 11 Oct 2012 08:31:14 GMT
Server: Apache/2.2.15 (CentOS)
X-Powered-By: PHP/5.3.3
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
Set-Cookie: PHPSESSID=ec0fi4r90349h5icbaq4h4km64; expires=Thu, 11-Oct-2012 09:01:14 GMT; path=/
Content-Length: 4118616
Connection: Keep-Alive, close
Content-Disposition: attachment; filename="cbde895a22ad1824b700f7118263bc08".wav
Etag: e1e7c9fad8c9a607ecdd5c045d5fd0bd
Content-Type: audio/x-wav

3rd request by QuickTime plugin

GET /moh/play/?track_id=1 HTTP/1.1
Host: domain.com
User-Agent: QuickTime/7.7.1 (qtver=7.7.1;cpu=IA32;os=Mac 10.8.2)
Accept: */*
Cookie:  PHPSESSID=ec0fi4r90349h5icbaq4h4km64;
Connection: close

HTTP/1.1 200 OK
Date: Thu, 11 Oct 2012 08:31:14 GMT
Server: Apache/2.2.15 (CentOS)
X-Powered-By: PHP/5.3.3
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
Set-Cookie: PHPSESSID=c7iu5ehbp852q0oi2m7evgjea3; expires=Thu, 11-Oct-2012 09:01:15 GMT; path=/
Content-Length: 4118616
Connection: Keep-Alive, close
Content-Disposition: attachment; filename="cbde895a22ad1824b700f7118263bc08".wav
Etag: a16b449dade53093415ac609dc5be199
Content-Type: audio/x-wav

4th request by Safari (hi login screen)

POST /user/index HTTP/1.1
Host: domain.com
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_2) AppleWebKit/536.26.14 (KHTML, like Gecko) Version/6.0.1 Safari/536.26.14
Content-Length: 0
Accept: application/json, text/javascript, */*; q=0.01
Origin: http://domain.com
X-Requested-With: XMLHttpRequest
Referer: http://domain.com/
Accept-Language: ru
Accept-Encoding: gzip, deflate
Cookie: PHPSESSID=ec0fi4r90349h5icbaq4h4km64
Connection: keep-alive

HTTP/1.1 200 OK
Date: Thu, 11 Oct 2012 08:31:42 GMT
Server: Apache/2.2.15 (CentOS)
X-Powered-By: PHP/5.3.3
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
Content-Length: 2040
Connection: close
Content-Type: text/html; charset=UTF-8

I do not understand what could be the problem.

0

There are 0 answers