Re: LWP hangs forever with get

Jesper Persson <[email protected]> Wed, 21 May 2014 18:57:58 +0200
Newsgroups gmane.comp.lang.perl.modules.lwp
Message-ID <CA+uC3V3b8fOh_np-BNo4BUKTcYGL8YXuPD-SdHHFhX4ZqeNd3A@mail.gmail.com>
--001a11c16db431620004f9ebe791
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

this perl code
------------------------------------------
use LWP::Simple qw($ua get);
$ua->timeout(5);
$ENV{PERL_LWP_SSL_VERIFY_HOSTNAME} =3D 0;
$contents =3D get("https://www.butler.edu/boa/default.aspx");
------------------------------------------

just tried fresh perl installs.

strawberry perl 5.16.3.1:  doesnt hang.

strawberry perl 5.18.0.1:  doesnt hang.

strawberry perl 5.18.1.1:  doesnt hang.

strawberry perl 5.18.2.1:  hangs.

strawberry perl 5.18.2.2:  hangs.

/Jesper


On 21 May 2014 14:12, Daniel de Oliveira Mantovani <
[email protected]> wrote:

> Hi, Jesper. It's happen because it should happen. You don't have the
> error because you are not handle error.
>
> This happen because LWP has a timeout to wait the server response,
> after this timeout it will return a timeout error. In your case, you
> don't handle the error the only stuff you get is nothing.
>
> This URL "https://www.butler.edu/boa/default.aspx" has two problems:
>
> 1 - The certificate authority is not trusted
> 2 - Never (i.e until timeout) response to the client
>
> If you are inside an intranet and you can access this site from your
> browser and you know ins't cache. Start handle with error, and show it
> to us.
>
> To avoid "certificate authority not trusted" you can use:
>
> BEGIN {
>     $ENV{PERL_LWP_SSL_VERIFY_HOSTNAME} =3D 0;
> }
>
>
> Lab:~ danielmantovani$ wget "https://www.butler.edu/boa/default.aspx"
> --2014-05-21 09:04:08--  https://www.butler.edu/boa/default.aspx
> Resolving www.butler.edu (www.butler.edu)... 159.242.130.240
> Connecting to www.butler.edu (www.butler.edu)|159.242.130.240|:443...
> connected.
> ERROR: The certificate of =E2=80=98www.butler.edu=E2=80=99 is not trusted=
.
> ERROR: The certificate of =E2=80=98www.butler.edu=E2=80=99 hasn't got a k=
nown issuer.
>
> Lab:~ danielmantovani$ wget "https://www.butler.edu/boa/default.aspx"
> --no-check-certificate
> --2014-05-21 09:04:39--  https://www.butler.edu/boa/default.aspx
> Resolving www.butler.edu (www.butler.edu)... 159.242.130.240
> Connecting to www.butler.edu (www.butler.edu)|159.242.130.240|:443...
> connected.
> WARNING: The certificate of =E2=80=98www.butler.edu=E2=80=99 is not trust=
ed.
> WARNING: The certificate of =E2=80=98www.butler.edu=E2=80=99 hasn't got a=
 known issuer.
> HTTP request sent, awaiting response... Read error (Success.) in headers.
> Retrying.
>
> On 21 May 2014 05:37, Jesper Persson <[email protected]> wrote:
> > ---------------------
> > use LWP::Simple;
> > $contents =3D get("https://www.butler.edu/boa/default.aspx");
> > ---------------------
> > the perl process never returns.
> >
> > lwp version: "VERSION: 6.06"
> >
> > Summary of my perl5 (revision 5 version 18 subversion 2) configuration:
> >   Platform:
> >     osname=3DMSWin32, osvers=3D6.2, archname=3DMSWin32-x64-multi-thread
> >     uname=3D'Win32 strawberry-perl 5.18.2.1 #1 Tue Jan  7 22:32:35 2014
> x64'
> >
> > Best Regards
> > Jesper Persson
>
>
>
> --
>
> -dom
>
> --
>
> Daniel de Oliveira Mantovani
> Business Analytic Specialist
> Perl Evangelist /Astrophysics hobbyist.
> +55 11 9 8538-9897
> XOXO
>

--001a11c16db431620004f9ebe791
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div>this perl code</div><div>----------------------------=
--------------</div><div>use LWP::Simple qw($ua get);</div><div>$ua-&gt;tim=
eout(5);</div><div>$ENV{PERL_LWP_SSL_VERIFY_HOSTNAME} =3D 0;</div><div>$con=
tents =3D get(&quot;<a href=3D"https://www.butler.edu/boa/default.aspx">htt=
ps://www.butler.edu/boa/default.aspx</a>&quot;);</div>

<div>------------------------------------------</div><div><br></div><div>ju=
st tried fresh perl installs.</div><div><br></div><div>strawberry perl <a h=
ref=3D"http://5.16.3.1">5.16.3.1</a>: =C2=A0doesnt hang.</div><div><br></di=
v>
<div>
strawberry perl <a href=3D"http://5.18.0.1">5.18.0.1</a>: =C2=A0doesnt hang=
.</div><div><br></div><div>strawberry perl <a href=3D"http://5.18.1.1">5.18=
.1.1</a>: =C2=A0doesnt hang.</div><div><br></div><div>strawberry perl <a hr=
ef=3D"http://5.18.2.1">5.18.2.1</a>: =C2=A0hangs.</div>

<div><br></div><div>strawberry perl <a href=3D"http://5.18.2.2">5.18.2.2</a=
>: =C2=A0hangs.</div><div><br></div><div>/Jesper</div></div><div class=3D"g=
mail_extra"><br><br><div class=3D"gmail_quote">On 21 May 2014 14:12, Daniel=
 de Oliveira Mantovani <span dir=3D"ltr">&lt;<a href=3D"mailto:daniel.olive=
[email protected]" target=3D"_blank">daniel.oliveira.mantovani@gmail.=
com</a>&gt;</span> wrote:<br>

<blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1p=
x #ccc solid;padding-left:1ex">Hi, Jesper. It&#39;s happen because it shoul=
d happen. You don&#39;t have the<br>
error because you are not handle error.<br>
<br>
This happen because LWP has a timeout to wait the server response,<br>
after this timeout it will return a timeout error. In your case, you<br>
don&#39;t handle the error the only stuff you get is nothing.<br>
<br>
This URL &quot;<a href=3D"https://www.butler.edu/boa/default.aspx" target=
=3D"_blank">https://www.butler.edu/boa/default.aspx</a>&quot; has two probl=
ems:<br>
<br>
1 - The certificate authority is not trusted<br>
2 - Never (i.e until timeout) response to the client<br>
<br>
If you are inside an intranet and you can access this site from your<br>
browser and you know ins&#39;t cache. Start handle with error, and show it<=
br>
to us.<br>
<br>
To avoid &quot;certificate authority not trusted&quot; you can use:<br>
<br>
BEGIN {<br>
=C2=A0 =C2=A0 $ENV{PERL_LWP_SSL_VERIFY_HOSTNAME} =3D 0;<br>
}<br>
<br>
<br>
Lab:~ danielmantovani$ wget &quot;<a href=3D"https://www.butler.edu/boa/def=
ault.aspx" target=3D"_blank">https://www.butler.edu/boa/default.aspx</a>&qu=
ot;<br>
--2014-05-21 09:04:08-- =C2=A0<a href=3D"https://www.butler.edu/boa/default=
.aspx" target=3D"_blank">https://www.butler.edu/boa/default.aspx</a><br>
Resolving <a href=3D"http://www.butler.edu" target=3D"_blank">www.butler.ed=
u</a> (<a href=3D"http://www.butler.edu" target=3D"_blank">www.butler.edu</=
a>)... 159.242.130.240<br>
Connecting to <a href=3D"http://www.butler.edu" target=3D"_blank">www.butle=
r.edu</a> (<a href=3D"http://www.butler.edu" target=3D"_blank">www.butler.e=
du</a>)|159.242.130.240|:443... connected.<br>
ERROR: The certificate of =E2=80=98<a href=3D"http://www.butler.edu" target=
=3D"_blank">www.butler.edu</a>=E2=80=99 is not trusted.<br>
ERROR: The certificate of =E2=80=98<a href=3D"http://www.butler.edu" target=
=3D"_blank">www.butler.edu</a>=E2=80=99 hasn&#39;t got a known issuer.<br>
<br>
Lab:~ danielmantovani$ wget &quot;<a href=3D"https://www.butler.edu/boa/def=
ault.aspx" target=3D"_blank">https://www.butler.edu/boa/default.aspx</a>&qu=
ot;<br>
--no-check-certificate<br>
--2014-05-21 09:04:39-- =C2=A0<a href=3D"https://www.butler.edu/boa/default=
.aspx" target=3D"_blank">https://www.butler.edu/boa/default.aspx</a><br>
Resolving <a href=3D"http://www.butler.edu" target=3D"_blank">www.butler.ed=
u</a> (<a href=3D"http://www.butler.edu" target=3D"_blank">www.butler.edu</=
a>)... 159.242.130.240<br>
Connecting to <a href=3D"http://www.butler.edu" target=3D"_blank">www.butle=
r.edu</a> (<a href=3D"http://www.butler.edu" target=3D"_blank">www.butler.e=
du</a>)|159.242.130.240|:443... connected.<br>
WARNING: The certificate of =E2=80=98<a href=3D"http://www.butler.edu" targ=
et=3D"_blank">www.butler.edu</a>=E2=80=99 is not trusted.<br>
WARNING: The certificate of =E2=80=98<a href=3D"http://www.butler.edu" targ=
et=3D"_blank">www.butler.edu</a>=E2=80=99 hasn&#39;t got a known issuer.<br=
>
HTTP request sent, awaiting response... Read error (Success.) in headers.<b=
r>
Retrying.<br>
<div class=3D"HOEnZb"><div class=3D"h5"><br>
On 21 May 2014 05:37, Jesper Persson &lt;<a href=3D"mailto:jesper.j.persson=
@gmail.com">[email protected]</a>&gt; wrote:<br>
&gt; ---------------------<br>
&gt; use LWP::Simple;<br>
&gt; $contents =3D get(&quot;<a href=3D"https://www.butler.edu/boa/default.=
aspx" target=3D"_blank">https://www.butler.edu/boa/default.aspx</a>&quot;);=
<br>
&gt; ---------------------<br>
&gt; the perl process never returns.<br>
&gt;<br>
&gt; lwp version: &quot;VERSION: 6.06&quot;<br>
&gt;<br>
&gt; Summary of my perl5 (revision 5 version 18 subversion 2) configuration=
:<br>
&gt; =C2=A0 Platform:<br>
&gt; =C2=A0 =C2=A0 osname=3DMSWin32, osvers=3D6.2, archname=3DMSWin32-x64-m=
ulti-thread<br>
&gt; =C2=A0 =C2=A0 uname=3D&#39;Win32 strawberry-perl 5.18.2.1 #1 Tue Jan =
=C2=A07 22:32:35 2014 x64&#39;<br>
&gt;<br>
&gt; Best Regards<br>
&gt; Jesper Persson<br>
<br>
<br>
<br>
</div></div><span class=3D"HOEnZb"><font color=3D"#888888">--<br>
<br>
-dom<br>
<br>
--<br>
<br>
Daniel de Oliveira Mantovani<br>
Business Analytic Specialist<br>
Perl Evangelist /Astrophysics hobbyist.<br>
<a href=3D"tel:%2B55%2011%209%208538-9897" value=3D"+5511985389897">+55 11 =
9 8538-9897</a><br>
XOXO<br>
</font></span></blockquote></div><br></div>

--001a11c16db431620004f9ebe791--