Спасибо за подсказку.
Намучился я с этим апи.
Хочу в нем собственно и выловить этот редирект, нашел в инете как, поставить обработчик т.е вызвать InternetSetStatusCallback.
Вроде работает, сообщения сыплются, только в виде абракадабры, не пойму что за кодировка такая.
Вот че пришло, и как его привести к человеческому виду?
HTTP request is about to automatically redirect the request 瑨灴⼺是㍳⸶睷硥甮⽡潬摡㠯㐱㜴㐲挵慡㌸㔳㍦挸挱㌷㔵㥢愳捥⽢㘲㌲㐴㘵⼸畬畢瑮慰正ㄭ⸶㐰ㄮ搭獥瑫灯愭摭㐶椮潳㸀眙팱眘
Покажу процедуру, чтобы не было вопросов откуда нормальные буквы=)
procedure StatusCallback(
hInet: HINTERNET;
Context: DWORD_PTR;
Status: DWORD;
pInformation: Pointer;
InfoLength: DWORD ); export; stdcall;
var
s: String; //UTF8String
//info: array of char;
begin
//SetLength(info, INfoLength);
//info:= pInformation;
case Status of
INTERNET_STATUS_CLOSING_CONNECTION: s := 'Closing the connection to the server';
INTERNET_STATUS_CONNECTED_TO_SERVER: s := 'Successfully connected to the socket address: ';
INTERNET_STATUS_CONNECTING_TO_SERVER: s := 'Connecting to the socket address';
INTERNET_STATUS_CONNECTION_CLOSED: s := 'Successfully closed the connection to the server';
INTERNET_STATUS_CTL_RESPONSE_RECEIVED: s := 'Not implemented';
INTERNET_STATUS_HANDLE_CLOSING: s := 'This handle value has been terminated';
INTERNET_STATUS_HANDLE_CREATED: s := 'InternetConnect has created the new handle';
INTERNET_STATUS_INTERMEDIATE_RESPONSE: s :=
'Received an intermediate (100 level) status code message from the server';
INTERNET_STATUS_NAME_RESOLVED: s := 'Successfully found the IP address: ' + PWideChar(pInformation);
INTERNET_STATUS_PREFETCH: s := 'Not implemented';
INTERNET_STATUS_RECEIVING_RESPONSE: s := 'Waiting for the server to respond to a request ';
INTERNET_STATUS_REDIRECT: s := 'HTTP request is about to automatically redirect the request ' +
PChar(pInformation);
INTERNET_STATUS_REQUEST_COMPLETE: s := 'An asynchronous operation has been completed';
INTERNET_STATUS_REQUEST_SENT: s := 'Successfully sent the information request to the server: ' +
IntToStr(Integer(pInformation)) + ' Byte';
INTERNET_STATUS_RESOLVING_NAME: s := 'Looking up the IP address: ' + PWideChar(pInformation);
INTERNET_STATUS_RESPONSE_RECEIVED: s := 'Successfully received a response from the server: ' +
IntToStr(Integer(pInformation)) + ' Byte';
INTERNET_STATUS_SENDING_REQUEST: s := 'Sending the information request to the server.';
INTERNET_STATUS_STATE_CHANGE:
begin
s := 'Moved between a secure (HTTPS) and a nonsecure (HTTP) site.';
case DWORD(pInformation) of
INTERNET_STATE_CONNECTED: s := s + #13#10 + 'Connected state. Mutually exclusive with disconnected state.';
INTERNET_STATE_DISCONNECTED: s := s + #13#10 +
'Disconnected state. No network connection could be established.';
INTERNET_STATE_DISCONNECTED_BY_USER: s := s + #13#10 + 'Disconnected by user request.';
INTERNET_STATE_IDLE: s := s + #13#10 + 'No network requests are being made by Windows Internet.';
INTERNET_STATE_BUSY: s := s + #13#10 + 'Network requests are being made by Windows Internet.';
end;
end;
end;
//ShowMessage(s);
fmMain.Memo1.Lines.Add(s);
end;
Подвязывается обработчик так:
hInet := InternetOpen(PChar(sAppName), INTERNET_OPEN_TYPE_PRECONFIG, nil, nil, 0);
InternetSetStatusCallback(hInet, @StatusCallback);
hURL := InternetOpenURL(hInet, PChar(SrcName), nil, 0, INTERNET_FLAG_NEED_FILE, Integer(@StatusCallback));