Thread View: borland.public.cppbuilder.internet.web
15 messages
15 total messages
Started by Tom
Mon, 06 Nov 2006 19:51
IE7 Navigate failing inside a thread
Author: Tom
Date: Mon, 06 Nov 2006 19:51
Date: Mon, 06 Nov 2006 19:51
36 lines
1993 bytes
1993 bytes
Calling Form1->Browser->Navigate(WideString(http://www.google.com)); works fine when clicking a button. But, if I change it so that when the button is clicked a thread is spawned and that thread makes the exact same call as above, I get the following error message: Cannot find 'http://www.google.com'. Make sure the path or Internet address is correct. This only occurs with IE7, IE6 and below function just fine. The alternate solution would be to use Indy to retrieve the source code (which is all I'm doing) but even after setting the UA some sites still know it's not a web browser and reject the request. I'm using the latest snapshot of Indy and making a simple Get request. For example: http://siteexplorer.search.yahoo.com/search?ei=UTF-8&bwm=i&bwmf=u&searchbwm=Explore+URL&p=http%3A%2F%2Fwww.google.com/ Indy receives: "HTTP/1.1 999 Unable to process request at this time -- error 999" but a web browser receives the source code as expected. I've also tried HTTP 1.0 but the error remains the same. I've got the UA set as follows: "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322)"; Thanks in advance, Tom
Re: IE7 Navigate failing inside a thread
Author: Hans Galema
Date: Wed, 08 Nov 2006 10:58
Date: Wed, 08 Nov 2006 10:58
12 lines
1338 bytes
1338 bytes
Tom wrote: > But, if I change it so that when the button is clicked a thread is spawned What is the reaoson you would spawn a thread? There is no reason to do so in my opinion. If all you want is to get (and save) the source you can do that in the OnDocumentComplete event. The browser instance already does all things in it's own thread. Hans.
Re: IE7 Navigate failing inside a thread
Author: Remy Lebeau (TeamB)
Date: Wed, 08 Nov 2006 20:12
Date: Wed, 08 Nov 2006 20:12
28 lines
1971 bytes
1971 bytes
"Tom" <tom@nospam.net> wrote in message news:454f924b$1@newsgroups.borland.com... > if I change it so that when the button is clicked a thread is > spawned and that thread makes the exact same call as above You can't do that. The Browser can only be accessed in the context of the thread that created it. You cannot access it across thread boundaries (without manually marshalling the ActiveX interface, which can get ugly). > IE6 and below function just fine. I seriously doubt that. IE's ActiveX objects are Apartment-threaded. Creating them in the main thread, and then accessing them in a worker thread, should be causing RPC_E_WRONG_THREAD errors to be reported on all interface methods that are called. > The alternate solution would be to use Indy to retrieve the source > code (which is all I'm doing) but even after setting the UA some sites > still know it's not a web browser and reject the request. The UserAgent is the only application-specified identifer available. If you set Indy's UserAgent to match IE's, there is no other way a website can differentiate between the two. Gambit
Re: IE7 Navigate failing inside a thread
Author: Tom
Date: Wed, 08 Nov 2006 20:24
Date: Wed, 08 Nov 2006 20:24
9 lines
1190 bytes
1190 bytes
Hans, The full application does much more inside of the thread. But each time it goes to get the source code it fails with the error message, I provided in the original post. The URL doesn't matter it fails every time. I tried a skeleton application to make sure it wasn't something else... -Tom
Re: IE7 Navigate failing inside a thread
Author: Tom
Date: Wed, 08 Nov 2006 20:29
Date: Wed, 08 Nov 2006 20:29
31 lines
2218 bytes
2218 bytes
> You can't do that. The Browser can only be accessed in the context of the > thread that created it. You cannot access it across thread boundaries > (without manually marshalling the ActiveX interface, which can get ugly). > That I didn't know. I can see about creating the browser in the context of the thread then, but as I recall I had problems with it not staying hidden. It was months ago that I wrote this so I'll have another go at it. >> IE6 and below function just fine. > > I seriously doubt that. It wasn't throwing errors with IE6, which tells me they didn't have it setup in the same fashion. Maybe it should have been, but it did work (and still) does for my clients. In either case as I stated above I'll try creating it inside the thread. > The UserAgent is the only application-specified identifer available. If > you > set Indy's UserAgent to match IE's, there is no other way a website can > differentiate between the two. There's absolutely nothing else with how it sends it's requests correct? If I check the rawheaders when the request is sent the UA shows up just fine, but the URL I provided in my original post fails. That same URL in a browser succeeds. If necessary I'll post a small program with sources showing exactly what I'm doing to reproduce it for you... -Tom
Re: IE7 Navigate failing inside a thread
Author: Hans Galema
Date: Wed, 08 Nov 2006 20:30
Date: Wed, 08 Nov 2006 20:30
12 lines
1396 bytes
1396 bytes
Remy Lebeau (TeamB) wrote: > The UserAgent is the only application-specified identifer available. If you > set Indy's UserAgent to match IE's, there is no other way a website can > differentiate between the two. A browser sends a HTTP_REFERER too. The server can check for the right referer. I suppose one can add such things to the header with TIdHTTP. (I did not experiment with that component yet but will be soon). Hans.
Re: IE7 Navigate failing inside a thread
Author: Hans Galema
Date: Wed, 08 Nov 2006 20:34
Date: Wed, 08 Nov 2006 20:34
10 lines
1267 bytes
1267 bytes
Tom wrote: >... If necessary I'll post a small program with sources > showing exactly what I'm doing to reproduce it for you... borland.public.attachments is your friend. And mines if you post ;-). Hans.
Re: IE7 Navigate failing inside a thread
Author: Tom
Date: Wed, 08 Nov 2006 21:41
Date: Wed, 08 Nov 2006 21:41
7 lines
1135 bytes
1135 bytes
Hans, > A browser sends a HTTP_REFERER too. The server can check for the right > referer. Quite true and I tried setting that to no avail. -Tom
Re: IE7 Navigate failing inside a thread
Author: Tom
Date: Wed, 08 Nov 2006 21:47
Date: Wed, 08 Nov 2006 21:47
19 lines
1635 bytes
1635 bytes
Remy & Hans, Thank you both for your time. Apparently Indy not being able to retrieve the page was only a tempory thing. I went back today and created the skeleton application to post and it worked. So I also tried the original application and it's also functioning fine. So I'm left to assume that it was on Yahoo's end that I couldn't get through and then coincidentially the browser worked when I tried it (seconds later). Unless the browser is set to retry a few times in the event a Http 999 error is thrown. As for IE not be accessible from a worker thread, well I learned something new. =) And I won't use it like that in the future. Thanks again for your help and time. -Tom
Re: IE7 Navigate failing inside a thread
Author: Remy Lebeau (TeamB)
Date: Wed, 08 Nov 2006 21:53
Date: Wed, 08 Nov 2006 21:53
25 lines
1737 bytes
1737 bytes
"Tom" <tom@nospam.net> wrote in message news:454f924b$1@newsgroups.borland.com... > For example: <snip> > Indy receives: "HTTP/1.1 999 Unable to process request at > this time -- error 999" I cannot duplicate that. When I request that exact URL with Indy 9 TIdHTTP, I get a 200 response as expected. I don't even change the UserAgent from its default value, and it still works fine for me. "999" is not even a valid HTTP response code to begin with. Anything above the 500 range of codes is not defined. The server must send a 5xx error code, such as 503, if it is having problems processing a request. > I've also tried HTTP 1.0 but the error remains the same. That error has nothing to do with the type of application that is sending the request. But if you are missing required headers, for instance, then the request could fail. Gambit
Re: IE7 Navigate failing inside a thread
Author: Remy Lebeau (TeamB)
Date: Wed, 08 Nov 2006 21:53
Date: Wed, 08 Nov 2006 21:53
23 lines
1741 bytes
1741 bytes
"Tom" <tom@nospam.net> wrote in message news:45523e23$2@newsgroups.borland.com... > There's absolutely nothing else with how it sends it's requests correct? No. Everything outside of the UserAgent is standardized. All HTTP clients send the same kind of HTTP requests to the server. You can't identify a client by the way the requests are formatted. That is what the UserAgent is specifically for. > If I check the rawheaders when the request is sent the UA shows up > just fine, but the URL I provided in my original post fails. Then something else has to be occuring. You are probably not sending everything that the page is actually expecting. You need to use a packet sniffer to verify that. Everything works fine for me when I try the URL you posted. I cannot reproduce the error you mentioned. Gambit
Re: IE7 Navigate failing inside a thread
Author: Remy Lebeau (TeamB)
Date: Wed, 08 Nov 2006 21:55
Date: Wed, 08 Nov 2006 21:55
14 lines
1198 bytes
1198 bytes
"Hans Galema" <notused@notused.nl> wrote in message news:45523ed2$1@newsgroups.borland.com... > A browser sends a HTTP_REFERER too. That has nothing to do with identifying the client. > The server can check for the right referer. Yes, it can. Many sites do. Gambit
Re: IE7 Navigate failing inside a thread
Author: Remy Lebeau (TeamB)
Date: Wed, 08 Nov 2006 21:56
Date: Wed, 08 Nov 2006 21:56
14 lines
1413 bytes
1413 bytes
"Tom" <tom@nospam.net> wrote in message news:45525061$1@newsgroups.borland.com... > So I'm left to assume that it was on Yahoo's end that I couldn't get > through and then coincidentially the browser worked when I tried it > (seconds later). Unless the browser is set to retry a few times in the > event a Http 999 error is thrown. Considering that 999 is not a valid HTTP response code to begin with, I would definately think that Yahoo was faulty at the time. Gambit
Re: IE7 Navigate failing inside a thread
Author: Tom
Date: Tue, 14 Nov 2006 23:11
Date: Tue, 14 Nov 2006 23:11
32 lines
2019 bytes
2019 bytes
Gambit, If you've got the time today, try the query to Yahoo again. It's failing for me and a customer right now, but a web browser works fine. Any ideas would be great. -Tom Query: http://siteexplorer.search.yahoo.com/search?ei=UTF-8&bwm=i&bwmf=u&searchbwm=Explore+URL&p=http%3A%2F%2Fwww.google.com/ "Remy Lebeau (TeamB)" <no.spam@no.spam.com> wrote in message news:4552534d@newsgroups.borland.com... > > "Tom" <tom@nospam.net> wrote in message > news:45525061$1@newsgroups.borland.com... > >> So I'm left to assume that it was on Yahoo's end that I couldn't get >> through and then coincidentially the browser worked when I tried it >> (seconds later). Unless the browser is set to retry a few times in the >> event a Http 999 error is thrown. > > Considering that 999 is not a valid HTTP response code to begin with, I > would definately think that Yahoo was faulty at the time. > > > Gambit > >
Re: IE7 Navigate failing inside a thread
Author: Remy Lebeau (TeamB)
Date: Wed, 15 Nov 2006 00:45
Date: Wed, 15 Nov 2006 00:45
12 lines
1451 bytes
1451 bytes
"Tom" <tom@nospam.net> wrote in message news:455a4d2f@newsgroups.borland.com... > If you've got the time today, try the query to Yahoo again. It's failing > for me and a customer right now, but a web browser works fine. Like I said earlier, I am not able to reproduce that with Indy. Using the exact URL you have provided, I am getting a 200 reply as expected. Gambit
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads