jeudi 5 mars 2015

How does Keep-Alive change my behaver - or must I set cache to 0?


Vote count:

0




I have made a simple HTML5 Builder project (HTML5 Builder XE5). 2 buttons, one to download a PDF and one to change the Label. When I click on the label-changing button it works find. After that I click on the Download PDF Button it works fine also. But now: WHen I do a click on the label changing button after that the PDF FIle is downloaded again. No Label is changed. As I can see in the Fiddler Protocol the transaction is done be resending the same information. My Keep-Alive header is on: the complete request/response headers are:



POST /bug/unit1.php HTTP/1.1
Host: localhost
Connection: keep-alive
Content-Length: 86
Cache-Control: max-age=0
Accept: text/html,application/xhtml+xml,application
/xml;q=0.9,image /webp,*/*;q=0.8
Origin: http://localhost
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36
(KHTML, like Gecko) Chrome/41.0.2272.76 Safari/537.36
Content-Type: application/x-www-form-urlencoded
Referer: http://localhost/bug/unit1.php
Accept-Encoding: gzip, deflate
Accept-Language: de-DE,de;q=0.8,en-US;q=0.6,en;q=0.4
Cookie: PHPSESSID=5i7jkm5siua4s1jrs6bthc93d1


the response is:



HTTP/1.1 200 OK
Date: Thu, 05 Mar 2015 09:29:28 GMT
Server: Apache/2.2.21 (Win32) mod_ssl/2.2.21 OpenSSL/1.0.0e PHP/5.3.8 mod_perl/2.0.4 Perl/v5.10.1
X-Powered-By: PHP/5.3.8
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-Disposition: attachment;filename='downloaded.pdf'
Keep-Alive: timeout=5, max=97
Connection: Keep-Alive
Transfer-Encoding: chunked
Content-Type: application/pdf


For the first PDF Click the response is correct. It sends the PDF for download. When I click the Label changing button at start up the request/response headers are following. An at startup it works fine.


request headers for label changing:



POST http://localhost/bug/unit1.php HTTP/1.1
Host: localhost
Connection: keep-alive
Content-Length: 86
Cache-Control: max-age=0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
Origin: http://localhost
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2272.76 Safari/537.36
Content-Type: application/x-www-form-urlencoded
Referer: http://localhost/bug/unit1.php
Accept-Encoding: gzip, deflate
Accept-Language: de-DE,de;q=0.8,en-US;q=0.6,en;q=0.4
Cookie: PHPSESSID=5i7jkm5siua4s1jrs6bthc93d1


response headers from label changing



HTTP/1.1 200 OK
Date: Thu, 05 Mar 2015 09:29:24 GMT
Server: Apache/2.2.21 (Win32) mod_ssl/2.2.21 OpenSSL/1.0.0e PHP/5.3.8 mod_perl/2.0.4 Perl/v5.10.1
X-Powered-By: PHP/5.3.8
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: 1347
Keep-Alive: timeout=5, max=99
Connection: Keep-Alive
Content-Type: text/html


How can I enforce that the click on Label-Changing butten after clicking the PDF-Download Button will work again?


I did realize the function call for downloading by changing the headers: like so:



//Class definition
class Page1 extends Page
{
public $Label1 = null;
public $Button2 = null;
public $Button1 = null;
function Button2Click($sender, $params)
{
$this->Label1->Caption = " Hello world";
}
function Button1Click($sender, $params)
{
header("Content-type:application/pdf");

// It will be called downloaded.pdf
header("Content-Disposition:attachment;filename='downloaded.pdf'");

// The PDF source is in original.pdf
readfile("original.pdf");
flush ();
}
}


asked 33 secs ago







How does Keep-Alive change my behaver - or must I set cache to 0?

Aucun commentaire:

Enregistrer un commentaire