Re: HTTP::Daemon -->Send client autoproxy?

2002-08-26 Thread $Bill Luebkert

Bullock, Howard A. wrote:
> I am writing in the hope that someone can give me some pointers, code
> snippets, or constructive discussion. My goal is to build an HTTP Win32
> single function service that will monitor a specified port for one URL
> request, gather client/browser info, build and return a proxy configuration
> script to the client.
> 
> I want to avoid installing a full fledge web server.
> 
> I think I need to read up on HTTP::Daemon. What other modules would be
> necessary to complete this project? Is there any other information or avenue
> that I should pursue? Thanks.

You can use HTTP::Daemon or you can just use IO::Socket and IO::Select to
roll your own (not much more difficult).  You have to make sure you use
select before reading a socket (to make sure there is data available) and
that you stop reading the socket if you get less data than what you asked
for - especially if you are handling multiple connections.

-- 
   ,-/-  __  _  _ $Bill Luebkert   ICQ=162126130
  (_/   /  )// //   DBE Collectibles   Mailto:[EMAIL PROTECTED]
   / ) /--<  o // //  http://dbecoll.tripod.com/ (Free site for Perl)
-/-' /___/_<_http://www.todbe.com/

___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs



RE: HTTP::Daemon -->Send client autoproxy?

2002-08-26 Thread Bullock, Howard A.

I have just looked through the documentation for HTTP and LWP but can not
find a way to interrogate the client for version etc. I would think that
that data would be in the header of the request.

use HTTP::Daemon;
use HTTP::Status;
my $d = HTTP::Daemon->new(  LocalPort => 8080);
print "Please contact me at: url, ">\n";
while (my $c = $d->accept)
{
while (my $r = $c->get_request)
{
print "protocol: " . $r->protocol . "\n";
print "headers: " . $r->headers . "\n";
print "uri: " . $r->uri . "\n";
print "content: " . $r->content . "\n";
print "Method: " . $r->method . "\n";
print "Path: " . $r->url->path . "\n";

The above code yields:
Please contact me at: http://bullockha:8080/>
protocol: HTTP/1.1
headers: HTTP::Headers=HASH(0x1c5d150)
uri: /auto.proxy
content:
Method: GET
Path: /auto.proxy

How do I get the details of "HTTP::Headers=HASH(0x1c5d150)"?


___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs



RE: HTTP::Daemon -->Send client autoproxy?

2002-08-26 Thread Bullock, Howard A.

Got it!

while (my $r = $c->get_request)
{
print "protocol: " . $r->protocol . "\n";
print "headers: " . $r->headers->{'user-agent'} . "\n";
print "headers: " . $r->headers->{'accept-language'} . "\n";
print "headers: " . $r->headers->{'connection'} . "\n";
print "headers: " . $r->headers->{'host'} . "\n";
print "headers: " . $r->headers->{'accept-encoding'} . "\n";
print "headers: " . $r->headers->{'accept'} . "\n";
print "uri: " . $r->uri . "\n";
print "content: " . $r->content . "\n";
print "Method: " . $r->method . "\n";
print "Path: " . $r->url->path . "\n";
...

-Original Message-
From: Bullock, Howard A. 
Sent: Monday, August 26, 2002 11:15 PM
To: '$Bill Luebkert'
Cc: perl win32 users
Subject: RE: HTTP::Daemon -->Send client autoproxy?

I have just looked through the documentation for HTTP and LWP but can not
find a way to interrogate the client for version etc. I would think that
that data would be in the header of the request.

use HTTP::Daemon;
use HTTP::Status;
my $d = HTTP::Daemon->new(  LocalPort => 8080);
print "Please contact me at: url, ">\n";
while (my $c = $d->accept)
{
while (my $r = $c->get_request)
{
print "protocol: " . $r->protocol . "\n";
print "headers: " . $r->headers . "\n";
print "uri: " . $r->uri . "\n";
print "content: " . $r->content . "\n";
print "Method: " . $r->method . "\n";
print "Path: " . $r->url->path . "\n";

The above code yields:
Please contact me at: http://bullockha:8080/>
protocol: HTTP/1.1
headers: HTTP::Headers=HASH(0x1c5d150)
uri: /auto.proxy
content:
Method: GET
Path: /auto.proxy

How do I get the details of "HTTP::Headers=HASH(0x1c5d150)"?


___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs



Re: HTTP::Daemon -->Send client autoproxy?

2002-08-26 Thread Ron Grabowski

> How do I get the details of "HTTP::Headers=HASH(0x1c5d150)"?

What does Data::Dumper say?

 use Data::Dumper;
 print Dumper $r->headers;

Or just look at the keys:

 foreach my $key ( keys %{$r->headers} ) {
  print "$key => ", $r->headers->{$key}, "\n";
 }
___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs



Re: HTTP::Daemon -->Send client autoproxy?

2002-08-26 Thread $Bill Luebkert

Bullock, Howard A. wrote:
> I have just looked through the documentation for HTTP and LWP but can not
> find a way to interrogate the client for version etc. I would think that
> that data would be in the header of the request.
> 
> use HTTP::Daemon;
> use HTTP::Status;
> my $d = HTTP::Daemon->new(LocalPort => 8080);
> print "Please contact me at: url, ">\n";
> while (my $c = $d->accept)
> {
>   while (my $r = $c->get_request)
>   {
>   print "protocol: " . $r->protocol . "\n";
>   print "headers: " . $r->headers . "\n";
>   print "uri: " . $r->uri . "\n";
>   print "content: " . $r->content . "\n";
>   print "Method: " . $r->method . "\n";
>   print "Path: " . $r->url->path . "\n";

One way:
foreach (keys %{$r->headers}) {
print "HDRS: $_ = ${$r->headers}{$_}\n";
}

Or try adding this or replace the above prints with it and you can
dump the whole object:

print Data::Dumper->Dump([$r], [qw($r)]);

You'll need this up top:
use Data::Dumper; $Data::Dumper::Indent=1;

> The above code yields:
> Please contact me at: http://bullockha:8080/>
> protocol: HTTP/1.1
> headers: HTTP::Headers=HASH(0x1c5d150)
> uri: /auto.proxy
> content:
> Method: GET
> Path: /auto.proxy
> 
> How do I get the details of "HTTP::Headers=HASH(0x1c5d150)"?




-- 
   ,-/-  __  _  _ $Bill Luebkert   ICQ=162126130
  (_/   /  )// //   DBE Collectibles   Mailto:[EMAIL PROTECTED]
   / ) /--<  o // //  http://dbecoll.tripod.com/ (Free site for Perl)
-/-' /___/_<_http://www.todbe.com/

___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs