Re: propose new feature: loading cookies from Firefox 3.0 cookies.sqlite

2008-07-29 Thread 宋浩
A patch has been attached to http://wget.addictivecode.org/FrontPage, and
I've added a link to it at the bottom of the page.

My work is based on the latest 1.11.4 version. Now use --load-cookies-sqlite
and --save-cookies-sqlite to load/save cookies in Firefox 3.x format.

I've also updated doc/wget.texi and po/wget.pot.

Please note this patch is still preliminary. Some of the major problems are:
1. I'm not familiar with the configure system, so now I just added a
-lsqlite3 into src/Makefile.in, surely it should be replaced by some more
sophisticated solution.
2. The SQLite API requires the filenames to be encoded in UTF-8, regardless
of the locale used. The necessary charset conversion is not done currently.
3. While I was testing my code, I encountered some cookie expiry values from
my Firefox 3.x cookie database that are too large to fit into time_t.
Currently, I use a dirty hack so that any expiry value too large to fit into
time_t will be replaced by the "largest possible" time_t value, assuming
that time_t is some sort of a signed integral type.
4. apparently, the firefox 3.x cookie file does not have a domain_exact
field as in a firefox 2.x cookie file. But this fields is present in the
cookie struct. So I assume that if the domain name begins with a dot '.',
then it's not exact; otherwise it is exact.
5. the firefox 3.x cookie file contains a isHttpOnly field, which I don't
know how to generate from cookie struct fields.

best regards!

2008/7/29 Micah Cowan <[EMAIL PROTECTED]>

> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA1
>
> 宋浩 wrote:
> > Hi, folks:
> > I'm currently using Firefox 3.0 on my Ubuntu 8.04 system. The browser
> > saves its cookie file in the same directory as its predecessor Firefox
> > 2.x, but in a SQLite database file called cookies.sqlite instead of a
> > textual file. And I want to add support for this new cookie file format
> > into wget. The coding is almost done.
> > I'd like to know if anyone else is also working on this.
>
> To be honest, I'd prefer to avoid a dependency on sqlite in Wget, even a
> configurable one. I'd much prefer to see a solution based on a separate
> program that converts from cookies.sqlite to a cookies.txt file.
> Besides, that solution would work with more tools than Wget ("do one
> thing, and do it well"¹).
>
> ¹ Not that Wget adheres particularly well to that philosophy...
>
> Lest you think I'm just being unfeeling to your needs, I should point
> out that I'm also running on an Ubuntu 8.04, and have found the
> sqlite-based cookies files a supreme annoyance. I'd just prefer a more
> general, scriptable solution.
>
> However, if you choose to complete this work (you said you're nearly
> done), I won't mind if you place a link to your patch on the Wiki front
> page (http://wget.addictivecode.org/FrontPage).
>
> - --
> Micah J. Cowan
> Programmer, musician, typesetting enthusiast, gamer.
> GNU Maintainer: wget, screen, teseq
> http://micah.cowan.name/
> -BEGIN PGP SIGNATURE-
> Version: GnuPG v1.4.7 (GNU/Linux)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
>
> iD8DBQFIjmZ37M8hyUobTrERApkkAJ9Ns0bt0i7lgCrehQV3Q4RNRYl0eACgiwqR
> f3tC07+DhuGfI44tPFuaXDE=
> =ncxt
> -END PGP SIGNATURE-
>



-- 
宋浩
Song, Hao
Institute for Theoretical Computer Science
Tsinghua University, Beijing, P.R.China


Re: propose new feature: loading cookies from Firefox 3.0 cookies.sqlite

2008-07-28 Thread Micah Cowan
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

宋浩 wrote:
> Hi, folks:
> I'm currently using Firefox 3.0 on my Ubuntu 8.04 system. The browser
> saves its cookie file in the same directory as its predecessor Firefox
> 2.x, but in a SQLite database file called cookies.sqlite instead of a
> textual file. And I want to add support for this new cookie file format
> into wget. The coding is almost done.
> I'd like to know if anyone else is also working on this.

To be honest, I'd prefer to avoid a dependency on sqlite in Wget, even a
configurable one. I'd much prefer to see a solution based on a separate
program that converts from cookies.sqlite to a cookies.txt file.
Besides, that solution would work with more tools than Wget ("do one
thing, and do it well"¹).

¹ Not that Wget adheres particularly well to that philosophy...

Lest you think I'm just being unfeeling to your needs, I should point
out that I'm also running on an Ubuntu 8.04, and have found the
sqlite-based cookies files a supreme annoyance. I'd just prefer a more
general, scriptable solution.

However, if you choose to complete this work (you said you're nearly
done), I won't mind if you place a link to your patch on the Wiki front
page (http://wget.addictivecode.org/FrontPage).

- --
Micah J. Cowan
Programmer, musician, typesetting enthusiast, gamer.
GNU Maintainer: wget, screen, teseq
http://micah.cowan.name/
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.7 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFIjmZ37M8hyUobTrERApkkAJ9Ns0bt0i7lgCrehQV3Q4RNRYl0eACgiwqR
f3tC07+DhuGfI44tPFuaXDE=
=ncxt
-END PGP SIGNATURE-


propose new feature: loading cookies from Firefox 3.0 cookies.sqlite

2008-07-28 Thread 宋浩
Hi, folks:
I'm currently using Firefox 3.0 on my Ubuntu 8.04 system. The browser saves
its cookie file in the same directory as its predecessor Firefox 2.x, but in
a SQLite database file called cookies.sqlite instead of a textual file. And
I want to add support for this new cookie file format into wget. The coding
is almost done.
I'd like to know if anyone else is also working on this.

Thanks!

Hao Song