List Info

Thread: Sending HTML to konqueror from the command line (via a named pipe)




Sending HTML to konqueror from the command line (via a named pipe)
user name
2006-11-24 00:48:42
With the help of some posters over on the lvlug list
 (lvlugthelinuxlink.net), I've been able to send HTML to
firefox and
 lynx from the command line (via a named pipe).

I can't get the same thing to work with konqueror.  

Here's what works in lynx and firefox:

[rhks14 rhk]$ mkfifo foo.html
[rhks14 rhk]$ echo
"<HTML><HEAD></HEAD><BODY>TEST&
lt;/BODY></HTML>" > foo.html

Then, in firefox, browse to file:///rhk/foo.html, or start
firefox (or lynx)
with:

mozilla-firefox file:///rhk/foo.html &

Tried the same thing, and quite a few variations, with
konqueror and none of
them work.

(The following is just a partial list of some of the
variations--I've mixed
and matched, varied the number of slashes, added my host
name, my fully
qualified host name, tried localhost...

   * kfmclient openProfile webbrowsing /rhk/foo.html
   * konqueror http:///rhk/foo.html
   * dcop konqueror-21622 konqueror-mainwindow#1 newTab
file:///rhk/foo.html
)

Any hints?

Randy Kramer
Sending HTML to konqueror from the command line (via a named pipe)
user name
2006-11-24 08:15:39
Randy Kramer wrote:
>With the help of some posters over on the lvlug list
> (lvlugthelinuxlink.net), I've been able to send HTML to
firefox and
> lynx from the command line (via a named pipe).
>
>I can't get the same thing to work with konqueror.
[snip]
>Any hints?

No solution. This requires a change in the MIME type handler
(because it 
detects as inode/fifo instead of text/html). It also
requires a change in 
kio_file, because that one opens only regular files.

-- 
  Thiago Macieira  -  thiago (AT) macieira.info - thiago
(AT) kde.org
    PGP/GPG: 0x6EF45358; fingerprint:
    E067 918B B660 DBD1 105C  966C 33F5 F005 6EF4 5358
Sending HTML to konqueror from the command line (via a named pipe)
user name
2006-11-24 11:46:26
On Friday 24 November 2006 09:15, Thiago Macieira wrote:
> Randy Kramer wrote:
> >With the help of some posters over on the lvlug
list
> > (lvlugthelinuxlink.net), I've been able to send
HTML to firefox and
> > lynx from the command line (via a named pipe).
> >
> >I can't get the same thing to work with konqueror.
>
> [snip]
>
> >Any hints?
>
> No solution. This requires a change in the MIME type
handler (because it
> detects as inode/fifo instead of text/html). It also
requires a change in
> kio_file, because that one opens only regular files.

It seems to be possible to work around the first problem by
explicitly 
specifying a MIME type

kfmclient exec foo.html text/html

Maybe using netcat and one of KIO's "remote"
protocols could be used instead

Cheers,
Kevin

-- 
Kevin Krammer, KDE developer, xdg-utils developer
KDE user support, developer mentoring
Sending HTML to konqueror from the command line (via a named pipe)
user name
2006-11-26 02:52:22
Thanks for the responses!  Some comments interspersed below:

On Friday 24 November 2006 06:46 am, Kevin Krammer wrote:
> On Friday 24 November 2006 09:15, Thiago Macieira
wrote:
> > Randy Kramer wrote:
> > > I've been able to send HTML to firefox and
> > > lynx from the command line (via a named
pipe).
> > >
> > >I can't get the same thing to work with
konqueror.

> > No solution. This requires a change in the MIME
type handler (because it
> > detects as inode/fifo instead of text/html). It
also requires a change in
> > kio_file, because that one opens only regular
files.
>
> It seems to be possible to work around the first
problem by explicitly
> specifying a MIME type
>
> kfmclient exec foo.html text/html

Did this work for you?  It didn't work for me.  I got the
same sort of 
"infinite loop" I got earlier--the "Open
with" dialog comes up and asks me 
what application I want to open the file (pipe) with, I
choose konqueror, and 
the dialog comes up again, ad infinitum.

> Maybe using netcat and one of KIO's "remote"
protocols could be used
> instead

I'll look for a netcat rpm for Mandriva2006, but any further
hints would be 
very welcome.

Thanks again!

Randy Kramer




> Cheers,
> Kevin
Sending HTML to konqueror from the command line (via a named pipe)
user name
2006-11-26 13:30:32
On Sunday 26 November 2006 03:52, Randy Kramer wrote:
> Thanks for the responses!  Some comments interspersed
below:
>
> On Friday 24 November 2006 06:46 am, Kevin Krammer
wrote:

> > kfmclient exec foo.html text/html
>
> Did this work for you?  It didn't work for me.  I got
the same sort of
> "infinite loop" I got earlier--the "Open
with" dialog comes up and asks me
> what application I want to open the file (pipe) with, I
choose konqueror,
> and the dialog comes up again, ad infinitum.

It worked in the sense that it directly opened konqueror,
which then failed to 
load (the kio_file problem  Thiago mentioned)

> > Maybe using netcat and one of KIO's
"remote" protocols could be used
> > instead
>
> I'll look for a netcat rpm for Mandriva2006, but any
further hints would be
> very welcome.

Could be in some bigger networking tools package. The
executable is often 
called "nc"

Cheers
Kevin
-- 
Kevin Krammer, KDE developer, xdg-utils developer
KDE user support, developer mentoring
Sending HTML to konqueror from the command line (via a named pipe)
user name
2006-11-26 20:19:07
nc + konqi definitely works for streaming html.  It's not
elegant, but
it works.  I basically used the following commands to do it:

$ mkfifo foo.html
$ nc -lp 8081 -c "/bin/cat foo.html"  # Of course,
the port doesn't
need to be 8081--that was just the first number I came up
with.
$ konqueror http://localhost:8081 &
# This command was done in a
different terminal, of course.
$ echo
"<HTML><HEAD></HEAD><BODY>TEST&
lt;/BODY></HTML>" > foo.html

And that's pretty much it.  I even put the entire thing into
a loop
just for fun:

$ i=1; while true; do nc -lp 8081 -c "/bin/cat foo.html
&"; echo
"<HTML><HEAD></HEAD><BODY>TEST&
lt;/BODY></HTML>" > foo.html; echo $i;
i=`expr $i + 1`; done

Rene

On 11/26/06, Kevin Krammer <kevin.krammergmx.at> wrote:
> On Sunday 26 November 2006 03:52, Randy Kramer wrote:
> > Thanks for the responses!  Some comments
interspersed below:
> >
> > On Friday 24 November 2006 06:46 am, Kevin Krammer
wrote:
>
> > > kfmclient exec foo.html text/html
> >
> > Did this work for you?  It didn't work for me.  I
got the same sort of
> > "infinite loop" I got earlier--the
"Open with" dialog comes up and asks me
> > what application I want to open the file (pipe)
with, I choose konqueror,
> > and the dialog comes up again, ad infinitum.
>
> It worked in the sense that it directly opened
konqueror, which then failed to
> load (the kio_file problem  Thiago mentioned)
>
> > > Maybe using netcat and one of KIO's
"remote" protocols could be used
> > > instead
> >
> > I'll look for a netcat rpm for Mandriva2006, but
any further hints would be
> > very welcome.
>
> Could be in some bigger networking tools package. The
executable is often
> called "nc"
>
> Cheers
> Kevin
> --
> Kevin Krammer, KDE developer, xdg-utils developer
> KDE user support, developer mentoring
>
>
>


-- 
the.rhorngmail.com, rhornsdf.lonestar.org,
hornr18uwosh.edu (UW-Oshkosh email address),
http://rhorn.unixcab.org
- a bunch of experimental stuff
SDF Public Access UNIX System - http://sdf.lonestar.org

Jay Leno in response to Colin Powell's deadline for an Iraqi
constitution:
"They can take ours.  After all, we aren't using
it..."
Sending HTML to konqueror from the command line (via a named pipe)
user name
2006-11-27 01:13:42
On Sunday 26 November 2006 03:19 pm, Rene Horn wrote:
> nc + konqi definitely works for streaming html.  It's
not elegant, but
> it works.  I basically used the following commands to
do it:
>
> $ mkfifo foo.html
> $ nc -lp 8081 -c "/bin/cat foo.html"  # Of
course, the port doesn't
> need to be 8081--that was just the first number I came
up with.
> $ konqueror http://localhost:8081 &
# This command was done in a
> different terminal, of course.
> $ echo
"<HTML><HEAD></HEAD><BODY>TEST&
lt;/BODY></HTML>" > foo.html

Wonderful--thank you!

Randy Kramer

>
> And that's pretty much it.  I even put the entire thing
into a loop
> just for fun:
>
> $ i=1; while true; do nc -lp 8081 -c "/bin/cat
foo.html &"; echo
>
"<HTML><HEAD></HEAD><BODY>TEST&
lt;/BODY></HTML>" > foo.html; echo $i;
> i=`expr $i + 1`; done


Sending HTML to konqueror from the command line (via a named pipe)
user name
2006-11-27 15:06:42
On Sunday 26 November 2006 08:13 pm, Randy Kramer wrote:
> On Sunday 26 November 2006 03:19 pm, Rene Horn wrote:
> > nc + konqi definitely works for streaming html.
 It's not elegant, but
> > it works.  I basically used the following commands
to do it:
> >
> > $ mkfifo foo.html
> > $ nc -lp 8081 -c "/bin/cat foo.html"  #
Of course, the port doesn't
> > need to be 8081--that was just the first number I
came up with.
> > $ konqueror http://localhost:8081 &
# This command was done in a
> > different terminal, of course.
> > $ echo
"<HTML><HEAD></HEAD><BODY>TEST&
lt;/BODY></HTML>" > foo.html
>
> Wonderful--thank you!

Oops, just got nc and installed it, and no dice.  

My version is 1.10 and it has no -c option.  So I guessed
that maybe the -e 
option is the same or similar, but no dice.

What version of netcat are you using?

My symptoms include that:

   * On my first try (which I don't remember so well), the
nc command hung 
until I started konqueror, then konqueror displayed some
sort of error 
message--I can't recall what it was (maybe something like an
address not 
found, but my memory is really bad at times).

   * On subsequent tries, when I issue nc -lp 8081 -e
"/bin/cat /rhk/foo.html" 
before starting konqueror (on a 2nd try), I get an error
message: Can't grab 
0.0.0.0:8081 with bind.  (/bin/cat is the right path to cat,
/rhk/foo.html is 
the right name for the fifo).  In fact, I get this message
whether konqueror 
is started or not.  When konqueror is started, it hangs with
"localhost 
contacted, waiting for reply", and eventually: "An
error occurred while 
loading http://localhost:8081:;
Timeout on server;  localhost"

I'm looking for documentation on the -c option.  Ok, found
some hints: 

"netcat v0.7.0 o Added command line switch `-c'
(close), which shuts down the 
connection on EOF from stdin without waiting for any answer
..."

Which makes it sound like -q with some (small) number of
seconds might be an 
alternate, but no luck there either:

[rhks14 ~]$ nc -lp 8081  -q 15 "/bin/cat
/rhk/foo.html &"
/bin/cat /rhk/foo.html &: forward host lookup failed:
Unknown server error

So I'll keep looking, and try to download netcat version
0.7.0, but I could 
probably use some more hints. 

Randy Kramer

> Randy Kramer
>
> > And that's pretty much it.  I even put the entire
thing into a loop
> > just for fun:
> >
> > $ i=1; while true; do nc -lp 8081 -c
"/bin/cat foo.html &"; echo
> >
"<HTML><HEAD></HEAD><BODY>TEST&
lt;/BODY></HTML>" > foo.html; echo $i;
> > i=`expr $i + 1`; done
>
> 
Sending HTML to konqueror from the command line (via a named pipe)
user name
2006-11-27 16:57:22
I have v1.10, so yours should work the same way.  A less
elegant
manner of doing this is just to pipe it in with cat.

$ cat foo.html|nc -lp 8081 -q 10
$ echo
"<HTML><HEAD></HEAD><BODY>TEST&
lt;/BODY></HTML>" > foo.html #This
is in a different terminal, of course.
$ konqueror http://localhost:8081

Unfortunately, netcat won't know when to close the
connection, and so
the browser--in this case Konqueror--will just keep on
waiting for
more input, even though there is none.

Rene

PS The "-e" option requires its own script file. 
So try putting the
commands you want into something like htmlstream.sh, and
then do the
following:

$ nc -lp 8081 -e htmlstream.sh

On 11/27/06, Randy Kramer <rhkramergmail.com> wrote:
> On Sunday 26 November 2006 08:13 pm, Randy Kramer
wrote:
> > On Sunday 26 November 2006 03:19 pm, Rene Horn
wrote:
> > > nc + konqi definitely works for streaming
html. It's not elegant, but
> > > it works. I basically used the following
commands to do it:
> > >
> > > $ mkfifo foo.html
> > > $ nc -lp 8081 -c "/bin/cat
foo.html" # Of course, the port doesn't
> > > need to be 8081--that was just the first
number I came up with.
> > > $ konqueror http://localhost:8081 &
# This command was done in a
> > > different terminal, of course.
> > > $ echo
"<HTML><HEAD></HEAD><BODY>TEST&
lt;/BODY></HTML>" > foo.html
> >
> > Wonderful--thank you!
>
> Oops, just got nc and installed it, and no dice.
>
> My version is 1.10 and it has no -c option.  So I
guessed that maybe the -e
> option is the same or similar, but no dice.
>
> What version of netcat are you using?
>
> My symptoms include that:
>
>    * On my first try (which I don't remember so well),
the nc command hung
> until I started konqueror, then konqueror displayed
some sort of error
> message--I can't recall what it was (maybe something
like an address not
> found, but my memory is really bad at times).
>
>    * On subsequent tries, when I issue nc -lp 8081 -e
"/bin/cat /rhk/foo.html"
> before starting konqueror (on a 2nd try), I get an
error message: Can't grab
> 0.0.0.0:8081 with bind.  (/bin/cat is the right path to
cat, /rhk/foo.html is
> the right name for the fifo).  In fact, I get this
message whether konqueror
> is started or not.  When konqueror is started, it hangs
with "localhost
> contacted, waiting for reply", and eventually:
"An error occurred while
> loading http://localhost:8081:;
Timeout on server;  localhost"
>
> I'm looking for documentation on the -c option.  Ok,
found some hints:
>
> "netcat v0.7.0 o Added command line switch `-c'
(close), which shuts down the
> connection on EOF from stdin without waiting for any
answer ..."
>
> Which makes it sound like -q with some (small) number
of seconds might be an
> alternate, but no luck there either:
>
> [rhks14 ~]$ nc -lp 8081  -q 15 "/bin/cat
/rhk/foo.html &"
> /bin/cat /rhk/foo.html &: forward host lookup
failed: Unknown server error
>
> So I'll keep looking, and try to download netcat
version 0.7.0, but I could
> probably use some more hints. 
>
> Randy Kramer
>
> > Randy Kramer
> >
> > > And that's pretty much it. I even put the
entire thing into a loop
> > > just for fun:
> > >
> > > $ i=1; while true; do nc -lp 8081 -c
"/bin/cat foo.html &"; echo
> > >
"<HTML><HEAD></HEAD><BODY>TEST&
lt;/BODY></HTML>" > foo.html; echo $i;
> > > i=`expr $i + 1`; done
> >
> > 
>


-- 
the.rhorngmail.com, rhornsdf.lonestar.org,
hornr18uwosh.edu (UW-Oshkosh email address),
http://rhorn.unixcab.org
- a bunch of experimental stuff
SDF Public Access UNIX System - http://sdf.lonestar.org

Jay Leno in response to Colin Powell's deadline for an Iraqi
constitution:
"They can take ours.  After all, we aren't using
it..."
Sending HTML to konqueror from the command line (via a named pipe)
user name
2006-11-27 23:39:03
On Monday 27 November 2006 11:57 am, Rene Horn wrote:
> I have v1.10, so yours should work the same way.  A
less elegant
> manner of doing this is just to pipe it in with cat.
>
> $ cat foo.html|nc -lp 8081 -q 10
> $ echo
"<HTML><HEAD></HEAD><BODY>TEST&
lt;/BODY></HTML>" > foo.html #This
> is in a different terminal, of course.
> $ konqueror http://localhost:8081

Ok, now it works--for whatever reason something didn't like
that port 
number--I switched to port 18000 and now it works.

Thanks!

Randy Kramer


>
> Unfortunately, netcat won't know when to close the
connection, and so
> the browser--in this case Konqueror--will just keep on
waiting for
> more input, even though there is none.
>
> Rene
>
> PS The "-e" option requires its own script
file.  So try putting the
> commands you want into something like htmlstream.sh,
and then do the
> following:
>
> $ nc -lp 8081 -e htmlstream.sh
>
> On 11/27/06, Randy Kramer <rhkramergmail.com> wrote:
> > On Sunday 26 November 2006 08:13 pm, Randy Kramer
wrote:
> > > On Sunday 26 November 2006 03:19 pm, Rene
Horn wrote:
> > > > nc + konqi definitely works for
streaming html. It's not elegant, but
> > > > it works. I basically used the following
commands to do it:
> > > >
> > > > $ mkfifo foo.html
> > > > $ nc -lp 8081 -c "/bin/cat
foo.html" # Of course, the port doesn't
> > > > need to be 8081--that was just the first
number I came up with.
> > > > $ konqueror http://localhost:8081 &
# This command was done in a
> > > > different terminal, of course.
> > > > $ echo
"<HTML><HEAD></HEAD><BODY>TEST&
lt;/BODY></HTML>" > foo.html
> > >
> > > Wonderful--thank you!
> >
> > Oops, just got nc and installed it, and no dice.
> >
> > My version is 1.10 and it has no -c option.  So I
guessed that maybe the
> > -e option is the same or similar, but no dice.
> >
> > What version of netcat are you using?
> >
> > My symptoms include that:
> >
> >    * On my first try (which I don't remember so
well), the nc command
> > hung until I started konqueror, then konqueror
displayed some sort of
> > error message--I can't recall what it was (maybe
something like an
> > address not found, but my memory is really bad at
times).
> >
> >    * On subsequent tries, when I issue nc -lp 8081
-e "/bin/cat
> > /rhk/foo.html" before starting konqueror (on
a 2nd try), I get an error
> > message: Can't grab 0.0.0.0:8081 with bind. 
(/bin/cat is the right path
> > to cat, /rhk/foo.html is the right name for the
fifo).  In fact, I get
> > this message whether konqueror is started or not. 
When konqueror is
> > started, it hangs with "localhost contacted,
waiting for reply", and
> > eventually: "An error occurred while loading
http://localhost:8081:;
> > Timeout on server;  localhost"
> >
> > I'm looking for documentation on the -c option. 
Ok, found some hints:
> >
> > "netcat v0.7.0 o Added command line switch
`-c' (close), which shuts down
> > the connection on EOF from stdin without waiting
for any answer ..."
> >
> > Which makes it sound like -q with some (small)
number of seconds might be
> > an alternate, but no luck there either:
> >
> > [rhks14 ~]$ nc -lp 8081  -q 15 "/bin/cat
/rhk/foo.html &"
> > /bin/cat /rhk/foo.html &: forward host lookup
failed: Unknown server
> > error
> >
> > So I'll keep looking, and try to download netcat
version 0.7.0, but I
> > could probably use some more hints. 
> >
> > Randy Kramer
> >
> > > Randy Kramer
> > >
> > > > And that's pretty much it. I even put
the entire thing into a loop
> > > > just for fun:
> > > >
> > > > $ i=1; while true; do nc -lp 8081 -c
"/bin/cat foo.html &"; echo
> > > >
"<HTML><HEAD></HEAD><BODY>TEST&
lt;/BODY></HTML>" > foo.html; echo $i;
> > > > i=`expr $i + 1`; done
> > >
> > > 
[1-10]

about | contact  Other archives ( Real Estate discussion Medical topics )