Forum


Replies: 3   Views: 3465
Createdocxanddownload timeout
Topic closed:
Please note this is an old forum thread. Information in this post may be out-to-date and/or erroneous.
Every phpdocx version includes new features and improvements. Previously unsupported features may have been added to newer releases, or past issues may have been corrected.
We encourage you to download the current phpdocx version and check the Documentation available.

Posted by mikestp27  · 01-02-2013 - 06:03

Hello,
My code was working fine with 2.7-PRO but I just found an issue with 3.1 - PRO. It could have been there in 3.0, I did not check. When using createDocxAndDownload, it takes 15-20 seconds more than before to "download" the file. The temp was was created as fast as before. The code itself completes in the same time as before. The issue seems with the download itself. The browser doesn't appear to know how big the file is and waits and waits for more bytes to come in until it times out. Tested with chrome, safari, firefox and IE and even the low-level wget. Same issue always. My test file is 23KB and looking at the browser download page I can see "downloaded 23KB of ? KB...". I looked at the content-length and it seems to be there but something is wrong for sure.
Thank you,
Mike

Posted by admin  · 11-04-2013 - 12:13

Hello,

Please check this post:

http://www.phpdocx.com/help/forum?vasthtmlaction=viewtopic&t=2862.00

A quick test is to change lines 4342 to 4351, setting new headers or adding new ones as your server need. Please paste your solution, we try to get a common solution but it really depends on your server.

Regards.

Posted by mikestp27  · 11-04-2013 - 12:13

Hello,
I found the problem.
The problem is that createDocxAndDownload sends a Content-Length header and my server is set to gzip those files and send them in chunked Tranfer-Encoding. Both cannot be used together: http://stackoverflow.com/questions/2419281/content-length-header-versus-chunked-encoding

Actually, I found a few solutions...
1. remove the Content-Length header from createDocxAndDownload
2. use createDocx and implement my own download (just a few lines of code)
3. disable gzip for those files

I tried all 3 solution and they all work.
I'll use #2 in my code.

Thanks,
Mike.