Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
IdHTTP corrections when proxy is used
#3
(04-30-2019, 07:17 PM)rlebeau Wrote: Here the behavior before and after your proposed changes (click on the image to enlarge):



Is that what you really want?  What would be the actual use-case for this change?

Exactly, exception with content is buggy, there is no content inside exception object (it seems that it is disregarded or something like it), and since there is exception, the easy way to check for "why", is to check response object, for example:

1. I do: http.Post(uri, input, output);
2. input contains some XML to be sended,
3. output is a TStringStream getting post return value,
4. Post is sended through PROXY,
5. If proxy needs authentication, it responds with error 407 - authentication required and some HTML page describing the reason,
(this is special situation - because this is exception and valid response at the same time, it should be fully parsed)
6. I need to catch exception and to be able to check: http.Response.ContentType = "text/html",
7. in fact, I need all http.Response object filelds to be filled with what was the response from proxy as it was normal (good) response.

Remy, can You see what is the problem here?

My personal opinion is that: "by design" You and other authors of Indy components forced yourselfs and other programmers to "do bad things".
Let me explain what I think is "bad thing":

1. If I catch exception, there is two things that interest me: exception code (407) and reason (authentication required message) - it is the first line of every response raw header,
2. this and other details should be also contained in http.Response object fields - where is its place.

This is more programmer friendly practise and helps alot with writing better code, and not always thinking where is the problem while debugging.

Thank You for hard work, commitment and understanding.
Do not take "constructive criticism" to Yourself, its nothing personal.
Belive me, I know how hard it is to make something that complex as Indy - better.
But You constantly saying that Indy 11 will be rebuild and better, why not start to getting there already?
Reply


Messages In This Thread
IdHTTP corrections when proxy is used - by NevTon - 04-29-2019, 01:17 PM
RE: IdHTTP corrections when proxy is used - by NevTon - 05-06-2019, 12:11 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)