Commit Graph
51 Commits
Author SHA1 Message Date
Bharat Mediratta 86a2759062 If profiling is enabled, dump out profiling data instead of proxied
images so that we can see how efficient our proxying is.  Follow-on
for #1959.
2013-01-24 18:14:14 -05:00
shadlaws 8436e16b2f #1954 - Skip buffer calls for unit tests of file_proxy and data_rest.
Moved the "if (TEST_MODE)" statement before the buffer calls in file_proxy and data_rest.
This has no impact on normal use, but will make the unit tests more compatible with different server/PHP configurations.
Note: We do not have to skip setting the headers, which means we can build unit tests around them if we wish.
2013-01-21 10:45:34 +01:00
Bharat Mediratta d45a737779 Update copyright to 2013. Fixes #1953. 2013-01-21 01:22:01 -05:00
Bharat Mediratta f1d2a8e871 Add a long overdue test for File_Proxy_Controller that tests all the various
edge case behaviors.  It doesn't cover the various headers, but it does cover
the permission based code paths.
2013-01-20 23:54:01 -05:00
shadlaws 1927dd00e4 #1949 - Fix album thumb mime types given by data_rest and file_proxy
Correct result: always "image/jpeg"
Old data_rest result: mime of cover item
Old file_proxy result: mime of album item (null)
2013-01-20 08:34:12 +01:00
shadlaws 592eff0e5a #1942 - Make data_rest and file_proxy more consistent - several minor documentation/formatting changes.
No actual functionality changed here.
2013-01-19 08:40:19 +01:00
shadlawsandBharat Mediratta 549630219f bug fix: updated file_proxy.php to use legal_file helper instead of hard-coded list of movie file extensions.
bug fix: updated uploader.php to use legal_file helper instead of hard-coded list of movie file extensions.

Fixes #1926
2012-12-10 11:15:02 -08:00
Bharat Mediratta 9e1f975e7b Fix up syntax in the last change. Follow-on for #1879. 2012-06-05 14:08:15 -07:00
Tony Fung 6fbea19b35 Force Turn off the compress as most image file already compressed. 2012-06-05 11:16:37 +08:00
Bharat Mediratta 3fbe07078f Second attempt to fix #1821 - first attempt caused an infinite loop in some cases
when zlib.output_compression is enabled.
2012-06-04 19:54:01 -07:00
Bharat Mediratta b512734b9d Close all buffers, not just the ones that Kohana opened. Fixes #1821,
thanks to pvalsecc.
2012-05-08 18:23:33 -07:00
Bharat Mediratta bf2bb3e1ea Update copyright to 2012. #1822 2012-02-27 09:48:23 -08:00
Bharat Mediratta 423daa52d5 Update copyright to 2011. 2011-01-21 23:01:06 -08:00
Bharat Mediratta 09d34696a1 Update comments to annotate what data is where during the process.
Follow-on for #1518.
2011-01-11 17:54:33 -08:00
Bharat Mediratta e3df9c1611 Merge branch 'Ticket#1518' of git://github.com/Joe7/gallery3 2011-01-11 17:53:16 -08:00
Joe7 7f6d87166d Removed check as input value is compared against dataset of validated values, and request is only processed further in case of a match. => this is unnecessary 2011-01-11 23:16:05 +01:00
Bharat Mediratta d557b2a63e Allow File_Proxy_Controller to run in private gallery mode since it
does all the right permission checks.  This prevents a hotlink to a
private photo in a private gallery from kicking the user out to a
login page.  Fixes #1594.
2011-01-10 14:50:30 -08:00
Joe7 9364f0d931 Allow '..' segment in photo/album paths through file_proxy (as is not forbidden in other places like add album/item) and explitely look for /../ instead
Note: directory path can't end in '.' forcibly so this shall be fine
Fixes Ticket #1518
2011-01-07 19:42:57 +01:00
Bharat Mediratta c5ede5881b Updated to use the new item::find_by_path() API. 2010-12-21 19:36:23 -08:00
Bharat Mediratta 524554c65b Send back the content length of files. This fixes streaming movies. Fixes ticket #974. 2010-08-11 21:02:57 -07:00
Bharat Mediratta f0d8aef0ea "Content-type" --> "Content-Type". 2010-08-09 22:51:14 -07:00
Bharat Mediratta a8bb046209 Use readfile() instead of fopen()/fpassthru()/fclose() for brevity.
I've done some tests on a 60M flv and found that there's no difference
in memory consumption with these three approaches:

  public function test() {
    Kohana::close_buffers(false);
    $file = "/home/bharat/basketball.flv";
    if ($fd = fopen($file, "rb")) {
      while (true) {
        $bits = fread($fd, 65535);
        if (strlen($bits) == 0) {
          break;
        }
        print $bits;
        set_time_limit(30);
      }
      fclose($fd);
    }
    Kohana_Log::add("error","test: " . print_r(array(memory_get_peak_usage(true),memory_get_peak_usage(false)),1));
  }

  public function test2() {
    Kohana::close_buffers(false);
    $file = "/home/bharat/basketball.flv";
    $fd = fopen($file, "rb");
    fpassthru($fd);
    fclose($fd);
    Kohana_Log::add("error","test2: " . print_r(array(memory_get_peak_usage(true),memory_get_peak_usage(false)),1));
  }

  public function test3() {
    Kohana::close_buffers(false);
    $file = "/home/bharat/basketball.flv";
    readfile($file);
    Kohana_Log::add("error","test3: " . print_r(array(memory_get_peak_usage(true),memory_get_peak_usage(false)),1));
  }
2010-07-31 11:51:18 -07:00
Romain LE DISEZandBharat Mediratta 39962eaddc Accept extension .m4v as video/mp4 2010-07-10 08:09:04 -07:00
Tim Almdal a03e3d1dc1 Fix for ticket #1110. Need to use the encode_path with a movie extension to find the item. Thanks to samdavidoff for the initial fix. 2010-06-17 09:38:36 -07:00
Bharat Mediratta c3c2b45280 Update the copyright to 2010. It's only 3 months into the year :-) 2010-03-03 10:15:34 -08:00
Bharat Mediratta c050acf30a Fix lots of warnings that pop up when we're in E_STRICT mode. They're
mostly issues around uninitialized variables, calling non-static
functions in a static context, calling Session functions directly
instead of on its singleton, passing non-variables by reference, and
subclasses not using the same interface as the parent class.
2010-01-31 16:07:41 -08:00
Tim Almdal 2ab6eda728 Change file proxy to url encode the path components instead of the entire path. Otherwise, we will encode the slashes and won't find the item. 2010-01-08 12:18:46 -08:00
Tim Almdal 58620c5faa Use rawurlencode to remove any encoding that the browser may have added. Fixes ticket #954. 2010-01-07 10:55:43 -08:00
Tim Almdal cbf9754922 Send an empty Pragma header and use the item-updated time in the last-modified header 2010-01-04 09:10:12 -08:00
Tim Almdal 55eeb8336f Change the file proxy to use the expires helper to manage content expiration. Fixes ticket #953. 2009-12-30 09:55:28 -08:00
Bharat Mediratta 057e8d09af Convert a bunch of leftover kohana::show_404 calls to throw
Kohana_404_Exception instead.  These are the ones where we used a
lower-case 'k' so my previous filter didn't catch it.
2009-12-23 20:51:33 -08:00
Bharat Mediratta 8b9a02084a Updates for the latest version of Kohana 2.4:
1) Controller::$input is gone -- use Input::instance() now
2) Handle new 'database.<default>.connection.params' parameter
3) Handle new 'cache.<default>.prefix' parameter
2009-12-21 21:27:43 -08:00
Bharat Mediratta c803cb2909 Merge branch 'master' of git@github.com:gallery/gallery3 into bharat_dev 2009-12-01 19:44:29 -08:00
Bharat Mediratta 6fa880777c Beter fix for #925. 2009-12-01 13:37:07 -08:00
Bharat Mediratta f9ebe009c3 Use the real mime type for movies when we're requesting the full movie
instead of a thumbnail.  Fixes ticket #925, thanks to lsowen.
2009-12-01 13:34:40 -08:00
Bharat Mediratta 1fd0e14359 Convert all DB where() calls to take 3 arguments.
Convert all open_paren() calls to and_open() or or_open() as appropriate.
2009-11-26 12:09:04 -08:00
Bharat Mediratta 2e420522ec Preliminary work to cut over to Kohana 2.4
- Kohana::log() -> Kohana_Log::add()
- Kohana::config_XXX -> Kohana_Config::instance()->XXX
- Implement View::set_global in MY_View
- Updated Cache_Database_Driver to latest APIs
- ORM::$loaded -> ORM::loaded()
- Updated item::viewable() to use K2.4 parenthesization
2009-11-25 13:22:24 -08:00
Tim Almdal 051a7ae27a Refix #812, by removing the decoding in file_proxy instead of not encoding in Item_Model when creating the relative_path_cache. 2009-10-27 20:20:32 -07:00
Tim Almdal 2da7f93784 Fix the setting of the mime type header. as per
http://gallery.menalto.com/node/90306
Thanks rWatcher

Signed-off-by: Tim Almdal <tnalmdal@shaw.ca>
2009-08-20 12:26:47 +08:00
Bharat Mediratta f83db99d39 Properly display thumbnails for private movies by backtracking from
the thumbnail to the movie and then showing it as a JPG.  Fixes ticket
#570.
2009-07-21 12:26:16 -07:00
Bharat Mediratta 8f1bca7459 Remove the fallback code. It should trigger extremely rarely and seems highly inefficient to me, so let's see if we can live without it. 2009-07-21 12:18:49 -07:00
Bharat Mediratta 9588e8604d Use %27 instead of &#039; (the latter is the wrong form of escaping for urls). 2009-07-12 20:08:02 -07:00
Bharat Mediratta 9809238399 Unescape &#039; also (single quote) 2009-07-11 19:17:12 -07:00
Bharat Mediratta 132bd8306e Re-add Session::abort_save(). It was reverted as part of the earlier
change, but this is the part that we want to keep.
2009-06-30 20:51:02 -07:00
Bharat Mediratta 666c807fcc Revert "Add Session::abort_save() to Kohana."
Obsoleted by upstream fix.

This reverts commit 06f066164f.
2009-06-30 20:47:51 -07:00
Bharat Mediratta 06f066164f Add Session::abort_save() to Kohana.
Filed upstream as: http://dev.kohanaphp.com/issues/1801
2009-06-21 15:09:32 -07:00
Bharat Mediratta 3b6567f38c Unescape %20 into " " also. 2009-06-01 23:20:36 -07:00
Bharat Mediratta 54ae9fac88 Remove extra blank line 2009-05-31 22:12:14 -07:00
bharat 297fb737ac Convert %7E to ~ when proxying files to work around Firefox's overzealous security model. 2009-06-01 01:07:05 -04:00
Bharat Mediratta ce285b8feb Use the relative_path_cache to look up items which should be a faster
query than using the level + the components.
2009-05-29 21:23:08 -07:00