Re: Problem with LWP and proxy under Cygwin

[email protected]
Newsgroups gmane.comp.lang.perl.modules.lwp
Message-ID <[email protected]>
The Cookbook is simply restating the options that were already
described in the LWP::UA page.

My case is quite different from a single user who is operating
in a particular environment.  My script maint_ip_world_db is
going out in a CPAN distribution IP::World, and is executed as
the module is installed.  It (or the install process) must
discover its environment w/r/t proxies.

As such, none of the proxy options of LWP::UA have been set.
I was expecting that get_basic_credentials would be called, and
its uri operand would indicate the identity of the proxy.  But
I think I set a breakpoint there as well as at the statement
after the initial head request, and the 500 response happened
without get_basic_credentials being called.  I'll try again
tomorrow.

maint_ip_world_db could test for the environment settings and set
->env_proxy if it finds them, but it must still deal with the
case when no such environment settings have been set up.  It may
even be the case (though unlikely) that LWP::UserAgent was just
downloaded and installed on the user's system as a prerequisite
for IP::World.

Would setting ->env_proxy when there are no environment settings
help with the 500 Internal response?  Might ->env_proxy do any
harm if the environment turns out not to have a proxy?  Can you
think of any way that the proxy situation can be discovered so
that maint_ip_world_db can set itself up before trying its first
request?

Thanks,
cmac

On Feb 25, 2010, at 12:35 AM, Tom Hukins wrote:

> On Wed, Feb 24, 2010 at 10:28:03PM -0800, [email protected] wrote:
>> I'm new to this mailing list, and haven't yet found where y'all keep
>> the good documentation about dealing with an authenticating proxy
>> using LWP::UserAgent.
>
> In this case it's the LWP cookbook:
> http://search.cpan.org/~gaas/libwww-perl-5.834/lwpcook.pod#PROXIES
>
> The "More Documentation" at the end of LWP's POD mentions it.
>
>> I have modeled a subclass approach on Gisle Aas' lwp-request.
>> You can see the complete script at
>> http://www.animalhead.com/maint_ip_world_db
>
> You shouldn't need to write any new classes to do this.
>
>> I get a 500 "internal response", as shown in the following debugger
>> dumps:
>>
>>    'proxy' => HASH(0x1060eb60)
>>         empty hash
>
> This part of your dump suggests you haven't set the proxy correctly.
>
> LWP::Debug's documentation has a section about Network traffic
> monitoring that you might find helpful:
> http://search.cpan.org/~gaas/libwww-perl-5.834/lib/LWP/Debug.pm
>
> Tom
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.