Modify the s_client code to NOT disconnect when end-of-input is reached
from stdin. Then, using this modified client, you can create a file
with the "GET /document.html HTTP/1.0<cr><ctr>" in it, and do a simple
redirection

   $data = `openssl s_client -connect remote.com:443 <datafile`;

The problem with the existing s_client is that it shuts down as
soon as it detects EOF. When running interactively, that's fine.
But when running from command line, the connection is shut down
before the response ever has a chance of arriving.

The change in apps/s_client.c, look for

                       if ((!c_quiet) && ((i <= 0) || (cbuf[0] == 'Q')))
                                {
                                BIO_printf(bio_err,"DONE\n");
                                goto shut;
                                }

What we've done in the past is simply add a flag indicating that the
input stream is closed (e.g. STDIN_closed=true;),

Then, earlier on in the same file, where it sets the file descriptor
for the select, modify the "if (read_tty)"  to be
"if (read_tty && !STDIN_closed)". Finally, make sure you initialize
STDIN_closed to false initially.

                       if (tty_on)
                                {
                                if (read_tty) 
FD_SET(fileno(stdin),&readfds);
                                if (write_tty)
FD_SET(fileno(stdout),&writefds);
                                }

Hope this helps.

(Hope I didn't overlook an already existing capability. I'd feel pretty
dumb
if there was one that I missed!)

Cheers, Thomas 

Azrael wrote:
> 
> hi
> 
> i want to read remote data from other ssl server using perl or others.
> (without any package)
> openssl s_client -connect remote.com:443
> opens connection to host and waits for GET /document.html HTTP/1.0 and
> 2 Enters.
> 
> how can i read data from remote page using one command?
>  $data = `openssl s_client -connect remote.com:443 blahblah blah`;
>  or ..........
>  thanks
> 
> --
> Best regards,
>  Denaturalist                            mailto:[EMAIL PROTECTED]
> 
> ______________________________________________________________________
> OpenSSL Project                                 http://www.openssl.org
> User Support Mailing List                    [EMAIL PROTECTED]
> Automated List Manager                           [EMAIL PROTECTED]

-- 
------------------------------------------------------------
Thomas Reinke                            Tel: (905) 331-2260
Director of Technology                   Fax: (905) 331-2504
E-Soft Inc.                         http://www.e-softinc.com
Publishers of SecuritySpace     http://www.securityspace.com
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    [EMAIL PROTECTED]
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to