diff options
author | Gerald Combs <gerald@wireshark.org> | 2010-08-26 18:14:37 +0000 |
---|---|---|
committer | Gerald Combs <gerald@wireshark.org> | 2010-08-26 18:14:37 +0000 |
commit | e023211f67a2e4df52a73d79eb27669a1ad21987 (patch) | |
tree | 19670432f487d6b1fb33df2e6223a597550b0378 | |
parent | fbe43057c25346d9d2c325b02b72250b17817466 (diff) | |
download | wireshark-e023211f67a2e4df52a73d79eb27669a1ad21987.tar.gz wireshark-e023211f67a2e4df52a73d79eb27669a1ad21987.tar.bz2 wireshark-e023211f67a2e4df52a73d79eb27669a1ad21987.zip |
Fix line endings.
svn path=/trunk-1.0/; revision=33937
-rw-r--r-- | nio-ie5.c | 112 |
1 files changed, 56 insertions, 56 deletions
@@ -18,61 +18,61 @@ Internet Explorer version 5 DLLs. To use this method, the user must already have installed and configured IE5. */ -#include "windows.h"
-#include <wininet.h>
-#include "nio-ie5.h"
-
-#include "glib.h"
+#include "windows.h" +#include <wininet.h> +#include "nio-ie5.h" -static HINTERNET internet = 0;
-
+#include "glib.h" +static HINTERNET internet = 0; -netio_ie5_t * + + +netio_ie5_t * netio_ie5_connect (char const *url) { int resend = 0; - DWORD type, type_s;
- netio_ie5_t * netio_ie5_conn;
- DWORD dw_ret;
- DWORD flags =
- /* INTERNET_FLAG_DONT_CACHE |*/
- INTERNET_FLAG_KEEP_CONNECTION |
- INTERNET_FLAG_PRAGMA_NOCACHE |
- INTERNET_FLAG_RELOAD |
- INTERNET_FLAG_NO_CACHE_WRITE |
- INTERNET_FLAG_EXISTING_CONNECT | INTERNET_FLAG_PASSIVE;
-
+ DWORD type, type_s; + netio_ie5_t * netio_ie5_conn; + DWORD dw_ret; + DWORD flags = + /* INTERNET_FLAG_DONT_CACHE |*/ + INTERNET_FLAG_KEEP_CONNECTION | + INTERNET_FLAG_PRAGMA_NOCACHE | + INTERNET_FLAG_RELOAD | + INTERNET_FLAG_NO_CACHE_WRITE | + INTERNET_FLAG_EXISTING_CONNECT | INTERNET_FLAG_PASSIVE; + if (internet == 0) { HINSTANCE h = LoadLibrary ("wininet.dll"); if (!h) - {
+ { /* XXX - how to return an error code? */ g_warning("Failed to load wininet.dll"); return NULL; - }
- /* pop-up dialup dialog box */
- /* XXX - do we need the dialup box or simply don't attempt an update in this case? */
+ } + /* pop-up dialup dialog box */ + /* XXX - do we need the dialup box or simply don't attempt an update in this case? */ dw_ret = InternetAttemptConnect (0); - if (dw_ret != ERROR_SUCCESS) {
- g_warning("InternetAttemptConnect failed: %u", dw_ret);
- return NULL;
+ if (dw_ret != ERROR_SUCCESS) { + g_warning("InternetAttemptConnect failed: %u", dw_ret); + return NULL; } internet = InternetOpen ("Wireshark Update", INTERNET_OPEN_TYPE_PRECONFIG, - NULL, NULL, 0);
- if(internet == NULL) {
- g_warning("InternetOpen failed %u", GetLastError());
- return NULL;
+ NULL, NULL, 0); + if(internet == NULL) { + g_warning("InternetOpen failed %u", GetLastError()); + return NULL; } } - netio_ie5_conn = g_malloc(sizeof(netio_ie5_t));
-
+ netio_ie5_conn = g_malloc(sizeof(netio_ie5_t)); + netio_ie5_conn->connection = InternetOpenUrl (internet, url, NULL, 0, flags, 0); try_again: -
+ #if 0 /* XXX - implement this option */ if (net_user && net_passwd) @@ -81,9 +81,9 @@ try_again: net_user, strlen (net_user)); InternetSetOption (connection, INTERNET_OPTION_PASSWORD, net_passwd, strlen (net_passwd)); - }
+ } #endif -
+ #if 0 /* XXX - implement this option */ if (net_proxy_user && net_proxy_passwd) @@ -92,7 +92,7 @@ try_again: net_proxy_user, strlen (net_proxy_user)); InternetSetOption (connection, INTERNET_OPTION_PROXY_PASSWORD, net_proxy_passwd, strlen (net_proxy_passwd)); - }
+ } #endif if (resend) @@ -100,25 +100,25 @@ try_again: netio_ie5_conn->connection = 0; if (!netio_ie5_conn->connection) - {
- switch(GetLastError ()) {
- case ERROR_INTERNET_EXTENDED_ERROR:
+ { + switch(GetLastError ()) { + case ERROR_INTERNET_EXTENDED_ERROR: { char buf[2000]; DWORD e, l = sizeof (buf); InternetGetLastResponseInfo (&e, buf, &l); - MessageBox (0, buf, "Internet Error", 0);
- }
+ MessageBox (0, buf, "Internet Error", 0); + } + break; + case ERROR_INTERNET_NAME_NOT_RESOLVED: + g_warning("Internet error: The servername could not be resolved"); break; - case ERROR_INTERNET_NAME_NOT_RESOLVED:
- g_warning("Internet error: The servername could not be resolved");
- break;
- case ERROR_INTERNET_CANNOT_CONNECT:
- g_warning("Internet error: Could not connect to the server");
- break;
- default:
- g_warning("Internet error: %u", GetLastError ());
- }
+ case ERROR_INTERNET_CANNOT_CONNECT: + g_warning("Internet error: Could not connect to the server"); + break; + default: + g_warning("Internet error: %u", GetLastError ()); + } return NULL; } @@ -137,8 +137,8 @@ try_again: { if (type == 401) /* authorization required */ { - netio_ie5_flush_io (netio_ie5_conn);
- /* XXX - query net_user && net_passwd from user
+ netio_ie5_flush_io (netio_ie5_conn); + /* XXX - query net_user && net_passwd from user get_auth (NULL);*/ resend = 1; goto try_again; @@ -146,20 +146,20 @@ try_again: else if (type == 407) /* proxy authorization required */ { netio_ie5_flush_io (netio_ie5_conn); - /* XXX - query net_proxy_user && net_proxy_passwd from user
+ /* XXX - query net_proxy_user && net_proxy_passwd from user get_proxy_auth (NULL);*/ resend = 1; goto try_again; } else if (type >= 300) { - g_warning("Failed with HTTP response %u", type);
+ g_warning("Failed with HTTP response %u", type); g_free(netio_ie5_conn); return NULL; } } } - + return netio_ie5_conn; } @@ -179,7 +179,7 @@ void netio_ie5_disconnect (netio_ie5_t * netio_e5_conn) { if (netio_e5_conn->connection) - InternetCloseHandle (netio_e5_conn->connection);
+ InternetCloseHandle (netio_e5_conn->connection); g_free(netio_e5_conn); } |