http://bugs.winehq.org/show_bug.cgi?id=27927
Summary: Winhttprequest WaitForResponse should process messages Product: Wine Version: 1.3.25 Platform: x86 URL: http://netikka.net/dev/winhttpwait.exe OS/Version: Linux Status: UNCONFIRMED Severity: normal Priority: P2 Component: winhttp AssignedTo: wine-bugs@winehq.org ReportedBy: ocean04@suomi24.fi
Allows application to respond user action while waiting. For example cancel button.
Example: http://netikka.net/dev/winhttpwait.exe
Click "download". There is time counter, but counter doesn't work. Same thing with cancel button. Also request should timeout in 30 seconds, but it doesn't?
(Url is just some large exe-file, easier to reproduce problem also using fast internet connection)
begin cancel:=false; fhttp:=createoleobject('WinHttp.WinHttpRequest.5.1'); fhttp.open('GET', edit1.text, true); fhttp.send(); // waiting 30 seconds or user cancel. for i:=1 to 30 do begin if fhttp.WaitForResponse(1) then break; application.processmessages; label6.caption:='Time: '+inttostr(i); if (i=30) or (cancel=true) then begin if i=30 then showmessage('Timeout') else showmessage('User cancel'); fhttp.Abort; fhttp:=unassigned; exit; end; end; memo1.text:=fhttp.Responsetext; ... ... end;
procedure TForm1.Button3Click(Sender: TObject); begin cancel:=true; end;
http://bugs.winehq.org/show_bug.cgi?id=27927
ocean04@suomi24.fi changed:
What |Removed |Added ---------------------------------------------------------------------------- Keywords| |download, source
http://bugs.winehq.org/show_bug.cgi?id=27927
--- Comment #1 from Hans Leidekker hans@meelstraat.net 2011-07-28 09:33:04 CDT --- Looks like WaitForResponse needs to wait not just for the response headers but also for the response body.
http://bugs.winehq.org/show_bug.cgi?id=27927
--- Comment #2 from Hans Leidekker hans@meelstraat.net 2011-07-30 11:10:33 CDT --- Created an attachment (id=35753) --> (http://bugs.winehq.org/attachment.cgi?id=35753) draft patch
Can you try this patch?
http://bugs.winehq.org/show_bug.cgi?id=27927
--- Comment #3 from ocean04@suomi24.fi 2011-07-31 12:01:30 CDT --- Yes, with that patch example now works. But..
Sorry if making issue more complicated, but something like following should also work. It perhaps shows more clearly, why WaitForResponse needs to process messages. (cancel button / time counter doesn't work, because it consumes all CPU)
Download: http://netikka.net/dev/winhttpwait2.exe
begin cancel:=false; fhttp:=createoleobject('WinHttp.WinHttpRequest.5.1'); fhttp.open('GET', edit1.text, true); fhttp.send(); timer1.enabled:=true; fhttp.WaitForResponse; timer1.enabled:=false; if cancel=true then begin showmessage ('User cancel'); exit; end; memo1.text:=fhttp.Responsetext; ... end;
procedure TForm1.Button3Click(Sender: TObject); begin cancel:=true; fhttp.Abort; fhttp:=unassigned; end;
procedure TForm1.Timer1Timer(Sender: TObject); begin // timer interval is 1 second t:=t+1; label6.caption:='Time: '+inttostr(t); end;
http://bugs.winehq.org/show_bug.cgi?id=27927
Hans Leidekker hans@meelstraat.net changed:
What |Removed |Added ---------------------------------------------------------------------------- Attachment #35753|0 |1 is obsolete| |
--- Comment #4 from Hans Leidekker hans@meelstraat.net 2011-08-01 07:29:21 CDT --- Created an attachment (id=35771) --> (http://bugs.winehq.org/attachment.cgi?id=35771) draft patch #2
Try this improved version. You will need to run configure.
http://bugs.winehq.org/show_bug.cgi?id=27927
--- Comment #5 from ocean04@suomi24.fi 2011-08-01 08:04:00 CDT --- Second example now seems fine. But first one exits prematurely? I get status 200 immediately, even when file is large.
http://bugs.winehq.org/show_bug.cgi?id=27927
Hans Leidekker hans@meelstraat.net changed:
What |Removed |Added ---------------------------------------------------------------------------- Attachment #35771|0 |1 is obsolete| |
--- Comment #6 from Hans Leidekker hans@meelstraat.net 2011-08-01 09:14:41 CDT --- Created an attachment (id=35772) --> (http://bugs.winehq.org/attachment.cgi?id=35772) draft patch #3
This version makes both test programs behave like they do on Windows here.
http://bugs.winehq.org/show_bug.cgi?id=27927
--- Comment #7 from ocean04@suomi24.fi 2011-08-01 09:55:52 CDT --- Looks good, thanks!
http://bugs.winehq.org/show_bug.cgi?id=27927
Hans Leidekker hans@meelstraat.net changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |RESOLVED Resolution| |FIXED
--- Comment #8 from Hans Leidekker hans@meelstraat.net 2011-08-02 15:26:49 CDT --- Fixed by e5b8c497efe243a11e447c382a45a51f8b278e1f.
http://bugs.winehq.org/show_bug.cgi?id=27927
Alexandre Julliard julliard@winehq.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |CLOSED
--- Comment #9 from Alexandre Julliard julliard@winehq.org 2011-08-05 12:37:52 CDT --- Closing bugs fixed in 1.3.26.