From: SF/projects/mingw n. l. <min...@li...> - 2011-01-14 20:44:41
|
Bugs item #3147803, was opened at 2010-12-29 21:17 Message generated for change (Comment added) made by pingbak You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=102435&aid=3147803&group_id=2435 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: MinGW Installer Group: Known Feature Status: Open Resolution: None Priority: 3 Private: No Submitted By: Mike Hudson (belgarionthekin) Assigned to: Keith Marshall (keithmarshall) Summary: No error message on failed download Initial Comment: I apologize if this is a duplicate bug. I spent over 20 minutes wondering why I couldn't use MinGW. Finally it dawned on me. The download of the files with mingw-get failed because I am behind a corporate firewall/proxy that requires authentication. EVERYTHING that wants to connect to the internet needs to authenticate to the proxy. All the browsers pop up an authentication window so I can put in my creds. The problem is that the mingw-get window's messages flew by so fast that I couldn't see what was said. Then, the shell window just went away and I couldn't scroll up to see the errors. I was able to connect to a different network to download the proper file, but it would have been nice to know that I needed to 20 minutes ago. ---------------------------------------------------------------------- Comment By: Scott Michel (pingbak) Date: 2011-01-14 20:44 Message: The patch (there has to be a place to upload this...) diff -r -U3 -x '*~' -x '*.o' -x '*.d' mingw-get-0.1-original/src/dmh.cpp mingw-get-0.1/src/dmh.cpp --- mingw-get-0.1-original/src/dmh.cpp 2010-10-05 00:13:27 -0700 +++ mingw-get-0.1/src/dmh.cpp 2011-01-14 11:28:35 -0800 @@ -201,7 +201,9 @@ /* Display arbitrary text messages via the diagnostic message handler; * for the TTY subsystem, this is equivalent to printf() on stderr. */ - return vfprintf( stderr, fmt, argv ); + int retval = vfprintf( stderr, fmt, argv ); + fflush( stderr ); + return retval; } EXTERN_C uint16_t dmh_control( const uint16_t request, const uint16_t mask ) diff -r -U3 -x '*~' -x '*.o' -x '*.d' mingw-get-0.1-original/src/pkginet.cpp mingw-get-0.1/src/pkginet.cpp --- mingw-get-0.1-original/src/pkginet.cpp 2010-03-30 13:29:26 -0700 +++ mingw-get-0.1/src/pkginet.cpp 2011-01-14 12:34:03 -0800 @@ -25,11 +25,14 @@ * */ #define WIN32_LEAN_AND_MEAN +/* Make GetConsoleWindow visible */ +#define _WIN32_WINNT 0x0500 #include <unistd.h> #include <stdlib.h> #include <string.h> #include <wininet.h> +#include <wincon.h> #include <errno.h> #include "dmh.h" @@ -86,7 +89,40 @@ ( "MinGW Installer", INTERNET_OPEN_TYPE_PRECONFIG, NULL, NULL, 0 ); - return InternetOpenUrl( SessionHandle, URL, NULL, 0, 0, 0 ); + + /* + * Some care must be taken here to account for authenticating proxies. Using an existing + * connection to a HTTP server gets around the need to repeatedly authenticate. + */ + DWORD urlFlags = INTERNET_FLAG_EXISTING_CONNECT; + HINTERNET urlHandle = InternetOpenUrl( SessionHandle, URL, NULL, 0, urlFlags, 0 ); + + if ( urlHandle != NULL ) { + DWORD lastError = GetLastError(); + DWORD status = QueryStatus( urlHandle ); + if ( status == HTTP_STATUS_PROXY_AUTH_REQ ) { + BOOL exitLoop = FALSE; + while ( exitLoop == FALSE ) { + DWORD dwError = InternetErrorDlg(GetConsoleWindow(), urlHandle, lastError, + FLAGS_ERROR_UI_FILTER_FOR_ERRORS | + FLAGS_ERROR_UI_FLAGS_CHANGE_OPTIONS | + FLAGS_ERROR_UI_FLAGS_GENERATE_DATA, + NULL); + + if ( dwError == ERROR_INTERNET_FORCE_RETRY ) { + BOOL httpReq = HttpSendRequest( urlHandle, NULL, 0, 0, 0 ); + + lastError = GetLastError(); + status = QueryStatus( urlHandle ); + if ( httpReq == TRUE && status == HTTP_STATUS_OK ) + exitLoop = TRUE; + } else + exitLoop = TRUE; + } + } + } + + return urlHandle; } inline DWORD QueryStatus( HINTERNET id ) { ---------------------------------------------------------------------- Comment By: Scott Michel (pingbak) Date: 2011-01-14 20:42 Message: I've enclosed a patch that deals with authenticating proxies. I, like the original reporter, live behind an authenticating corporate firewall. Frankly, I'm not sure that this patch is stylistically where mingw-get would want to perform proxy authentication (i.e., getting InternetErrorDlg to pop up the window and prompt for credentials), but for an initial working patch, it does the job. Also, it's helpful to flush stderr in dmh->notify() because stderr is not line buffered, at least under mintty. ---------------------------------------------------------------------- Comment By: Mike Hudson (belgarionthekin) Date: 2011-01-11 15:25 Message: Thanks for your response Keith. A little background on my proxy. The method used in the installer might have worked with the old way the proxy works, but not the new way. Old way: The domain and realm were always the same. One login would authenticate to everything. New way: The domain isn't always, the same, but the realm has some uniformity. I keep having to authenticate on pages that I've already received, like when flash ads or flash vids come up and request content from other sites. I'm not 100% sure why this is, but it's pretty annoying. I don't normally use IE but I have saved my proxy creds so I don't have to fill them in every time in IE. I'd be willing to test things and give you log files if/when you get around to this. ---------------------------------------------------------------------- Comment By: Keith Marshall (keithmarshall) Date: 2011-01-08 23:30 Message: Thank you for the report; I am aware of some download issues, but a formal bug report does no harm. You actually raise three separate, (although somewhat related issues):-- 1) If downloads are blocked by a firewall, then presumably that's because the firewall has been configured to block the host domain; it's doing its intended job, and we can do nothing to work around it. (I don't think this is the problem, in your case). 2) Currently, mingw-get supports only one mechanism for authenticating to a proxy -- the Windows standard method where the credentials for each user are preconfigured, (e.g. by Internet Explorer setup), and recorded in the registry. That method works absolutely fine for me, behind the authenticating Squid proxy in my place of work; apparently it doesn't work for you, so you must be faced by a more draconian proxy configuration than I am. Ultimately, I would like to be able to support users with more difficult proxy configurations, but since I cannot reproduce your problem myself, I may need some assistance with specifying, coding and testing the alternatives. In the present alpha phase of development, this isn't a high priority for me, but I will willingly consider patches. 3) mingw-get's diagnostics, particularly those related to download issues, could be improved; in some respects, there is too much informational noise, while some more serious issues may not be adequately reported. This is on my to-do list, but again, it isn't my highest priority at present. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=102435&aid=3147803&group_id=2435 |