Author
|
Message
|
Domenico Garozzo
|
Thursday 07 July 2011 4:25:17 pm
Hi, i have an article object that have a pdf file as related object. I have added in article full template the code to show the related object. When i click on link ez show me the link to download file. When i click the link the browser return the 206 status. eZ version: Community Project 2011.6 (Community Project 2011.6) php version: 5.2.14 Have you an idea? Thanks. Domenico
|
Tomislav Buljević
|
Friday 08 July 2011 2:36:55 am
Hello Domenico, Just a quick idea: Have you checked the Rules and Policies for the Anonymous users? Do they have the permission to download your files?
|
Steven E. Bailey
|
Friday 08 July 2011 4:10:50 am
206 is partial content... does the status come back instantly or does it take a while? It could be that your max_execution_time is set lower than the time it is taking to send this pdf. How big is the pdf anyway?
Certified eZPublish developer
http://ez.no/certification/verify/396111
Available for ezpublish troubleshooting, hosting and custom extension development: http://www.leidentech.com
|
Domenico Garozzo
|
Friday 08 July 2011 3:35:49 pm
First of all, thank you for your answers. Now the problem is at this link: http://etnaworldtrade.domenicogarozzo.it/Media/Files/Articolo-di-giornale The file is little and the server return error fastly. There is a ez publish log file that can i read? Or a php settings to show warning or error? Thank you. Domenico
|
Steven E. Bailey
|
Saturday 09 July 2011 2:13:24 am
Since it goes so fast I'm guessing the server never gets to the file so it's not a size problem. Your server logs should be where the ErrorLog directive (if there is one) points to in your apache configuration file (or virtual host file) - most of the time it'll be under /var/log/apache2 or /var/log/httpd - but it could be anywhere. For a server problem this is the best place to look - you may have to tweak the error_reporting directive in your php.ini if you see nothing. Also, make sure the file exists, is a (valid) pdf, and is readable by the user running your server. It should be under <ezpublish root>/<VarDir>/storage/original/application. VarDir is the parameter supplied in the site.ini under [FileSettings]. If you have access to the database you can find the hash.pdf that corresponds with the original filename.pdf. The ezpublish logs are under <ezpublish root>/var/log but if it's a server problem there probably won't be any relevant errors. But check anyway.
Certified eZPublish developer
http://ez.no/certification/verify/396111
Available for ezpublish troubleshooting, hosting and custom extension development: http://www.leidentech.com
|
Domenico Garozzo
|
Saturday 09 July 2011 10:51:27 am
In apache log the error is this: [Sat Jul 09 10:37:18 2011] [error] [client 194.28.172.10] malformed header from script. Bad header=; filename=: index.php Very strange.....
|
Steven E. Bailey
|
Sunday 10 July 2011 12:15:07 am
Are your rewrite rules working?
Rewriterule ^/var/storage/.* - [L] Rewriterule ^/var/[^/]+/storage/.* - [L] This should keep a request for a file in <VarDir>/storage from going to index.php To help debug rewrite rule requests (with apache) you can set something like this:
RewriteLog /var/log/apache2/rewrite.log RewriteLogLevel 1 The RewriteLogLevel can be set anywhere from 1 to 9 but it quickly becomes overwhelming so keep the number low... also it slows the server down and can create large log files so you definitely don't want to forget to turn this off. Other questions to ask if the above is not the problem: Is this pdf a valid file? Does this happen with all pdfs/all storage files? Did someone remove application/pdf from your mime.types file (assuming you are using apache)? Is there something custom about your index.php? Did this use to work with a previous version?
Certified eZPublish developer
http://ez.no/certification/verify/396111
Available for ezpublish troubleshooting, hosting and custom extension development: http://www.leidentech.com
|
Douglas Hammond
|
Sunday 10 July 2011 6:40:02 pm
ezPublish has added some cool features to the latest release to support things like seeking position in videos. Unfortuanatley it looks like some bugs were introduced too. IE seems not to be able to download a file suing the new method. Also there is an error with the file name due to operator precedence. I have reported this. take a look at http://issues.ez.no/IssueView.php?Id=18436 I discovered this after upgrading. Downloads were working in firefox but not in IE.
|
Steven E. Bailey
|
Monday 11 July 2011 1:14:06 am
@Douglas - interesting. But, if it turns out to be this, then it's not working with firefox (3.x or 4.x) either... because that's what I tried to use to download the file above: http://etnaworldtrade.domenicogarozzo.it/Media/Files/Articolo-di-giornale
Certified eZPublish developer
http://ez.no/certification/verify/396111
Available for ezpublish troubleshooting, hosting and custom extension development: http://www.leidentech.com
|
Douglas Hammond
|
Monday 11 July 2011 6:12:47 am
I'm using Firefox 5. Not sure if that makes a difference. Either way the two issues as explained are the file name ends up blank because of the string concatenation with a ternary operator(see http://stackoverflow.com/questions/1317383/ternary-operator-and-string-concatenation-quirk for an example), and it always does partial file handling because of the wrong operator used to test if a start position and the file length exist.
|
Domenico Garozzo
|
Monday 11 July 2011 6:49:11 am
"
Are your rewrite rules working?
Rewriterule ^/var/storage/.* - [L] Rewriterule ^/var/[^/]+/storage/.* - [L]
"
Hi Steven, (sorry for the inappropriate. I don't want click the button.) my .htaccess file content is:
DirectoryIndex index.php
RewriteEngine On
RewriteRule ^api/ index_rest.php [L]
RewriteRule ^index_rest\.php - [L]
RewriteRule ^([^/]+/)?content/treemenu.* index_treemenu\.php [L]
RewriteRule ^var/([^/]+/)?storage/images(-versioned)?/.* - [L]
RewriteRule ^var/([^/]+/)?cache/(texttoimage|public)/.* - [L]
RewriteRule ^design/[^/]+/(stylesheets|images|javascript)/.* - [L]
RewriteRule ^share/icons/.* - [L]
RewriteRule ^extension/[^/]+/design/[^/]+/(stylesheets|flash|images|lib|javascripts?)/.* - [L]
RewriteRule ^packages/styles/.+/(stylesheets|images|javascript)/[^/]+/.* - [L]
RewriteRule ^packages/styles/.+/thumbnail/.* - [L] RewriteRule ^var/storage/packages/.* - [L]
RewriteRule ^favicon\.ico - [L] RewriteRule ^design/standard/images/favicon\.ico - [L] RewriteRule ^robots\.txt - [L]
RewriteRule ^w3c/p3p\.xml - [L] RewriteRule .* index\.php
The file is a valid PDF. I can open it with Preview.
|
Steven E. Bailey
|
Monday 11 July 2011 6:57:04 am
@Douglas - Doesn't work for me with firefox5 either - does the file on this page work for you with your version of firefox5? http://etnaworldtrade.domenicogarozzo.it/Media/Files/Articolo-di-giornale
Certified eZPublish developer
http://ez.no/certification/verify/396111
Available for ezpublish troubleshooting, hosting and custom extension development: http://www.leidentech.com
|
Douglas Hammond
|
Monday 11 July 2011 7:12:20 am
Does not work. This looks identical to what I had before I fixed the ezFile class. Did you apply the patch in the issue I listed? Add a line to ezFile just before line 253 $tempString = ( $overrideFilename !== false ) ? "; filename={$overrideFilename}" : ''; Then use xdebug to see what $tempString is. You will find is is something like "; filename=" This is an invalid header. You need to change line 256 to: (( $overrideFilename !== false ) ? "; filename={$overrideFilename}" : '') Note the surrounding () Also on line 260 make it: if ( $startOffset !== 0 ) Or it will always use partial handling as ezfilepassthroughhandler(i thing that was the name) always passes a filesize which will make it use the partial handling.
|
Domenico Garozzo
|
Monday 11 July 2011 3:41:50 pm
"
ezPublish has added some cool features to the latest release to support things like seeking position in videos. Unfortuanatley it looks like some bugs were introduced too. IE seems not to be able to download a file suing the new method. Also there is an error with the file name due to operator precedence. I have reported this. take a look at http://issues.ez.no/IssueView.php?Id=18436 I discovered this after upgrading. Downloads were working in firefox but not in IE.
"
Thank you very much for this solution. Now download go! Thank you very much at everybody for the support. Have a nice day. Domenico
|