• Resolved dfumagalli

    (@dfumagalli)


    Hello,

    after the last update my website is sending zero length files.
    Since they are free, I thought it was a problem with the
    “Easy Digital Downloads – Free Download” so I disabled it.
    But even then, the files still get sent as zero length.

    This link shows the issue. It’s the same file I am sending since months without a change and it has worked till the last patch.

    Besides the Free Download, the only other EDD plugin I have installed is Easy Digital Downloads – Software Specs.

    Before you ask: I can’t set to redirect as the downloads come from outside of the web root. It always worked though both with another download manager and yours.

    http://wordpress.org/plugins/easy-digital-downloads/

Viewing 15 replies - 1 through 15 (of 30 total)
  • Plugin Contributor Pippin Williamson

    (@mordauk)

    Where are the files stored?

    Plugin Contributor Pippin Williamson

    (@mordauk)

    Oh and how large are they?

    Post your Downloads > System Info for me as well.

    Thread Starter dfumagalli

    (@dfumagalli)

    File is just about 500k in size and is stored in

    /home4/host_user_name/downloads/vahrokh/public/applications/eve-online/income_analyzer/setup.exe

    The website is in a subdirectory:
    Multisite: No

    SITE_URL: http://www.vahrokh.com/vahrokh
    HOME_URL: http://www.vahrokh.com

    EDD Version: 1.7.2
    Upgraded From: 1.7.2
    WordPress Version: 3.6
    Permalink Structure: /%year%/%monthnum%/%postname%/

    ————-

    Is there a way for me to send you such information in a private way? I am afraid sharing all my configurations to potential hackers.

    Thread Starter dfumagalli

    (@dfumagalli)

    Some more info:

    Multisite: No

    SITE_URL: http://www.vahrokh.com/vahrokh
    HOME_URL: http://www.vahrokh.com

    EDD Version: 1.7.2
    Upgraded From: 1.7.2
    WordPress Version: 3.6
    Permalink Structure: /%year%/%monthnum%/%postname%/

    Active Theme: Atahualpa 3.7.12

    Test Mode Enabled: No
    Ajax Enabled: Yes
    Guest Checkout Enabled: Yes
    Symlinks Enabled: No

    Checkout is: Valid
    Checkout Page: http://www.vahrokh.com/checkout/
    Success Page: http://www.vahrokh.com/purchase-confirmation/
    Failure Page: http://www.vahrokh.com/checkout/transaction-failed/
    Downloads slug: /downloads

    Taxes Enabled: No
    Taxes After Discounts: No

    Registered Post Stati: publish, future, draft, pending, private, trash, auto-draft, inherit, refunded, failed, revoked, abandoned, active, inactive

    Platform: Windows
    Browser Name: Firefox
    Browser Version: 23.0
    User Agent String: Mozilla/5.0 (Windows NT 6.1; WOW
    64; rv:23.0) Gecko/20100101 Fire
    fox/23.0

    PHP Version: 5.4.17
    MySQL Version: 5.5.33-log
    Web Server Info: Apache

    PHP Safe Mode: No
    PHP Memory Limit: 256M
    PHP Upload Max Size: 10M
    PHP Post Max Size: 10M
    PHP Upload Max Filesize: 10M
    PHP Time Limit: 0
    PHP Max Input Vars: 1000

    WP_DEBUG: Disabled

    WP Table Prefix: Length: 3 Status: Acceptable

    Show On Front: posts
    Page On Front: (#0)
    Page For Posts: (#0)

    WP Remote Post: wp_remote_post() works

    Session: Disabled
    Session Name: PHPSESSID
    Cookie Path: /
    Save Path: /tmp
    Use Cookies: On
    Use Only Cookies: On

    WordPress Memory Limit: 128MB
    DISPLAY ERRORS: N/A
    FSOCKOPEN: Your server supports fsockopen.
    cURL: Your server supports cURL.
    SOAP Client: Your server has the SOAP Client enabled.
    SUHOSIN: Your server does not have SUHOSIN installed.

    TEMPLATES:

    Plugin Contributor Pippin Williamson

    (@mordauk)

    Do a quick test for me and place the file in wp-content/uploads/edd/2013/09

    Does that make it work?

    Thread Starter dfumagalli

    (@dfumagalli)

    – Do I have to change the download URL in the download page, from /home4/blah blah or do I just copy the file in such directory with no other action?

    – Am I meant to switch to “redirect mode” to do this test?

    Plugin Contributor Pippin Williamson

    (@mordauk)

    Yes, you have to change it in the product config.

    No, leave the Download Method on “Forced”.

    Thread Starter dfumagalli

    (@dfumagalli)

    Ok I have copied setup.exe to the directory you indicated and updated the download page.

    It let me download the file at once with no 404 errors or anything, everything went smooth at first try…

    … but now I get more zero length setup.exe saved on disk.

    By the way I am on another computer now, so it’s not my home PC at fault.

    Thread Starter dfumagalli

    (@dfumagalli)

    If I can help you further please tell me what I could do for you. And thanks for your assistance!

    Plugin Contributor Pippin Williamson

    (@mordauk)

    What version of EDD did you update from?

    Thread Starter dfumagalli

    (@dfumagalli)

    The “info” says 1.7.2 (impossible as it’s the current release).

    I tend to update most plug ins in the same day they become available, I had 1.7.1 as last version.

    I had about 55 downloads working before I updated and something broke and then I started getting end users posting me about the zero length file.

    If you could please tell me the whereabouts of the code responsible for sending the files in forced mode, I could slap in some “echo”, print_r etc. and see what’s interfering with the intended functionality.

    Besides being useful to me, your plug in would benefit from solving this, as the affected website (I manage several) is on a very large hosting provider and thus the issue potentially affects all those who are on that hosting.

    Plugin Contributor Pippin Williamson

    (@mordauk)

    Thread Starter dfumagalli

    (@dfumagalli)

    Thank you, I will check those functions once I get at home.

    In the meanwhile, in that source file I have spotted stuff you might have an use for.

    At line with this statement:

    elseif ( stristr( getenv( ‘SERVER_SOFTWARE’ ), ‘nginx’ ) || stristr( getenv( ‘SERVER_SOFTWARE’ ), ‘cherokee’ ) )

    I have just checked on one of my NGinx servers (latest version) and it has no “nginx” environment variable for getenv. I am not sure if NGinx automatically passes $_SERVER vars in environment vars (IIS does not).

    A phpinfo() would only show the environment vars HOME and USER.

    Instead I have this signature:

    _SERVER[“SERVER_SOFTWARE”] => “nginx/1.4.1”

    I repeat, I am not sure if phpfpm sets env var to the $_SERVER var.

    Furthermore, the program enters in the nginx clause even if $direct == true and then proceeds building a path relative to the domain. In case of $direct && file residing outside the web path I feel this could break something. Maybe I have just read your source wrong (I had all of 30 seconds to skim through it) but still, it might be worth giving it a look.

    Returning to this specific case, instead, here I have Apache and I don’t think it got mod_xsendfile installed.

    Therefore the issue is going to be in edd_deliver_download(). I smell something breaks while creating the temp link.

    Plugin Contributor Pippin Williamson

    (@mordauk)

    Thanks for noticing! I will make sure it gets looked into.

    Thread Starter dfumagalli

    (@dfumagalli)

    Some updates.
    The program flow, due to Apache not having the file mod installed nor symlinks being enabled etc. ends up calling

    edd_readfile_chunked( $file, $retbytes = TRUE )
    line 536.

    In that function,

    $handle = fopen( $file, ‘r’ );

    should become

    $handle = fopen( $file, ‘rb’ );

    else you’ll have issues with servers’ operating systems supporting both text and binary reading (i.e. Windows).

    Moreover the bug is immediately turned off if I comment out:

    // ob_flush();
    // flush();

    at line 550.

    Now I don’t have an idea about what flushing is doing in there.

    Is it needed? I see the function mentions:

    “See http://codeigniter.com/wiki/Download_helper_for_large_files/”

    therefore did you copy the function including the flushing because it was already working in Code Igniter? I mean, is the flushing with no previous buffer setup or whatever the intended program flow?

    I don’t know if removing the two flushing instructions is good, my file is 428k and thus does not even really test that fread loop.

    Some extensive testing with files ranging from 0 to > $chunksize are needed to see if it’s still working.

    Also, I don’t know about side effects of not flushing a large file. Does PHP allowed memory exhaust? No idea.

    Anyway that’s food for thought, I am going to bed now.

Viewing 15 replies - 1 through 15 (of 30 total)
  • The topic ‘After last update, the plug in sends zero length files’ is closed to new replies.