![]() |
![]() |
Гоша 14.09.2004 - 18:07 |
Задача - чтобы из под прокси-сервера(как с аутентификацией так и без) можно было хватать файлы из и-нета (хост ток-же как с аутентификацией так и без) Или мож кто подскажет как ручками сие сделать? |
LF 1 - 14.09.2004 - 22:15 |
Смотри WinINet functions: InternetOpen InternetConnect у них флаги как работать с прокси Вот немного статей Setting Access Types InternetOpen supports three access types: Use INTERNET_OPEN_TYPE_DIRECT if the system on which the application is running uses a direct connection to the Internet. The lpszProxyName and lpszProxyBypass parameters of InternetOpen are not used and should be set to NULL. Use INTERNET_OPEN_TYPE_PROXY if the system on which the application is running uses one or more proxy servers to access the Internet. InternetOpen uses the proxy servers indicated by lpszProxyName and bypasses the proxy for any host names or IP addresses specified by lpszProxyBypass. Use INTERNET_OPEN_TYPE_PRECONFIG to instruct your application to retrieve the configuration from the registry. INTERNET_OPEN_TYPE_PRECONFIG looks at the registry values ProxyEnable, ProxyServer, and ProxyOverride. These values are located under HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings. If ProxyEnable is zero, the application uses INTERNET_OPEN_TYPE_DIRECT. Otherwise, the application uses INTERNET_OPEN_TYPE_PROXY and uses the ProxyServer and ProxyOverride information. The WinINet functions provide support for SOCKS type proxies only if Internet Explorer is installed. The installation of Internet Explorer inсludеs the Wsock32n.dll file, which is needed to support SOCKS proxies. Wsock32n.dll is not redistributable. Listing Proxy Servers WinINet recognizes two types of proxies: CERN type proxies (HTTP only) and TIS FTP proxies (FTP only). If Internet Explorer is installed, WinINet also support SOCKS type proxies. InternetConnect assumes, by default, that the specified proxy is a CERN proxy. If the access type is set to INTERNET_OPEN_TYPE_DIRECT or INTERNET_OPEN_TYPE_PRECONFIG, the lpszProxyName parameter of InternetOpen should be set to NULL. Otherwise, the value passed to lpszProxyName must contain the proxies in a space-delimited string. The proxy listings can contain the port number that is used to access the proxy. To list a proxy for a specific protocol, the string must follow the format "<protocol><protocol>://<proxy_name>". The valid protocols are HTTP, HTTPS, FTP, and Gopher. For example, to list an FTP proxy, a valid string would be "ftp=ftp://ftp_proxy_name:21", where ftp_proxy_name is the name of the FTP proxy and 21 is the port number that must be used to access the proxy. If the proxy uses the default port number for that protocol, the port number can be omitted. If a proxy name is listed by itself, it is used as the default proxy for any protocols that do not have a specific proxy specified. For example, "http=http://http_proxy other" would use http_proxy for any HTTP operations, while all other protocols would use other. By default, the function assumes that the proxy specified by lpszProxyName is a CERN proxy. An application can specify more than one proxy, including different proxies for the different protocols. For example, if you specify "ftp=ftp://ftp-gw gopher=http://jericho:99 proxy", FTP requests are made through the ftp-gw proxy, which listens at port 21, and Gopher requests are made through a CERN proxy called jericho, which listens at port 99. All other requests (for example, HTTP requests) are made through the CERN proxy called proxy, which listens at port 80. Note that if the application is only using FTP, for example, it would not need to specify "ftp=ftp://ftp-gw:21". It could specify just "ftp-gw". An application is only required to specify the protocol names if it is using more than one protocol per handle returned by InternetOpen. |
ujif 2 - 22.09.2004 - 12:09 |
Раскопал я WinInet, научил программу качать файлы напрямую, (без прокси), так же через прокси без аутентификации. А вот с аутентификацией на прокси - затык. InternetOpen('Testr', INTERNET_OPEN_TYPE_PROXY, FPrxServer+':'+FPrxPort, nil, 0); Так и не понял из доки, как и где там указать имя и пароль для прокси? Ппробовал указывать прокси как Имя/Пароль@АдресПрокси:ПортПрокси но не помогло.. Как и где там указать имя и пароль для прокси? |