Discussion:
[patch] Gopher DPI
p***@public.gmane.org
2012-12-15 15:24:23 UTC
Permalink
I implemented basic Gopher support using DPI, patch is attached. It is
already quite usable.

"URL:" links are not supported, but Gopher servers send redirect pages
for compatibility.

The only major problem is unrecognized file types. I looked at FTP
DPI. It sends Content-type: application/octet-stream. This forces
Dillo to ask downloads DPI to start download. With gopher it doesn't
work as downloads DPI doesn't suppport gopher.

So Dillo just says "Content-Type 'application/octet-stream' not
viewable.". I left it as it is for now, because I don't think adding
support for all known and unknown protocols into downloads.cc is the
right solution. Maybe downloads DPI protocol should be changed so
Dillo would feed plugin with data it receives as octet-stream and
downloads DPI would only save what it receives to disk instead of
connecting to server and downloading the file itself.
Axel Beckert
2012-12-15 15:32:08 UTC
Permalink
Hi,
Post by p***@public.gmane.org
I implemented basic Gopher support using DPI, patch is attached. It is
already quite usable.
Yay, very cool! Looking forward to see it in the next release! :-)

Kind regards, Axel
--
/~\ Plain Text Ribbon Campaign | Axel Beckert
\ / Say No to HTML in E-Mail and News | abe-***@public.gmane.org (Mail)
X See http://www.asciiribbon.org/ | abe-***@public.gmane.org (Mail+Jabber)
/ \ I love long mails: http://email.is-not-s.ms/ | http://noone.org/abe/ (Web)
p***@public.gmane.org
2012-12-15 17:06:50 UTC
Permalink
Updated patch a little to support URLs without path (like
gopher://gopher.quux.org). Made functions static, added newlines to
messages etc.
p***@public.gmane.org
2012-12-15 18:45:12 UTC
Permalink
I am trying to make search work. Now (latest version of patch is
included) I process type '7' (FullText search) is the same as '1'. So
link "Search Veronica-2" on [1]/ is just a link that leads to [2].

Search terms can be added manually, like [3]. It works and it is what
gopher URI Scheme RFC4266 says.

DPI dialogs don't support text input, though it should not be hard to
add. Another option is HTML forms and redirections.

[1] gopher://gopherproject.org:70/1/
[2] gopher://gopher.floodgap.com:70/7/v2/vs
[3] gopher://gopher.floodgap.com:70/7/v2/vs%09dillo
Johannes Hofmann
2012-12-15 20:27:14 UTC
Permalink
very cool! To get it working on DragonFlyBSD I had to add a fflush()
after the fprintf() on the socket. Also the fdopen() flags had to be
changed to w+ (from man page: ``w+'' Open for reading and writing.).
Otherwise the fflush() doesn't work. There is the following comment
in the fflush code:

/*
* There is disagreement about the correct behaviour of
* fflush()
* when passed a file which is not open for reading.
* According to
* the ISO C standard, the behaviour is undefined.
* Under linux, such an fflush returns success and has no
* effect;
* under Windows, such an fflush is documented as behaving
* instead
* as fpurge().
* Given that applications may be written with the
* expectation of
* either of these two behaviours, the only safe
* (non-astonishing)
* option is to return EBADF and ask that applications be
* fixed.
*/

Took me quite a while to figure this out ...
Anyway, with these tiny modifications it works nice for me and I'd
like to commit it. Let me know when you think it's ready.

Cheers,
Johannes
p***@public.gmane.org
2012-12-15 20:43:33 UTC
Permalink
On Sat, Dec 15, 2012 at 09:27:14PM +0100, Johannes Hofmann wrote:
I have added setbuf(fp, NULL) instead. Fixed patch is attaced.
Post by Johannes Hofmann
Took me quite a while to figure this out ...
Anyway, with these tiny modifications it works nice for me and I'd
like to commit it. Let me know when you think it's ready.
I think attached patch is ready to be commited, I will develop code
that changes dillo internals (DPI api) as a separate patch.
p***@public.gmane.org
2012-12-15 20:31:19 UTC
Permalink
Now search works properly. URL looks like
gopher://gopher.floodgap.com:70/7/v2/vs?query=dillo, but ?query is
replaced with %09 internally. I have not found the way to make
redirect. The patch is ready to be commited and should not break
anything as it is a separate DPI that is only called for gopher URLs.

I will try to implement search without forms by adding input dialogs
as a separate patch in my patch queue on top of it. User experience
will be similar to lynx: you open the page and then browser asks you
for search query.

Also patch for src/IO/dpi.c is attached to make Dpi_parse_token more
robust as I accedently made it segfault during development of gopher
DPI.
Jorge Arellano Cid
2012-12-15 22:11:31 UTC
Permalink
Post by p***@public.gmane.org
Now search works properly. URL looks like
gopher://gopher.floodgap.com:70/7/v2/vs?query=dillo, but ?query is
replaced with %09 internally. I have not found the way to make
redirect. The patch is ready to be commited and should not break
anything as it is a separate DPI that is only called for gopher URLs.
I will try to implement search without forms by adding input dialogs
as a separate patch in my patch queue on top of it. User experience
will be similar to lynx: you open the page and then browser asks you
for search query.
Are you sure a dialog is better than a simple form (as with bookmarks)?


I'll review the patch as soon as I find the necessary time. So
far from what I've read in the list, it looks OK. Just some
friendly advice: don't rush; you'll find plenty of options along
the way, and independent as a dpi is, it looks much like it will
make it into the next release.
Post by p***@public.gmane.org
Also patch for src/IO/dpi.c is attached to make Dpi_parse_token more
robust as I accedently made it segfault during development of gopher
DPI.
Yes, there're subtle interactions and assumptions in dpip.
That's why I'd like to take the necessary time to review the FD
leak patch and then the gopher dpi.
--
Cheers
Jorge.-
p***@public.gmane.org
2012-12-17 23:29:35 UTC
Permalink
Small changes
- Added 'p' filetype for images (used by some gopher servers)
- Use dGetline instead of getline
p***@public.gmane.org
2012-12-17 23:37:39 UTC
Permalink
Fixed memory leak related to dGetline.

Loading...