Blum has asked for the wisdom of the Perl Monks concerning the following question:

I have two programs in perl (see also below), one generates a login form and sent it to clients, and the other one receives the data (name and password) filled in the form when submit button is pressed. Both programs worked fine over HTTP until I moved to a new site, which is secured by SSL with a self-signed certificate. A little bit more details: 1. We checked the values of name an passwd were sent. 2. Nothing received at the end of the server. 2. If the values of some parameters in the URL were sent to the server through the URL "RecieverURL", the values would be printed. I am looking for guidance. ----- program 1: the form -------------------
print "<FORM METHOD='post' ACTION='RecieverURL'>"; print "<INPUT SIZE=20 TYPE='textbox' NAME='name' VALUE=''>"; print "<INPUT SIZE=20 TYPE='password' NAME='passwd' VALUE='' >"; print "<INPUT TYPE='submit' VALUE='submit'>"; print "</FORM>";
----- program 2: paser the submitted data ---
use vars qw(%in); ReadParse(); my $name = $in{name}; my $passwd = $in{passwd}; print "name = $name"; print "passwd = $passwd";
--------------------------------------------

Replies are listed 'Best First'.
Re: Form over HTTPS
by Anonymous Monk on Oct 30, 2014 at 10:07 UTC
Re: Form over HTTPS
by perlron (Pilgrim) on Oct 30, 2014 at 09:53 UTC

    if its a problem on the server, then u need check your webserver config for HTTPS requests.for apache webserver try to google LoadModule with SSL .
    on the HTML side, ..
    ok im not assuming anything about how experienced you are so please excuse if this is obvious to see if the values are being passed u can change the form method to GET, instead of POST.
    You would see the name=value tags in the url.
    Else even using post you can see the data Just
    by using the debugging facilities or plug-in of your favorite browser to LooK at the HTTPS GET/POST data that is being sent and that is being received.

    The temporal difficulty with perl is u need to know C well to know the awesome.else u just keep *using* it and writing inefficient code
      Hi Perlron, Thank you for your response. I think it would work if change to "GET" in instead of POST, because I tried to use URL to carry the paramets (e.g. https//www.mydomain.com/cgi-mod/program2.cgi?name=myname&passwd=mypassword), the server got the name and password and printed them out. My problem is that I need to get POST work with form, because we have more similar work (uploading data to server).

        Yes. GET Request is typically for queries to the server. You would not want to send large data sets via a GET Query.
        As was mentioned , you can also see very conveniently each POST param and header that is being transmitted in your POST request to the server .
        If u are using FF, there is a Network Tab under tools
        for Chrome its under View->Developer Tools.
        This jist of what i am saying is that first check if information is going to the server via your request.
        You have to keep the Network tab open in the first place and THEN submit the data.
        If the data is going to the server, then as i mentioned i hope your SSL config for the web server eg : Apache is setup properly.
        As far as the Server Side script is concerned, the POST Data is accessible via STDIN handle. But for ReadParse() usage you should check this link . CGI.
        Here is a really nice article on beginner CGI Programming
Re: Form over HTTPS
by noxxi (Pilgrim) on Oct 30, 2014 at 19:37 UTC

    It is really hard to get the problem from your description and without having any kind of error messages or code. But wild guess based on these information from you:

    > self-signed certificate .... Nothing received at the end of the server.

    Since the certificate is self-signed it would be normal that the connection failed because certificate validation failed (unless you add the certificate to the CA store or disable validation). Did you check that the connection succeeded? Because if it failed you would of course not get any data at the server side.

      Hi Noxxi, Thank you for your response. I think, the connection succeeded because the server responded and print out some stuff, but the uploaded data was missing -- or it didn't get them.