Register Guidelines E-Books Search Today's Posts Mark Forums Read

Go Back   MobileRead Forums > E-Book Software > Calibre > Related Tools

Notices

Reply
 
Thread Tools Search this Thread
Old 12-13-2010, 02:38 PM   #76
chaley
Grand Sorcerer
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 11,703
Karma: 6658935
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.
chaley is offline   Reply With Quote
Old 12-13-2010, 03:28 PM   #77
ldolse
Wizard
ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.
 
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.
ldolse is offline   Reply With Quote
Advert
Old 12-13-2010, 03:54 PM   #78
chaley
Grand Sorcerer
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 11,703
Karma: 6658935
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;
With that line of code in, I get the response header set:
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
All caching headers are removed. The result looks a lot like the one that works.
chaley is offline   Reply With Quote
Old 12-13-2010, 04:48 PM   #79
ldolse
Wizard
ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.
 
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.
ldolse is offline   Reply With Quote
Old 12-13-2010, 08:39 PM   #80
ldolse
Wizard
ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.
 
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();
The headers now look like this:
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.
ldolse is offline   Reply With Quote
Advert
Old 12-13-2010, 08:51 PM   #81
ldolse
Wizard
ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.
 
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.
ldolse is offline   Reply With Quote
Old 12-13-2010, 09:53 PM   #82
chaley
Grand Sorcerer
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 11,703
Karma: 6658935
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.
chaley is offline   Reply With Quote
Old 12-14-2010, 04:30 AM   #83
chaley
Grand Sorcerer
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 11,703
Karma: 6658935
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.
chaley is offline   Reply With Quote
Old 12-15-2010, 07:23 AM   #84
chaley
Grand Sorcerer
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 11,703
Karma: 6658935
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:
64 charles <> 2010-12-15 {REL 0.2.3}
Release 0.2.3

63 charles <> 2010-12-15
Document the new authentication feature in INSTALL

62 charles <> 2010-12-14
Make templates display category and category values in the header

61 charles <> 2010-12-14
Add internal authentication

60 charles <> 2010-12-13
Put a content-disposition header into the book_format download

59 charles <> 2010-12-13
Ensure category values in urls are url_encoded

58 charles <> 2010-12-13
Fix regression in goto page.

57 charles <> 2010-12-13
Change book_format not to use query strings, but instead encode the information in the path.

56 charles <> 2010-12-13
Change some defaults. In particular, make $config['web_dir'] == '.'

55 charles <> 2010-12-13
Fix prev and next links to use appropriate module

54 charles <> 2010-12-12
Change the urls to use category lookup instead of search
chaley is offline   Reply With Quote
Old 12-15-2010, 08:48 AM   #85
ldolse
Wizard
ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.
 
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.
ldolse is offline   Reply With Quote
Old 01-13-2011, 06:34 PM   #86
coyo
Junior Member
coyo began at the beginning.
 
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?
coyo is offline   Reply With Quote
Old 01-13-2011, 08:16 PM   #87
ldolse
Wizard
ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.
 
Posts: 1,337
Karma: 123455
Join Date: Apr 2009
Location: Malaysia
Device: PRS-650, iPhone
Quote:
Originally Posted by coyo View Post
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?
Charles might have a better idea, but I would guess it's a weird title or tag n your library - I've got over 2000 books in mine and it works without a problem.
ldolse is offline   Reply With Quote
Old 01-14-2011, 02:48 AM   #88
coyo
Junior Member
coyo began at the beginning.
 
Posts: 4
Karma: 10
Join Date: Jan 2011
Device: ipad
Smile

Spot on Idolse!
I deleted the tags from the library and presto.
Thanks
coyo is offline   Reply With Quote
Old 01-14-2011, 06:05 AM   #89
chaley
Grand Sorcerer
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 11,703
Karma: 6658935
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.
chaley is offline   Reply With Quote
Old 01-20-2011, 12:36 PM   #90
coyo
Junior Member
coyo began at the beginning.
 
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?
coyo is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

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


All times are GMT -4. The time now is 07:16 AM.


MobileRead.com is a privately owned, operated and funded community.