Delphi TIDHttp Get bug - delphi

I just discovered a bug in tidhttp component. The scenario is this, im creating a small to fetch the pages of website using tidhttp get. I tried it in ebay all is ok, now after ebay i tried amazon thats where i encountered a problem. What happenned on my side is i searched for item "lenovo laptop" in amazon and copied the url of the second page and paste it in my small app, and whats happenning is it always gets the first page even if the url i used is the second page. Does anyone of you encountered this please see the source code i used in the link below. This source is defaulted to second page of amazon. Thanks you guys in advance.
http://www.yourfilelink.com/get.php?fid=577209

What version of Indy are you using? your code works fine for me as-is when I try it with the current Indy 10.5.8 snapshot release.
If the server returns a success reply, TIdHTTP.Get() saves whatever data the server decodes to send. If you are not seeing the data you are expecting, chances are that Amazon is either redirecting TIdHTTP back to the first page when you try to access the second page directly, or it is sending the first page's data by accident. Either way, I seriously doubt this is a bug in TIdHTTP itself.

Related

Redirect http request to another address

I have a software that was developed in delphi and that makes a http get request to a specific url that I want to redirect to another url.
I have the source code but I can't recompile it because it wasn't developed by me, so it would take too much effort and time, and right now I can't afford it.
Anyway, back to my problem.
I tried using fiddler 2. It worked, but only for when I try accessing the url via browser. When my application sends the requests, it doesn't get redirected to the new url.
Does anyone have any other suggestion of what I can do?

signalR no element found error message

On pages that I have signalR included I get the following error in firebug:
http://localhost:53604/signalr/signalr/negotiate?_=1352797361490
no element found
everything still works fine but just wanted to see if this will become an issue. thanks
Since you're using Firebug that means you're using Firefox. What transport are you using (if using Fiddler remember to turn Streaming on)? It should be:
1. Long Polling
2. Server Sent Events
3. WebSockets
If the transport is Long Polling then we probably have an issue in the underlying code(Firefox should prioritize WebSockets/SSE before LP).
However, if not then we have a content based issue. So that being said, what type of data are you retrieving from the server? Usually a no element found error comes from invalid markup.
Try stripping out all pieces of your application and see if you still get this error. AKA just a $.connection.hub.start().

Asp.NET MVC Caching Images

I am using the code from this article: http://weblogs.asp.net/jeff/archive/2009/07/01/304-your-images-from-a-database.aspx to cache the images I am returning from the database but I am having a problem when the user changes the image the browser is not going back to the server to check the timestamp.
I have tested this in Chrome and IE9 and chrome almost always goes back to the server to check the timestamp and if it has been edited it returns the new image, IE9 never does unless I ctrl+F5 to refresh the page.
Is there a cross browser solution that anyone knows of to make sure the browser always makes a call to the server so I can check the timestamp?
Many thanks for any help.
Setting the expiration date to the current date/time forced it to always check with the server.
Response.Cache.SetExpires(DateTime.Now);
The same solution of user351711 with a different syntax:
Response.Cache.SetCacheability(System.Web.HttpCacheability.NoCache);

Delphi - Connecting and logging in to a webpage

EDIT
There has been quite a development. The current problem is this:
I compared requests sent from a browser and sent from my app. There have been some differences and I managed to correct most of them. Some are still unfixed, since I haven't figured it out how yet. I am using INDY.
How can i send (or add) cookies into the request?
I tried this:IdHTTP.CookieManager.AddCookie('bakatheme=BrectanTheme',IdHTTP1.URL) but it doesn't work. Also, in INDY help they say that it is supposed to be AddCookie(String, String), but my Delphi only accept (String, TIdURI) - I am not sure if it is the right URI I am calling.
In the Headers I have this code: AcceptEncoding:='gzip,deflate,sdch'; yet when I parse the outgoing request, it states this: AcceptEncoding:gzip,deflate,sdch,identitybut I am certain I don't have "identity" anywhere in the code.
Those are the two things in which my request differs from the browser's. Now, I am getting a 500 Internal Server Error at return, can it be caused by the lack of cookies or the second thing?
Thank you very much.
Haven't exactly tried it myself but here's an example I found about website login using indy
http://www.ciuly.com/delphi/indy/persistent-login-example-for-geocacheing-no-ssl/
Ok. Lets comment:
How can i send (or add) cookies into the request?
You should not do that. Indy handles this for you (but if really want to, there is a TidCookieManager). But it seems to me that you dont know how cookies work. Its not a thing you can add to a request. It cames from the server and it identifies you.
In the Headers I have this code: AcceptEncoding:='gzip,deflate,sdch';
AcceptEnconding tells to the server that it can compact the response using those algorithms. Indy supports gzip,deflate,sdch,identity and indy is updating que header request to add the one you forgot to put.
You should take a look at those links to learn how http works:
W3
Wikipedia

Restriction of url parameters in asp.net

I have updated a website i have made recently, using asp.net. The problem Im now encountering is this. If I send in the request parameters of a page: i.e.
www.something.com/index.aspx?search=vendor, this url leads to a page stating "Command cannot execute". It used to work fine in my old version, and im still using the same iis server and the same database.
I have narrowed it down to note that if the word "vend" is found in the url it gives this error. I suspect this restriction is made in the asp.net project? If yes, how can I remove it. My users need to be able to send requests containing these letters.
i'm not sure but you might want to check the routing if there is any.

Resources