You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Xuan Zhang <xu...@yale.edu> on 2009/11/19 08:09:47 UTC

[users@httpd] Using named pipe in Apache directory

Hi,

I am dealing with a little bit strange requirements in apache.
I want to use an "named pipe" generated by mkfifo as a file in apache
directory.  For example, I put one pipe file in as a.file in apache's
directory and then generate the stream of snapshot of my screen into
the pipe.  In this case, I hope the client who fetches the a.mp4 file
would receive a stream of my screen.

To test it,

1. I set up a named pipe a.file
2. I execute   cat < index.html > a.file
3. I open a browser and try to access http://localhost/a.file

However, when I tried to do this, I found apache just simply close the
connection and the browser stay blank.

I wonder if I do something wrong. Why should it go this way?

I searched google but found little relevant. Any suggestions?

Best,
Xuan



-- 
I wish I were a dog

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Using named pipe in Apache directory

Posted by Nick Kew <ni...@webthing.com>.
Doug McNutt wrote:

>> To test it,
>>
>> 1. I set up a named pipe a.file
>> 2. I execute   cat < index.html > a.file
>> 3. I open a browser and try to access http://localhost/a.file
>>
>> However, when I tried to do this, I found apache just simply close the
>> connection and the browser stay blank.
> 
> Since no one more familiar with apache than I has answered. . .

I hadn't seen the OP ...

Anyway, apache's default handler serves a file.  If you want to serve
from a pipe, you'll need another handler.  Or an alternative such as
a CGI script.

Having said that, it looks like enabling a pipe should be a
very straightforward hack to the default handler.  Just test
r->finfo.filetype for a pipe, and if it is, make a pipe bucket
of it (and avoid inappropriate ops like setting Content-Length
or Last-Modified from the finfo).

-- 
Nick Kew

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Using named pipe in Apache directory

Posted by Doug McNutt <do...@macnauchtan.com>.
At 02:09 -0500 11/19/09, Xuan Zhang wrote:
>I am dealing with a little bit strange requirements in apache.
>I want to use an "named pipe" generated by mkfifo as a file in apache
>directory.  For example, I put one pipe file in as a.file in apache's
>directory and then generate the stream of snapshot of my screen into
>the pipe.  In this case, I hope the client who fetches the a.mp4 file
>would receive a stream of my screen.
>
>To test it,
>
>1. I set up a named pipe a.file
>2. I execute   cat < index.html > a.file
>3. I open a browser and try to access http://localhost/a.file
>
>However, when I tried to do this, I found apache just simply close the
>connection and the browser stay blank.

Since no one more familiar with apache than I has answered. . .

Apache is setting up a forked process to handle your request. It almost surely empties the pipe while immediately passing something to the http user.

But header information may be screwed up and when the pipe gets empty, and it has to before apache will send anything, the forked process will quit.

Even if such a stream might work it will require two named pipes unless I don't know something about two way pipes. Perhaps there isn't much to pass from apache to your stream process. But I would think that some synchronization like an interrupt from apache saying "send another page".

Have a look at the way RSS - really simple syndication - works. I'm pretty sure that browsers are simply told to refresh regularly so that each image gets a complete new  request with something like a cookie that tells where you are in the "stream".

And I'm dead sure that someone around here knows a lot more than I do about it.
-- 

--> From the U S of A, the only socialist country that refuses to admit it. <--

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org