changeset 424:479f5df04b37

- Switched SSL enabled to configure.in (./configure --enable-ssl)
author jcid
date Thu, 16 Oct 2008 22:40:54 +0200
parents f97878292f1b
children 9f6eecbbf37a
files ChangeLog configure.in dpi/https.c src/form.cc
diffstat 4 files changed, 23 insertions(+), 35 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Thu Oct 16 22:30:04 2008 +0200
+++ b/ChangeLog	Thu Oct 16 22:40:54 2008 +0200
@@ -11,6 +11,8 @@
  - Tuned input width a bit.
  - Resource embed cleanup (forms)
    Patches: place (AKA corvid)
++- Switched SSL enabled to configure.in (./configure --enable-ssl)
+   Patch: Jeremy Henty
 
 dw
 
--- a/configure.in	Thu Oct 16 22:30:04 2008 +0200
+++ b/configure.in	Thu Oct 16 22:40:54 2008 +0200
@@ -21,6 +21,8 @@
                     , enable_insure=no)
 AC_ARG_ENABLE(ansi,   [  --enable-ansi           Try to compile and run with ANSI flags],
                     , enable_ansi=no)
+AC_ARG_ENABLE(ssl,    [  --enable-ssl            Enable ssl features (eg. https)],
+                    , enable_ssl=no)
 AC_ARG_ENABLE(ipv6,   [  --enable-ipv6           Build with support for IPv6], , )
 AC_ARG_ENABLE(cookies,[  --disable-cookies       Don't compile support for cookies],
                     , enable_cookies=yes)
@@ -30,8 +32,6 @@
               enable_jpeg=$enableval, enable_jpeg=yes)
 AC_ARG_ENABLE(gif,    [  --disable-gif           Disable support for GIF images],
               enable_gif=$enableval, enable_gif=yes)
-AC_ARG_ENABLE(ssl,    [  --disable-ssl           Disable ssl features (eg. https)], 
-              enable_ssl=$enableval, enable_ssl=yes)
 AC_ARG_ENABLE(threaded-dns,[  --disable-threaded-dns  Disable the advantage of a reentrant resolver library],
               enable_threaded_dns=$enableval, enable_threaded_dns=yes)
 AC_ARG_ENABLE(rtfl,   [  --enable-rtfl           Build with rtfl messages])
@@ -288,6 +288,7 @@
 
   if test "x$ssl_ok" = "xyes"; then
     LIBSSL_LIBS="-lcrypto -lssl"
+    AC_MSG_WARN([*** Enabling ssl support. THIS IS ALPHA CODE!***])
   else
     AC_MSG_WARN([*** No libssl found. Disabling ssl support.***])
   fi
--- a/dpi/https.c	Thu Oct 16 22:30:04 2008 +0200
+++ b/dpi/https.c	Thu Oct 16 22:40:54 2008 +0200
@@ -68,8 +68,6 @@
 #define MSG(...)  printf("[https dpi]: " __VA_ARGS__)
 
 
-#define ENABLE_SSL
-#undef ENABLE_SSL
 #ifdef ENABLE_SSL
 
 #include <openssl/ssl.h>
@@ -663,8 +661,8 @@
       "<b>}</b>\n\n"
       "  <b>*** Dillo's prototype plugin for https support"
       " is disabled now ***</b>\n\n"
-      "  If you want to test this <b>alpha</b> support code, just remove\n"
-      "  line 72 from dpi/https.c, recompile and reinstall.\n\n"
+      "  If you want to test this <b>alpha</b> support code, just\n"
+      "  reconfigure with --enable-ssl, recompile and reinstall.\n\n"
       "  (beware that this https support is very limited now)\n\n"
       "  To use https and SSL, you must have \n"
       "  the OpenSSL development libraries installed.  Check your\n"
--- a/src/form.cc	Thu Oct 16 22:30:04 2008 +0200
+++ b/src/form.cc	Thu Oct 16 22:40:54 2008 +0200
@@ -401,6 +401,7 @@
 void Html_tag_open_input(DilloHtml *html, const char *tag, int tagsize)
 {
    DilloHtmlInputType inp_type;
+   Resource *resource = NULL;
    Embed *embed = NULL;
    char *value, *name, *type, *init_str;
    const char *attrbuf, *label;
@@ -429,13 +430,11 @@
       inp_type = DILLO_HTML_INPUT_PASSWORD;
       attrbuf = a_Html_get_attr(html, tag, tagsize, "size");
       int size = Html_input_get_size(html, attrbuf);
-      EntryResource *entryResource = factory->createEntryResource (size, true);
-      embed = new Embed (entryResource);
+      resource = factory->createEntryResource (size, true);
       init_str = value;
    } else if (!dStrcasecmp(type, "checkbox")) {
       inp_type = DILLO_HTML_INPUT_CHECKBOX;
-      CheckButtonResource *check_b_r=factory->createCheckButtonResource(false);
-      embed = new Embed (check_b_r);
+      resource = factory->createCheckButtonResource(false);
       init_val = (a_Html_get_attr(html, tag, tagsize, "checked") != NULL);
       init_str = (value) ? value : dStrdup("on");
    } else if (!dStrcasecmp(type, "radio")) {
@@ -444,8 +443,7 @@
       DilloHtmlInput *input = Html_get_radio_input(html, name);
       if (input)
          rb_r = (RadioButtonResource*) input->embed->getResource();
-      rb_r = factory->createRadioButtonResource(rb_r, false);
-      embed = new Embed (rb_r);
+      resource = factory->createRadioButtonResource(rb_r, false);
       init_val = (a_Html_get_attr(html, tag, tagsize, "checked") != NULL);
       init_str = value;
    } else if (!dStrcasecmp(type, "hidden")) {
@@ -454,16 +452,12 @@
    } else if (!dStrcasecmp(type, "submit")) {
       inp_type = DILLO_HTML_INPUT_SUBMIT;
       init_str = (value) ? value : dStrdup("submit");
-      LabelButtonResource *label_b_r =
-         factory->createLabelButtonResource(init_str);
-      embed = new Embed (label_b_r);
+      resource = factory->createLabelButtonResource(init_str);
 //    gtk_widget_set_sensitive(widget, FALSE); /* Until end of FORM! */
    } else if (!dStrcasecmp(type, "reset")) {
       inp_type = DILLO_HTML_INPUT_RESET;
       init_str = (value) ? value : dStrdup("Reset");
-      LabelButtonResource *label_b_r =
-         factory->createLabelButtonResource(init_str);
-      embed = new Embed (label_b_r);
+      resource = factory->createLabelButtonResource(init_str);
 //    gtk_widget_set_sensitive(widget, FALSE); /* Until end of FORM! */
    } else if (!dStrcasecmp(type, "image")) {
       if (URL_FLAGS(html->base_url) & URL_SpamSafe) {
@@ -472,9 +466,7 @@
          attrbuf = a_Html_get_attr(html, tag, tagsize, "alt");
          label = attrbuf ? attrbuf : value ? value : name ? name : "Submit";
          init_str = dStrdup(label);
-         LabelButtonResource *label_b_r =
-            factory->createLabelButtonResource(init_str);
-         embed = new Embed (label_b_r);
+         resource = factory->createLabelButtonResource(init_str);
 //       gtk_widget_set_sensitive(widget, FALSE); /* Until end of FORM! */
       } else {
          inp_type = DILLO_HTML_INPUT_IMAGE;
@@ -501,30 +493,29 @@
       if (valid) {
          inp_type = DILLO_HTML_INPUT_FILE;
          init_str = dStrdup("File selector");
-         LabelButtonResource *lbr=factory->createLabelButtonResource(init_str);
-         embed = new Embed (lbr);
+         resource = factory->createLabelButtonResource(init_str);
       }
    } else if (!dStrcasecmp(type, "button")) {
       inp_type = DILLO_HTML_INPUT_BUTTON;
       if (value) {
          init_str = value;
-         LabelButtonResource *label_b_r =
-            factory->createLabelButtonResource(init_str);
-         embed = new Embed (label_b_r);
+         resource = factory->createLabelButtonResource(init_str);
       }
    } else if (!dStrcasecmp(type, "text") || !*type) {
       /* Text input, which also is the default */
       inp_type = DILLO_HTML_INPUT_TEXT;
       attrbuf = a_Html_get_attr(html, tag, tagsize, "size");
       int size = Html_input_get_size(html, attrbuf);
-      EntryResource *entryResource = factory->createEntryResource(size, false);
-      embed = new Embed (entryResource);
+      resource = factory->createEntryResource(size, false);
       init_str = value;
    } else {
       /* Unknown input type */
       BUG_MSG("Unknown input type: \"%s\"\n", type);
    }
 
+   if (resource)
+      embed = new Embed (resource);
+
    if (inp_type != DILLO_HTML_INPUT_UNKNOWN) {
       Html_add_input(html, inp_type, embed, name,
                      (init_str) ? init_str : "", init_val);
@@ -534,10 +525,8 @@
        inp_type != DILLO_HTML_INPUT_UNKNOWN) {
       if (inp_type == DILLO_HTML_INPUT_TEXT ||
           inp_type == DILLO_HTML_INPUT_PASSWORD) {
-         EntryResource *entryres = (EntryResource*)embed->getResource();
-         /* Readonly or not? */
          if (a_Html_get_attr(html, tag, tagsize, "readonly"))
-            entryres->setEditable(false);
+            ((EntryResource *) resource)->setEditable(false);
 
 //       /* Maximum length of the text in the entry */
 //       if ((attrbuf = a_Html_get_attr(html, tag, tagsize, "maxlength")))
@@ -884,9 +873,8 @@
       page->setStyle (style);
 
       ResourceFactory *factory = HT2LT(html)->getResourceFactory();
-      ComplexButtonResource *complex_b_r =
-         factory->createComplexButtonResource(page, true);
-      embed = new Embed(complex_b_r);
+      Resource *resource = factory->createComplexButtonResource(page, true);
+      embed = new Embed(resource);
 // a_Dw_button_set_sensitive (DW_BUTTON (button), FALSE);
 
       DW2TB(html->dw)->addParbreak (5, style);
@@ -1940,7 +1928,6 @@
          a_Url_free(url);
       }
    }
-
    if (!button)
       MSG("Html_input_image: unable to create image submit.\n");
    return button;