Hi Monks, I am trying to script an openssl s_client command which is giving different results when put into script compare it when its run directly on the client. When i run following openssl s_client command on my linux client

openssl s_client -connect 1.1.1.90:443

I am prompted to enter input. When i copy/paste following

POST / HTTP/1.1

Host: example.com

User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:36.0)Gecko/20100101 Firefox/36.0

Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8

Accept-Language: en-US,en;q=0.5

Accept-Encoding: gzip, deflate

I can see that every line is put into a different TLS/SSL record and sent to my server. But when i try to do the same using perl script, it is always sending all six lines into a single SSL record. Is there a way i can force it to send into separate records? Below is the script i am trying

#!/usr/bin/perl $| = 1; open($handle, "| openssl s_client -connect 1.1.1.90:443 -quiet"); open(file,"<","1.txt"); while (<file>){ print $handle $_,"\r\n";} close file; open(file,"<","2.txt"); while (<file>){ print $handle $_,"\r\n";} close file; open(file,"<","3.txt"); while (<file>){ print $handle $_,"\r\n";} close file; close $handle

In reply to Openssl, ssl records and perl by iThunder

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.