Some OpenSSL frobbing
authorAdam Chlipala <adamc@hcoop.net>
Sat, 16 Jun 2007 21:34:48 +0000 (21:34 +0000)
committerAdam Chlipala <adamc@hcoop.net>
Sat, 16 Jun 2007 21:34:48 +0000 (21:34 +0000)
openssl/openssl_sml.c
openssl/openssl_sml.h
src/main.sml
src/openssl.sml

index fc82769..407e74f 100644 (file)
@@ -24,6 +24,10 @@ int OpenSSL_SML_get_error() {
   return ERR_get_error();
 }
 
+int OpenSSL_SML_should_retry(BIO *b) {
+  return BIO_should_retry(b);
+}
+
 const char *OpenSSL_SML_lib_error_string(int err) {
   return ERR_lib_error_string(err);
 }
index 0568d29..3d5cd46 100644 (file)
@@ -7,6 +7,7 @@ void OpenSSL_SML_load_error_strings(void);
 void OpenSSL_SML_load_BIO_strings(void);
 
 int OpenSSL_SML_get_error(void);
+int OpenSSL_SML_should_retry(BIO *b);
 const char *OpenSSL_SML_lib_error_string(int err);
 const char *OpenSSL_SML_func_error_string(int err);
 const char *OpenSSL_SML_reason_error_string(int err);
index 798ede2..fd4ff63 100644 (file)
@@ -942,8 +942,9 @@ fun service () =
                             (print msgLocal;
                              print "\n";
                              Msg.send (bio, MsgOk)))
-                        handle OpenSSL.OpenSSL _ =>
-                               print "OpenSSL error\n"
+                        handle e as (OpenSSL.OpenSSL s) =>
+                               (print "OpenSSL error\n";
+                                app (fn x => print (x ^ "\n")) (SMLofNJ.exnHistory e))
                              | OS.SysErr (s, _) =>
                                (print "System error: ";
                                 print s;
@@ -1268,8 +1269,9 @@ fun service () =
                in
                    cmdLoop ()
                end
-                   handle OpenSSL.OpenSSL s =>
+                   handle e as (OpenSSL.OpenSSL s) =>
                           (print ("OpenSSL error: " ^ s ^ "\n");
+                           app (fn x => print (x ^ "\n")) (SMLofNJ.exnHistory e);
                            OpenSSL.close bio
                            handle OpenSSL.OpenSSL _ => ();
                            loop ())
index 3f3b292..df63276 100644 (file)
@@ -45,16 +45,15 @@ fun ssl_err s =
        else
            (print (ZString.toML lib);
             print ":");
-           if C.Ptr.isNull func then
-               ()
-           else
-               (print (ZString.toML func);
-                print ":");
-               if C.Ptr.isNull reason then
-                   ()
-               else
-                   print (ZString.toML reason);
-               print "\n"
+       if C.Ptr.isNull func then
+           ()
+       else
+           (print (ZString.toML func);
+            print ":");
+       if C.Ptr.isNull reason then
+           ()
+       else
+           print (ZString.toML reason)
     end
 
 val readBuf : (C.uchar, C.rw) C.obj C.ptr' = C.alloc' C.S.uchar (Word.fromInt Config.bufSize)