Debian Bug report logs -
#540142
Use the same cookie file format as curl and wget.
Reply or subscribe to this bug.
Toggle useless messages
Report forwarded
to debian-bugs-dist@lists.debian.org, Fumitoshi UKAI <ukai@debian.or.jp>:
Bug#540142; Package w3m.
(Thu, 06 Aug 2009 06:39:03 GMT) (full text, mbox, link).
Acknowledgement sent
to "Trent W. Buck" <trentbuck@gmail.com>:
New Bug report received and forwarded. Copy sent to Fumitoshi UKAI <ukai@debian.or.jp>.
(Thu, 06 Aug 2009 06:39:03 GMT) (full text, mbox, link).
Message #5 received at submit@bugs.debian.org (full text, mbox, reply):
Package: w3m
Version: 0.5.2-2.1
Severity: wishlist
Summary: please make w3m use the same cookie file format as wget, curl
and (apparently) netscape/mozilla/firefox.
Both curl and wget can read and write cookie files in "the
Netscape/Mozilla cookie file format". This means that I can automate
logins to stupid web apps:
curl --cookie-jar j -so/dev/null \
http://example.net/login.php \
-F username=$USER -F password=<-
And then both wget and curl can use that logged-in cookie:
curl --cookie j http://example.net/stupid.php
wget --load-cookies j http://example.net/stupid.php
I want to similar automate login for interactive web apps:
curl --cookie-jar ~/.w3m/cookie example.net/login ...
w3m example.net/main
But unfortunately w3m uses a different cookie format! By reading
w3m's source code, I had to make a guess as to how to translate
cookies into w3m's (undocumented?) format:
<cookie-jar egrep -v '^($|#)' |
while read domain bool1 path bool2 int1 name value
do url=http://$domain/some-application-specific-string
expires=$(date -dtomorrow +%s)
portlist='' flag=13 version=0
# If the domain is not an FQDN, but instead a host in the
# default DNS search domain, apparently w3m and curl behave
# differently in some way I don't understand.
if ! [[ $domain =~ \. ]]
then domain=some-hard-coded-string
fi
printf '%s\t' "$url" "$name" "$value" "$expires" "$domain" "$path" "$flag" "$version" "$portlist"
echo
done >>~/.w3m/cookie
Such a translation script is incomplete and prone to failure.
It would be much easier for me if w3m simply used the same cookie file
format as wget and curl! Apparently this file format is also the one
used by Mozilla browsers, so I guess it is a pretty widespread
convention.
Of course, this would also make it easier to go the other way -- for
me to log in to a stupid web app via w3m, and then use wget or curl to
download a file that requires the stupid logged-in cookie:
wget --load-cookies ~/.w3m/cookie http://example.net/foo.pdf
-- System Information:
Debian Release: squeeze/sid
APT prefers testing
APT policy: (990, 'testing'), (500, 'unstable'), (1, 'experimental')
Architecture: i386 (i686)
Kernel: Linux 2.6.30-1-686 (SMP w/1 CPU core)
Locale: LANG=en_AU.utf8, LC_CTYPE=en_AU.utf8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Versions of packages w3m depends on:
ii libc6 2.9-12 GNU C Library: Shared libraries
ii libgc1c2 1:6.8-1.2 conservative garbage collector for
ii libgpm2 1.20.4-3.2 General Purpose Mouse - shared lib
ii libncurses5 5.7+20090523-1 shared libraries for terminal hand
ii libssl0.9.8 0.9.8k-3 SSL shared libraries
ii zlib1g 1:1.2.3.3.dfsg-13 compression library - runtime
Versions of packages w3m recommends:
ii ca-certificates 20090709 Common CA certificates
Versions of packages w3m suggests:
ii man-db 2.5.5-3 on-line manual pager
pn menu <none> (no description available)
pn migemo <none> (no description available)
ii mime-support 3.46-1 MIME files 'mime.types' & 'mailcap
ii w3m-el-snapshot [w3 1.4.364+0.20090802-1 simple Emacs interface of w3m (dev
ii w3m-img 0.5.2-2.1 inline image extension support uti
-- no debconf information
Send a report that this bug log contains spam.
Debian bug tracking system administrator <owner@bugs.debian.org>.
Last modified:
Mon Jun 5 03:07:47 2023;
Machine Name:
buxtehude
Debian Bug tracking system
Debbugs is free software and licensed under the terms of the GNU
Public License version 2. The current version can be obtained
from https://bugs.debian.org/debbugs-source/.
Copyright © 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson,
2005-2017 Don Armstrong, and many other contributors.