aldrinbaroi / mediawiki-page-attachment

Automatically exported from code.google.com/p/mediawiki-page-attachment
Other
1 stars 1 forks source link

Attaching files works but downloading attachments come accross as 0 bytes. #62

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Install MediaWiki 1.18.0, PHP 5.3.3 (apache2handler) and MySQL 5.1.61 on a 
CentOS 6.2 box.
2. Install PageAttachment 2.1.0
3. Upload a file to any normal page.
4. Verify file is attached and shows a non-zero size
5. Download file attachment that was just uploaded.  Note that size of file is 
0 bytes.

What is the expected output? What do you see instead?
Expected output is "real" file size, not a 0-byte file.

What version of the product are you using? On what operating system?

  PageAttachment version  : 2.1.0
  MediaWiki version       : 1.18.0
  PHP version             : PHP 5.3.3 (apache2handler)
  Operating System name   : CentOS
  Operating System version: CentOS release 6.3 (Final) / 2.6.32-220.23.1.el6.x86_64

Please provide any additional information below.

I do have https enabled for the entire site.  To date this has never caused any 
problems and I doubt it's the cause of the problem now--but providing the info 
just in case it is relevant.

Everything seems to work just fine except that attachements, once 
viewed/downloaded, are 0 bytes in length.

TIA,

Sean.

Original issue reported on code.google.com by sean.noo...@gmail.com on 7 Sep 2012 at 4:27

GoogleCodeExporter commented 9 years ago
Hi Sean:

Is this happening in all browsers or in a specific browser?  If this is 
happening is a specific browser then would you please share the browser name & 
version number?

Sincerely yours,

Aldrin

Original comment by Aldrin.Baroi@gmail.com on 8 Sep 2012 at 6:42

GoogleCodeExporter commented 9 years ago
Hi Aldrin,

It is not browser-specific; same problem with Firefox, IE and Chrome.  What's 
weird is that the "attachment section" of the page shows the correct file 
sizes.  Any idea on how to troubleshoot?  I'd be glad to provide you with 
access to the box.

TIA,

Sean.

Original comment by sean.noo...@gmail.com on 9 Sep 2012 at 4:47

GoogleCodeExporter commented 9 years ago
Getting closer.  Found this (sanitized) in ssl_error_log:

[Sun Sep 09 10:42:42 2012] [error] [client 1.2.3.4] PHP Warning:  Missing 
argument 1 for 
PageAttachment\\Security\\SecurityManager::isAttachmentDownloadAllowed(), 
called in 
/var/www/html/wiki/extensions/PageAttachment/download/DownloadManager.php on 
line 53 and defined in 
/var/www/html/wiki/extensions/PageAttachment/security/SecurityManager.php on 
line 504, referer: https://<WIKI_FQDN>/wiki/index.php/Main_Page
[Sun Sep 09 10:42:42 2012] [error] [client 1.2.3.4] PHP Notice:  Undefined 
variable: protectedPage in 
/var/www/html/wiki/extensions/PageAttachment/security/SecurityManager.php on 
line 506, referer: https://<WIKI_FQDN>/wiki/index.php/Main_Page
[Sun Sep 09 10:42:42 2012] [error] [client 1.2.3.4] PHP Notice:  Undefined 
variable: protectedPage in 
/var/www/html/wiki/extensions/PageAttachment/security/SecurityManager.php on 
line 510, referer: https://<WIKI_FQDN>/wiki/index.php/Main_Page
[Sun Sep 09 10:42:42 2012] [error] [client 1.2.3.4] PHP Warning:  
fopen(https://<WIKI_FQDN>/wiki/images/e/ef/my_test_file.txt): failed to open 
stream: HTTP request failed! HTTP/1.1 401 Authorization Required\r\n in 
/var/www/html/wiki/extensions/PageAttachment/download/FileStreamer.php on line 
58, referer: https://<WIKI_FQDN>/wiki/index.php/Main_Page
[Sun Sep 09 10:42:42 2012] [error] [client 1.2.3.4] PHP Warning:  fpassthru() 
expects parameter 1 to be resource, boolean given in 
/var/www/html/wiki/extensions/PageAttachment/download/FileStreamer.php on line 
59, referer: https://<WIKI_FQDN>/wiki/index.php/Main_Page

Do I need to define a variable somewhere?

TIA,

Sean.

Original comment by sean.noo...@gmail.com on 9 Sep 2012 at 5:54

GoogleCodeExporter commented 9 years ago
Hi Sean:

The error log helped.  Checked the code and it is coding issue.  Give me couple 
days to upload the fixed version.

Sincerely yours,

Aldrin

Original comment by Aldrin.Baroi@gmail.com on 10 Sep 2012 at 3:01

GoogleCodeExporter commented 9 years ago

Original comment by Aldrin.Baroi@gmail.com on 10 Sep 2012 at 3:01

GoogleCodeExporter commented 9 years ago

Original comment by Aldrin.Baroi@gmail.com on 10 Sep 2012 at 3:02

GoogleCodeExporter commented 9 years ago
Thanks Aldrin, really looking forward to using this!

Sean.

Original comment by sean.noo...@gmail.com on 10 Sep 2012 at 3:54

GoogleCodeExporter commented 9 years ago

Original comment by Aldrin.Baroi@gmail.com on 17 Sep 2012 at 8:33

GoogleCodeExporter commented 9 years ago
Fixed.

Restarted testing.  see Issue 56

Original comment by Aldrin.Baroi@gmail.com on 17 Sep 2012 at 8:34

GoogleCodeExporter commented 9 years ago
Updated status tag.

Original comment by Aldrin.Baroi@gmail.com on 17 Sep 2012 at 8:35

GoogleCodeExporter commented 9 years ago
this is hapening again with 3.1.0

Original comment by radzivi...@gmail.com on 10 Feb 2013 at 3:45

GoogleCodeExporter commented 9 years ago
freebsd 9.1 amd64
php 5.4
mediawiki 1.20.2
PageAttachment 3.1.0

<br />
Warning:  fopen(https://ssl.storm.adminim.in.ua/images/0/03/Awb.doc): failed to 
open stream: HTTP request failed! HTTP/1.1 401 Authorization Required
 in /usr/home/storm/www/htdata/mediawiki/extensions/PageAttachment/download/FileStreamer.php on line 58<br />
<br />
Warning:  fpassthru() expects parameter 1 to be resource, boolean given in 
/usr/home/storm/www/htdata/mediawiki/extensions/PageAttachment/download/FileStre
amer.php on line 59<br />

Original comment by radzivi...@gmail.com on 10 Feb 2013 at 4:49

GoogleCodeExporter commented 9 years ago
Hi radzivilov:

Based on the error message, looks like it is failing either because URL open is 
not enabled or, HTTP Digest Authentication is enabled.

Would you please do the following and share the results:

Test 1) Enabled "allow_url_fopen" in "php.ini" if it is not enabled and test

Test 2) Disable (temporarily) HTTP Basic and Digest Access Authentication in
        your Web Server if it is enabled and test to see if downloads work?

Please, let me know.

Sincerely yours,

Aldrin

Original comment by Aldrin.Baroi@gmail.com on 10 Feb 2013 at 6:19

GoogleCodeExporter commented 9 years ago
Hello,

Thanks a lot.
Disabled basic auth in apache. No errors in logs, and i am able to download
attached file now. Great !
But each download takes over 15 seconds (even if files are very small,
looks like some stuck). Is it expected to be so ?

Original comment by radzivi...@gmail.com on 10 Feb 2013 at 6:17

GoogleCodeExporter commented 9 years ago
Hi radzivilov:

Thank for testing and confirming the issue.  I have tried using solutions 
provide on "php.net" site at the following link to no avail.  

   http://php.net/manual/en/function.stream-context-create.php

I'll try to figure out how to make the download work when "Basic" or "Digest" 
authentication is enabled in the Web Server.

Now, question on download time: no, it should not take that long; something 
causing that delay; cannot think of anything from the top of my head.  You 
could try turning on MediaWiki profiling and see where the bottleneck is and 
share the info with me and I'll give it a shot to resolve it.

Sincerely yours,

Aldrin

Original comment by Aldrin.Baroi@gmail.com on 11 Feb 2013 at 7:44

GoogleCodeExporter commented 9 years ago
Hi radzivilov:

Looks like got it working with Basic Auth, not sure if the same code would work 
with Digest Auth, need to test it.

Also, looks like may have to update the code for new "Swift" file back-end 
introduced in MediaWiki version 1.19.  Need to check this too.

I have already checked in the code in 3.2.0 branch.  You could either check out 
the code from the repository or I can upload an alpha release for you to 
download.  Let me know.  In either case, help with testing would be much 
appreciated.

Sincerely yours,

Aldrin

Original comment by Aldrin.Baroi@gmail.com on 12 Feb 2013 at 10:15

GoogleCodeExporter commented 9 years ago
Hello,

I can test it with mediawiki 1.19 and 1.20 also with different php versions.
But i have not found any information about your rerository.
http://code.google.com/p/mediawiki-page-attachment/source/checkout
looks like 3.1.0
extension.version.major=3
extension.version.minor=1
extension.version.patch=0
extension.version.alpha=
extension.version.beta=

Please give me some info about your repository or about alpha release.

Thanks a lot.

Original comment by radzivi...@gmail.com on 13 Feb 2013 at 8:25

GoogleCodeExporter commented 9 years ago
Hi radzivilov:

Please, use v3.2.0 branch.

By the way, project is an Eclipse project and there is an "ant" script to 
create the release package. Use "distribute" target to create the zip file.

Let me know if you have any other questions.

Sincerely yours,

Aldrin

Original comment by Aldrin.Baroi@gmail.com on 14 Feb 2013 at 12:36

GoogleCodeExporter commented 9 years ago
In favor of new code (See issue# 75) being developed to support multiple file 
repositories, will not fix this code and will remove it in next release. The 
new code is more or less working and do not require and additional check for 
security settings.

Original comment by Aldrin.Baroi@gmail.com on 14 Aug 2013 at 8:23