Mercurial > gftp.yaz
annotate lib/https.c @ 168:c505d9ba9d53
2003-6-6 Brian Masney <masneyb@gftp.org>
* lib/gftp.h - if USE_SSL is defined, include the OpenSSL headers.
Added read_function, write_function and post_connect function pointers
to gftp_request structure. Added SSL object to gftp_request structure
if USE_SSL is defined. Added protocol number and init function
declarations for the HTTPS protocol
* lib/options.h - added HTTPS to the list of supported protocols
* lib/protocols.c lib/cache.c lib/rfc2068.c lib/rfc959.c lib/sshv2.c -
renamed gftp_read(), gftp_write() and gftp_set_sockblocking() to
gftp_fd_read(), gftp_fd_write() and gftp_fd_set_sockblocking()
respectively
* lib/bookmark.c lib/local.c
* lib/misc.c lib/rfc2068.c - moved base64_encode() to misc.c
* lib/protocols.c - improved parsing of URLs. Rather than calling
gftp_read() or gftp_write() directly, call the read_function or
write_function that is set in the request structure. Expanded tabs
to spaces. Cleanup for parsing of timestamps. In
gftp_connect_server(), if a post_connect function pointer is set,
call it after we are connected to the server. Improvements to
gftp_get_line ().
* lib/httpcommon.h lib/rfc2068.c - moved rfc2068_params structure to
httpcommon.h. Fix for chunked file transfers, they were not handled
at all before. Made the I/O calls a little more generic so that we can
read from either a socket or a SSL connection.
* lib/sslcommon.c - added generic SSL layer
* lib/https.c - added support for the HTTPS protocol. It piggy backs
off of the existing HTTP support and uses the generic SSL layer
* src/gtk/bookmarks.c src/gtk/chmod_dialog.c src/gtk/gftp-gtk.c
src/gtk/menu-items.c src/gtk/misc-gtk.c src/gtk/options_dialog.c
src/gtk/view_dialog.c - set the window icon name to the gFTP <version>
* configure.in - added lib back to SUBDIRS (oops)
* lib/Makefile.am - added https.c, sslcommon.c and httpcommon.h
author | masneyb |
---|---|
date | Sun, 08 Jun 2003 15:04:40 +0000 |
parents | |
children | d40f9db52cdf |
rev | line source |
---|---|
168 | 1 /*****************************************************************************/ |
2 /* https.c - General purpose routines for the HTTPS protocol */ | |
3 /* Copyright (C) 1998-2003 Brian Masney <masneyb@gftp.org> */ | |
4 /* */ | |
5 /* This program is free software; you can redistribute it and/or modify */ | |
6 /* it under the terms of the GNU General Public License as published by */ | |
7 /* the Free Software Foundation; either version 2 of the License, or */ | |
8 /* (at your option) any later version. */ | |
9 /* */ | |
10 /* This program is distributed in the hope that it will be useful, */ | |
11 /* but WITHOUT ANY WARRANTY; without even the implied warranty of */ | |
12 /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */ | |
13 /* GNU General Public License for more details. */ | |
14 /* */ | |
15 /* You should have received a copy of the GNU General Public License */ | |
16 /* along with this program; if not, write to the Free Software */ | |
17 /* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111 USA */ | |
18 /*****************************************************************************/ | |
19 | |
20 #include "gftp.h" | |
21 #include "httpcommon.h" | |
22 | |
23 static const char cvsid[] = "$Id$"; | |
24 | |
25 static int | |
26 https_get_next_file (gftp_request * request, gftp_file * fle, int fd) | |
27 { | |
28 rfc2068_params * params; | |
29 int ret, resetptr; | |
30 | |
31 params = request->protocol_data; | |
32 if (request->cached) | |
33 { | |
34 params->real_read_function = gftp_fd_read; | |
35 request->write_function = gftp_fd_write; | |
36 resetptr = 1; | |
37 } | |
38 else | |
39 resetptr = 0; | |
40 | |
41 ret = rfc2068_get_next_file (request, fle, fd); | |
42 | |
43 if (resetptr) | |
44 { | |
45 params->real_read_function = gftp_ssl_read; | |
46 request->write_function = gftp_ssl_write; | |
47 } | |
48 | |
49 return (ret); | |
50 } | |
51 | |
52 | |
53 void | |
54 https_register_module (void) | |
55 { | |
56 gftp_ssl_startup (NULL); /* FIXME - take out of here */ | |
57 } | |
58 | |
59 | |
60 void | |
61 https_init (gftp_request * request) | |
62 { | |
63 rfc2068_params * params; | |
64 | |
65 g_return_if_fail (request != NULL); | |
66 | |
67 gftp_protocols[GFTP_HTTP_NUM].init (request); | |
68 params = request->protocol_data; | |
69 request->init = https_init; | |
70 request->post_connect = gftp_ssl_session_setup; | |
71 params->real_read_function = gftp_ssl_read; | |
72 request->write_function = gftp_ssl_write; | |
73 request->get_next_file = https_get_next_file; | |
74 request->url_prefix = g_strdup ("https"); | |
75 } | |
76 |