comparison lib/https.c @ 173:4c288d05b26a

2003-6-8 Brian Masney <masneyb@gftp.org> * lib/bookmark.c lib/gftp.h lib/https.c lib/local.c lib/misc.c lib/protocols.c lib/rfc2068.c lib/rfc959.c lib/sshv2.c src/text/gftp-text.c src/gtk/gftp-gtk.c - made the init function for all the protocols return an integer instead of nothing. If there was an error setting up the protocol, GFTP_EFATAL should be returned and the connection should be aborted. The HTTPS protocol uses this to return if SSL support was not compiled in * lib/protocols.c src/text/gftp-text.c src/gtk/dnd.c src/gtk/gftp-gtk.c src/gtk/menu-items.c - have gftp_parse_url() log the error messages to the user. This shouldn't have been done in the individual ports * lib/https.c - only initialize the SSL engine the first time a SSL connection is made.
author masneyb
date Mon, 09 Jun 2003 00:53:20 +0000
parents d40f9db52cdf
children e643d287fe32
comparison
equal deleted inserted replaced
172:9273b56e7529 173:4c288d05b26a
52 #endif 52 #endif
53 53
54 void 54 void
55 https_register_module (void) 55 https_register_module (void)
56 { 56 {
57 #ifdef USE_SSL
58 gftp_ssl_startup (NULL); /* FIXME - take out of here */
59 #endif
60 } 57 }
61 58
62 59
63 void 60 int
64 https_init (gftp_request * request) 61 https_init (gftp_request * request)
65 { 62 {
66 #ifdef USE_SSL 63 #ifdef USE_SSL
67 rfc2068_params * params; 64 rfc2068_params * params;
65 int ret;
68 66
69 g_return_if_fail (request != NULL); 67 g_return_val_if_fail (request != NULL, GFTP_EFATAL);
70 68
71 gftp_protocols[GFTP_HTTP_NUM].init (request); 69 if ((ret = gftp_protocols[GFTP_HTTP_NUM].init (request)) < 0)
70 return (ret);
71
72 params = request->protocol_data; 72 params = request->protocol_data;
73 request->init = https_init; 73 request->init = https_init;
74 request->post_connect = gftp_ssl_session_setup; 74 request->post_connect = gftp_ssl_session_setup;
75 params->real_read_function = gftp_ssl_read; 75 params->real_read_function = gftp_ssl_read;
76 request->write_function = gftp_ssl_write; 76 request->write_function = gftp_ssl_write;
77 request->get_next_file = https_get_next_file; 77 request->get_next_file = https_get_next_file;
78 request->url_prefix = g_strdup ("https"); 78 request->url_prefix = g_strdup ("https");
79
80 if ((ret = gftp_ssl_startup (NULL)) < 0)
81 return (ret);
82
83 return (0);
79 #else 84 #else
80 gftp_protocols[GFTP_HTTP_NUM].init (request); 85 request->logging_function (gftp_logging_error, request->user_data,
86 _("HTTPS Support unavailable since SSL support was not compiled in. Aborting connection.\n"));
81 87
82 request->logging_function (gftp_logging_error, request->user_data, 88 return (GFTP_EFATAL);
83 _("HTTPS Support unavailable since SSL support was not compiled in. Reverting back to plaintext\n"));
84 #endif 89 #endif
85 } 90 }
86 91