12-13-2010, 02:38 PM | #76 |
Grand Sorcerer
Posts: 11,741
Karma: 6997045
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
It could be that the android browser requires the content-disposition header, which I haven't supplied. That is probably a bug, but I can see why they would do it. The header provides an unambiguous filename. There is a new 0.2.3beta release that includes the content-disposition header.
As for the timeouts, I don't know why they would be there. I didn't think that I changed much. I did change the way the prev and next buttons work, but it uses basic html. My son is coming to visit in a few days, and he has an android phone. We will play. |
12-13-2010, 03:28 PM | #77 |
Wizard
Posts: 1,337
Karma: 123455
Join Date: Apr 2009
Location: Malaysia
Device: PRS-650, iPhone
|
Haven't done a pcap from the android device, as that's going to require some network setup, but I did check the difference in response headers for an epub pulled directly from it's URL vs. pulling it from the php server.
Here are the response headers for a book pulled from the web server directly (which works with Android): Code:
HTTP/1.1 200 OK Date: Mon, 13 Dec 2010 20:18:39 GMT Server: Apache/1.3.42 (Unix) mod_fastcgi/2.4.6 mod_log_bytes/1.2 mod_bwlimited/1.4 mod_auth_passthrough/1.8 FrontPage/5.0.2.2635 mod_ssl/2.8.31 OpenSSL/0.9.7a Last-Modified: Sat, 11 Dec 2010 14:29:35 GMT Etag: "41643c7-9edf8-4d038acf" Accept-Ranges: bytes Content-Length: 650744 Keep-Alive: timeout=15, max=99 Connection: Keep-Alive Content-Type: application/epub+zip And here are the response headers for a book pulled from the php server: Code:
HTTP/1.1 200 OK Date: Mon, 13 Dec 2010 20:17:47 GMT Server: Apache/1.3.42 (Unix) mod_fastcgi/2.4.6 mod_log_bytes/1.2 mod_bwlimited/1.4 mod_auth_passthrough/1.8 FrontPage/5.0.2.2635 mod_ssl/2.8.31 OpenSSL/0.9.7a Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0 Expires: Thu, 19 Nov 1981 08:52:00 GMT Pragma: no-cache X-Powered-By: PHP/5.2.14 Keep-Alive: timeout=15, max=100 Connection: Keep-Alive Transfer-Encoding: chunked Content-Type: application/epub+zip My money is on the 1981 expiration date. Is this due to a bad configuration on my part, or is this some default that PHP chooses when it's not set anywhere? The Cache-Control rules may also be upsetting Android, maybe it's deciding it's not allowed to let the user save it. Last edited by ldolse; 12-13-2010 at 03:32 PM. |
Advert | |
|
12-13-2010, 03:54 PM | #78 |
Grand Sorcerer
Posts: 11,741
Karma: 6997045
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Could you try the following?
Edit modules.book_format.php. At line 42, you should see the following function. Add the line 'header_remove(); where indicated. Code:
function do_work($smarty, $db) {
global $config, $mimetypes;
$path = $this->path;
$pathinfo = pathinfo($path);
===> header_remove();
$mt = NULL;
Code:
HTTP/1.1 200 OK Date: Mon, 13 Dec 2010 20:51:54 GMT Server: Apache/2.2.17 (Win32) PHP/5.3.3 Content-Disposition: attachment; filename=1632___Flint__Eric.epub Keep-Alive: timeout=5, max=96 Connection: Keep-Alive Transfer-Encoding: chunked Content-Type: application/epub+zip |
12-13-2010, 04:48 PM | #79 |
Wizard
Posts: 1,337
Karma: 123455
Join Date: Apr 2009
Location: Malaysia
Device: PRS-650, iPhone
|
Well, it was worth a shot, unfortunately got bit by the 5.3 vs. 5.2 issue. header_remove() doesn't exist in 5.2.
Anyway, it can wait until your son gets in, I'm not in a huge rush. |
12-13-2010, 08:39 PM | #80 |
Wizard
Posts: 1,337
Karma: 123455
Join Date: Apr 2009
Location: Malaysia
Device: PRS-650, iPhone
|
I more or less fixed the headers by adding the following to index.php (line 23):
Code:
=> session_cache_limiter('public'); session_start(); Code:
HTTP/1.1 200 OK Date: Tue, 14 Dec 2010 01:28:01 GMT Server: Apache/1.3.42 (Unix) mod_fastcgi/2.4.6 mod_log_bytes/1.2 mod_bwlimited/1.4 mod_auth_passthrough/1.8 FrontPage/5.0.2.2635 mod_ssl/2.8.31 OpenSSL/0.9.7a Cache-Control: public, max-age=10800 Expires: Tue, 14 Dec 2010 04:28:01 GMT X-Powered-By: PHP/5.2.14 Last-Modified: Tue, 14 Dec 2010 01:25:16 GMT Keep-Alive: timeout=15, max=100 Connection: Keep-Alive Transfer-Encoding: chunked Content-Type: application/epub+zip Unfortunately that didn't make any difference :( My new theory is that Android doesn't play well with authenticated sites. The directory with the ebooks doesn't require authentication, just using security by obscurity there. The php server directory however is authenticated. The 'hangs' I mentioned earlier may be tied to Android intermittently not passing credentials correctly. When I added user:password@ to the URL the page that was hanging suddenly displayed. Will do some more testing to confirm. |
Advert | |
|
12-13-2010, 08:51 PM | #81 |
Wizard
Posts: 1,337
Karma: 123455
Join Date: Apr 2009
Location: Malaysia
Device: PRS-650, iPhone
|
Looks like it is due to the fact that Droid sucks when it comes to 401 auth. It partially supports it, as I can use the password protected php book browser interface to my heart's content, but the book download itself breaks, as mentioned before. I went into the server's accesslog, and each failed epub download was given a 401 response to which the Android device never replied.
Not sure if there is something we can do to work around the fact that Android is broken in this regard, but I'll keep digging. Edit: This is apparently a widespread problem that has existed in Android for a while... googling 'Android' and 'htaccess' will get you some of the better links out there, alternatively 'password protected' with 'Android', or 401 authentication, etc. None of the discussions presented any solution except avoiding passwords on the actual file download directories. Found the bug reports: http://code.google.com/p/android/issues/detail?id=1353 http://code.google.com/p/android/issues/detail?id=9866 Can't believe Google's been sitting on this since 2008!! I'll try the workaround in the first bug report. Last edited by ldolse; 12-13-2010 at 09:22 PM. |
12-13-2010, 09:53 PM | #82 |
Grand Sorcerer
Posts: 11,741
Karma: 6997045
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Hmmm....
I can easily add (optional) internal authentication. It would not use 401 auth at all, but would be part of sessions state. Basically, any access would trigger the 'login' module until proper credentials have been provided. This is plain http, so it should get around the problems. Note also that it should be able to use the same passwd file that htaccess uses, so authentication could be mixed if desired. Will look at this tomorrow. |
12-14-2010, 04:30 AM | #83 |
Grand Sorcerer
Posts: 11,741
Karma: 6997045
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Have added optional internal authentication. See config_defaults.php. You need to set the enabling flag to true and provide a password file built by htpasswd. Be sure to use a supported encryption. For example, php5.2 does not support the apache variant of MD5 that htpasswd seems to want to use (on debian at least).
Also cleaned up some heading information when displaying categories. This is still in 0.2.3beta. |
12-15-2010, 07:23 AM | #84 |
Grand Sorcerer
Posts: 11,741
Karma: 6997045
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Release 0.2.3 is now available in the usual place. Change log is below the spoiler.
Spoiler:
|
12-15-2010, 08:48 AM | #85 |
Wizard
Posts: 1,337
Karma: 123455
Join Date: Apr 2009
Location: Malaysia
Device: PRS-650, iPhone
|
That did the trick. I think in the end it might have been the content disposition header. Even after I'd disabled 401 auth for Droid user agents the 2.3 beta still failed to download (just hung), and Google's download manager titled the download <unknown>.
With this new release the download has the proper name and the download completes, launching Aldiko upon completion. I saw content-disposition was added in the release notes. The authentication worked flawlessly as well, apparently the server admins were wise enough not to configure cpanel to use MD5. Thanks! Last edited by ldolse; 12-15-2010 at 09:02 AM. |
01-13-2011, 06:34 PM | #86 |
Junior Member
Posts: 4
Karma: 10
Join Date: Jan 2011
Device: ipad
|
lots of PHP warnings
Hi,
I'm trying out the latest release on my hosted webserver. When I create a small library (10 titles) everything works nicely. With a somewhat bigger library (160 titles) I get lots of PHP warnings: Warning: Invalid argument supplied for foreach() in /home2/teekensi/public_html/calibre/db.php on line 38, this is about 70 pages long, with different line numbers (and messages). Because it works nicely with the small library, I suspect there might be something wrong with my library, but reimporting it in Calibre works nicely. Any ideas? |
01-13-2011, 08:16 PM | #87 | |
Wizard
Posts: 1,337
Karma: 123455
Join Date: Apr 2009
Location: Malaysia
Device: PRS-650, iPhone
|
Quote:
|
|
01-14-2011, 02:48 AM | #88 |
Junior Member
Posts: 4
Karma: 10
Join Date: Jan 2011
Device: ipad
|
Spot on Idolse!
I deleted the tags from the library and presto. Thanks |
01-14-2011, 06:05 AM | #89 |
Grand Sorcerer
Posts: 11,741
Karma: 6997045
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
@coyo: what version of calibre are you using?
The error you mention happens if calibre's field metadata is not stored in the database. Field metadata has been there for quite some time, so my suspicion is that you are using an old release of calibre, perhaps all the way back to a release in the 06 range. If you are, then there is a strong risk that other things will blow up eventually. The PHP server expects to have a recent release, but I don't check for it. |
01-20-2011, 12:36 PM | #90 |
Junior Member
Posts: 4
Karma: 10
Join Date: Jan 2011
Device: ipad
|
I'm now at 0.7.40.
Everything seems to work fine. Downloading epubs is ok, when I try to download a pdf, I get the following error: Fatal error: Call to undefined function finfo_open() in /public_html/calibre/modules/book_format.php on line 57. Could it be that something is missing from my php config? |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Calibre Command Line usage with PHP | artoros | Related Tools | 13 | 07-01-2010 09:57 AM |
Web Content Server | mezme | Calibre | 7 | 01-08-2010 09:59 PM |
Calibre web server on MAC I cant get to work.. any help appreciated. | stustaff | Calibre | 5 | 01-06-2010 06:05 PM |
Calibre - web server problems | eclpmb | Calibre | 9 | 11-28-2008 02:04 PM |