Skip Menu |

This queue is for tickets about the IO-Socket-SSL CPAN distribution.

Report information
The Basics
Id: 75101
Status: resolved
Priority: 0/
Queue: IO-Socket-SSL

People
Owner: Nobody in particular
Requestors: mkmetw [...] hotmail.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: Possible bug in IO::Socket:SSL - CPAN::Reporter not working with Net::HTTP 6.02
Date: Fri, 17 Feb 2012 23:12:39 +0530
To: <bug-io-socket-ssl [...] rt.cpan.org>
From: Manoj Kumar <mkmetw [...] hotmail.com>
Hi, I am using Perl 5.14.2 on Windows XP. Recently, I have updated Net::HTTP to 6.02. Since then, I have been unable to send any test report using CPAN::Reporter. This package does not have any problem when I access a local https sever (IIS), but it does not work with the CPAN Testers' metabase sever (https://metabase.cpantesters.org/api/v1/submit/CPAN-Testers-Report). I get "500 Status read failed: A connect request was made on an already connected socket". The problem appears to be coming from _set_rw_error in IO::Socket::SSL as it does not set $! variable if the variable is non-zero. $! is set to "A connect request was made on an already connected socket" during connect, so it's non-zero when _set_rw_error is called from IO::Socket::SSL::generic_read <-- IO::Socket::SSL::sysread <-- Net::HTTP::Methods::my_readline. If I change $! ||= EAGAIN; to $! = EAGAIN; I am able to submit the report. So, do you think new code is correct and acceptable or the problem lies somewhere else and needs more investigation? Regards, PS: This problem also disappears if I make the socket blocking by removing - eval { $sock->blocking(0); }; in LWP::Protocol::http::_new_socket. Summary of my perl5 (revision 5 version 14 subversion 2) configuration: Platform: osname=MSWin32, osvers=5.1, archname=MSWin32-x86-multi-thread uname='' config_args='undef' hint=recommended, useposix=true, d_sigaction=undef useithreads=define, usemultiplicity=define useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=undef use64bitint=undef, use64bitall=undef, uselongdouble=undef usemymalloc=n, bincompat5005=undef Compiler: cc='cl', ccflags ='-nologo -GF -W3 -MD -Zi -DNDEBUG -O1 -DWIN32 -D_CONSOLE -DNO_STRICT -D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE -DPERL_TEX TMODE_SCRIPTS -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS -DUSE_PERLIO', optimize='-MD -Zi -DNDEBUG -O1', cppflags='-DWIN32' ccversion='14.00.50727.762', gccversion='', gccosandvers='' intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234 d_longlong=undef, longlongsize=8, d_longdbl=define, longdblsize=8 ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='__int64', lseeksize=8 alignbytes=8, prototype=define Linker and Libraries: ld='link', ldflags ='-nologo -nodefaultlib -debug -opt:ref,icf -libpath:"D:\PROGRAMS\perl\5.14.2\lib\CORE" -machine:x86 "/manifestdependency:type='Win3 2' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'"' libpth=C:\Programs\Microsoft_Visual_Studio_8\VC\lib libs=oldnames.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib netapi32.lib uuid.lib ws2 _32.lib mpr.lib winmm.lib version.lib odbc32.lib odbccp32.lib comctl32.lib msvcrt.lib perllibs=oldnames.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib netapi32.lib uuid.lib ws2_32.lib mpr.lib winmm.lib version.lib odbc32.lib odbccp32.lib comctl32.lib msvcrt.lib libc=msvcrt.lib, so=dll, useshrplib=true, libperl=perl514.lib gnulibc_version='' Dynamic Linking: dlsrc=dl_win32.xs, dlext=dll, d_dlsymun=undef, ccdlflags=' ' cccdlflags=' ', lddlflags='-dll -nologo -nodefaultlib -debug -opt:ref,icf -libpath:"D:\PROGRAMS\perl\5.14.2\lib\CORE" -machine:x86 "/manifestdependency :type='Win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'"' Characteristics of this binary (from libperl): Compile-time options: MULTIPLICITY PERL_DONT_CREATE_GVSV PERL_IMPLICIT_CONTEXT PERL_IMPLICIT_SYS PERL_MALLOC_WRAP PERL_PRESERVE_IVUV PL_OP_SLAB_ALLOC USE_ITHREADS USE_LARGE_FILES USE_PERLIO USE_PERL_ATOF Built under MSWin32 Compiled at Feb 6 2012 19:04:45 @INC: D:/PROGRAMS/perl/site/5.14.2/lib D:/PROGRAMS/perl/5.14.2/lib .
Subject: Re: [rt.cpan.org #75101] Possible bug in IO::Socket:SSL - CPAN::Reporter not working with Net::HTTP 6.02
Date: Fri, 17 Feb 2012 20:22:01 +0100
To: Manoj Kumar via RT <bug-IO-Socket-SSL [...] rt.cpan.org>
From: Steffen Ullrich <Steffen_Ullrich [...] genua.de>
Hi Manoj, thank you for your bug report. On successful connect $! should be undef and not EISCONN, but from reading the IO::Socket source it looks like that can be the case on some platforms. So IO::Socket works around it by returning success but fails to clear $!. Would you please try the following work around? --- a/SSL.pm +++ b/SSL.pm @@ -334,6 +334,11 @@ sub connect { DEBUG(2, 'socket not yet connected' ); $self->SUPER::connect(@_) || return; DEBUG(2,'socket connected' ); + + # IO::Socket works around systems, which return EISCONN or similar + # on non-blocking re-connect by returning true, even if $! is set + # but it does not clear $!, so do it here + $! = undef; } return $self->connect_SSL; } Please let me know if this helps an I will make a new release. Regards, Steffen
CC: <behroozi [...] www.pls.uni.edu>
Subject: RE: [rt.cpan.org #75101] Possible bug in IO::Socket:SSL - CPAN::Reporter not working with Net::HTTP 6.02
Date: Sat, 18 Feb 2012 21:37:30 +0530
To: <bug-io-socket-ssl [...] rt.cpan.org>
From: Manoj Kumar <mkmetw [...] hotmail.com>
Hi Steffen, Yes, your work around is OK. I am now able to submit the test reports. Thanks. I have tested your patch with Net-HTTP-6.01, Net-HTTP-6.02 and Net-HTTP-6.03. Regards, Show quoted text
> Subject: Re: [rt.cpan.org #75101] Possible bug in IO::Socket:SSL - CPAN::Reporter not working with Net::HTTP 6.02 > From: bug-IO-Socket-SSL@rt.cpan.org > To: mkmetw@hotmail.com > CC: behroozi@www.pls.uni.edu > Date: Fri, 17 Feb 2012 14:22:33 -0500 > > <URL: https://rt.cpan.org/Ticket/Display.html?id=75101 > > > Hi Manoj, > > thank you for your bug report. > On successful connect $! should be undef and not EISCONN, but from reading the > IO::Socket source it looks like that can be the case on some platforms. > So IO::Socket works around it by returning success but fails to clear $!. > > Would you please try the following work around? > > --- a/SSL.pm > +++ b/SSL.pm > @@ -334,6 +334,11 @@ sub connect { > DEBUG(2, 'socket not yet connected' ); > $self->SUPER::connect(@_) || return; > DEBUG(2,'socket connected' ); > + > + # IO::Socket works around systems, which return EISCONN or similar > + # on non-blocking re-connect by returning true, even if $! is set > + # but it does not clear $!, so do it here > + $! = undef; > } > return $self->connect_SSL; > } > > Please let me know if this helps an I will make a new release. > > Regards, > Steffen >
Hi, a new version 1.55 is released which should fix the problem. Regards, Steffen