Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Oct 14 17:29
    rlebeau commented #382
  • Oct 14 17:29
    rlebeau commented #382
  • Oct 14 17:28
    rlebeau commented #382
  • Oct 14 17:25
    rlebeau labeled #382
  • Oct 14 02:42
    hzmnet edited #382
  • Oct 14 02:41
    hzmnet opened #382
  • Oct 11 19:25
    rlebeau closed #380
  • Oct 11 19:10
    rlebeau assigned #381
  • Oct 11 19:09
    rlebeau edited #381
  • Oct 11 19:09
    rlebeau milestoned #381
  • Oct 11 19:09
    rlebeau labeled #381
  • Oct 11 19:09
    rlebeau labeled #381
  • Oct 11 19:09
    rlebeau opened #381
  • Oct 11 09:02
    Arthur-Regnier commented #380
  • Oct 09 01:01
    rlebeau commented #380
  • Oct 09 00:24
    rlebeau labeled #380
  • Oct 08 07:21
    Arthur-Regnier edited #380
  • Oct 08 07:21
    Arthur-Regnier opened #380
  • Oct 04 23:02
    rlebeau commented #378
  • Oct 04 23:02
    rlebeau commented #378
Kudzu
@czhower
No, 3xx are temporary errors that can be remedied by respodnign to teh 3xx by the client. Check the RFC :)
Either htye have reworded or wikipedia has it wrong
originally it was 1xx info, 2xx status, 3xx temp error, 4xx perm error, 5xx software bugs / unknown
mezen
@mezen

You mean RFC2616? https://tools.ietf.org/html/rfc2616#section-6

3xx: Redirection - Further action must be taken in order to complete the request

Ludwig Behm
@lbehm
@czhower I mean it should be obvious that 301 Moved Permanently can't be a temporary error.
@mezen better ref which is kinda current internet standard: https://tools.ietf.org/html/rfc7231#section-6.4
Kudzu
@czhower
Its a "temporary" error in the fact that the client can fix it by following instructions - which cant happen with 4 or 5.
Ludwig Behm
@lbehm
@czhower I think you are looking for something like "remediable error"
if not: rfc or didn't happen!? ^_^
Kudzu
@czhower
I think I'm thinking of anotehr doc that outlines how tcp text servers in tgeneral are supposed to follow and HTTP does follow it. I can't find it now, but I've bene working wtih the RFCs since the early 90s (and then many of the current ones were from the 70s/80s) and I'm sure one of the early ones put it forth this way, and most like NNTP etc follow or get it close (SMTP) etc
Kudzu
@czhower
and then there is the horrible aberation - pop3
Remy Lebeau
@rlebeau
Not all 3xx responses are redirects. 304 in particular is a response to a conditional GET to indicate the requested resource has not changed since the last time it was requested so the client can keep using its previously cached copy.
Kudzu
@czhower
exactly - a "fixable" condition.
although some might say that is a redirect too, to a cached copy
Sam B
@SamBirnbaum
@rlebeau Hi, regarding the 502 error that I am receiving, according to the IT person at the site that I am trying to access using Indy, they don't see and problems on their end. Is it possible for you to try to access 'HTTPS://api.iextrading.com/1.0/tops?symbols=AAPL%2b' using Indy and see if you receive the same gateway error 502. Would appreciate all the help I can receive. Thanks in advance. Sam
Remy Lebeau
@rlebeau
@SamBirnbaum works fine for me, I get a JSON document that says '[null]'
Sam B
@SamBirnbaum
What version of Indy are you using ? I am using the version with XE5. Any special settings in the handler or the the IdHTTP component ? I can access the site using the browser without a problem but get this error through the program.
Tried to use the REST client and I get the same error.
Sam B
@SamBirnbaum
Is it possible for you to create a simple exe with one button it to execute on my PC. I would love to see if it some setting here that is causing this.
If your program works, then its something with my version of delphi xe5 that is causing this problem with this site.
Remy Lebeau
@rlebeau
@SamBirnhaum I'm using the latest nightly snapshot, and using all defaults in TIdHTTP
Sam B
@SamBirnbaum
@rlebeau snapshot of what ?
Remy Lebeau
@rlebeau
@SamBirnhaum SVN snapshot of Indy
Sam B
@SamBirnbaum
@rlebeau is it on github ?
Remy Lebeau
@rlebeau
@SamBirnbaum no, on Indy's own SVN server. http://www.indyproject.org/Sockets/Docs/Indy10Installation.aspx
Sam B
@SamBirnbaum
@rlebeau Do I first remove this component from Delphi and install this new version, or just install it over this version ?
@SamBirnbaum read the instructions
@SamBirnbaum but first, I suggest you compare the HTTP request that the browser sends to the HTTP request that TIdHTTP sends, see what the differences are
Sam B
@SamBirnbaum
@rlebeau Thank you very much. I will certainly read the instructions. Quick question, how can I compare what the browser sends (Fox) vs the TIdHTTP ?
Remy Lebeau
@rlebeau
@SamBirnbaum pretty much every modern browser has a debug tool for viewing the raw HTTP messages being exchanged. On the Indy side, since you are dealing with HTTPS, you can either use a debugging proxy like Fiddler, or simply attach one of the TIdLog... components to the TIdHTTP.Intercept property.
Sam B
@SamBirnbaum
@rlebeau Great. Thanks. I don't know where you are located, but here its diner time. Being called down for that. I will keep you updated. Thanks again.
Sam B
@SamBirnbaum

@rlebeau , it seems (to me anyway) that its send out the correct request. I captured the on send in the event log. I don't know what else to look for. This is a direct translation of the buffer.

GET /1.0/tops/last?symbols=AAPL,fb,AIG+
HTTP/1.1'#$D#$A'
Host: api.iextrading.com'#$D#$A'
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,/;q=0.8'#$D#$A'
Accept-Encoding: identity'#$D#$A'
User-Agent: Mozilla/3.0 (compatible; Indy Library)'#$D#$A#$D#$A

@rlebeau Since I am using XE5, which versions should I download. The version of IDHTTP that I have is 10.6.0.5...
Remy Lebeau
@rlebeau
@SamBirnbaum that request is fine, and is similar to what mine is sending: GET /1.0/tops/last?symbols=AAPL%2Cfb%2CAIG%2B HTTP/1.1
Host: api.iextrading.com
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,/;q=0.8
User-Agent: Mozilla/3.0 (compatible; Indy Library)
@SamBirnbaum Notice there is a slight difference, though. Newer versions of Indy no longer send the 'Accept-Encoding: identity' header unnecessarily, as some servers can't handle that header. Maybe your connection is passing through a proxy server that doesn't handle that header.
Sam B
@SamBirnbaum
Ahh, is there a way, for me to strip that (in my intercept) out before the actual string is sent out ?
Kudzu
@czhower
It might be easier to just comment it out in your source.
Sam B
@SamBirnbaum
@czhower Hi, yes I traced it to the request structure in the HTTPheader. The problem was that the header still has the field FAcceptencoding so that the buffer being sent has the line "Accept-encoding:" without any parameter after it. That may or may not have caused the error 502 to be returned anyway. So my next quest is to try to delete that line completely (if I can). This morning before dropping of my granddaughter to school, I started to look at the source code (Indy) to see where that is being prepared so that I can comment that out completely. Thanks for the follow up response. Need all the help I can get on this one. This is not my forte, I am more of an application guy. Being doing it for 40+ years.
Sam B
@SamBirnbaum
@czhower @rlebeau Hi, Managed to find the spot where the header is constructed so that the data looks like the one Remy had and I still received the 502 error.
'GET /1.0/tops/last?symbols=AAPL,fb,AIG+ HTTP/1.1'#$D#$A
'Host: api.iextrading.com'#$D#$A
'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,/;q=0.8'#$D#$A
'User-Agent: Mozilla/3.0 (compatible; Indy Library)'#$D#$A#$D#$A
Sam B
@SamBirnbaum
@czhower @rlebeau Hi, I did try to use the same code without the 'Accept-Encoding' on another site and had no problems. Weird.
Sam B
@SamBirnbaum
@czhower @rlebeau Hi, should the HTTP/1.1 appear on a separate line ?
Remy Lebeau
@rlebeau
@SamBirnbaum no, it should not. And if you are still having problems after stripping out the 'Accept-Encoding' header then the problem lies elsewhere. I still think this is going to come down to a connection issue, not a request issue. 502 means the request is passing through a proxy/gateway that cannot forward the request to another server. That has nothing to do with TIdHTTP itself
Sam B
@SamBirnbaum
@rlebeau Thanks. I am starting to think it might be my ISP (Optimum) but the browser has no problem getting to that site. That is what perplexing me. I captured the headers that the browser is sending and receiving. Can I send the screen shot to you or post it here, maybe you can spot something in the response that the browser is handling that is not being handled by my program due to some setting.
Remy Lebeau
@rlebeau
@SamBirnbaum You can show the browser's request (copy/pasted text woould be better than an image, but Gitter chat does support images, too), but I don't think it is going to make much difference. The server's response is irrelevant unless the server is sending back a redirect (it wasn't when I tested it, but since you are likely passing through a proxy/gateway, you may be getting a different response than what I see).
Sam B
@SamBirnbaum

@rlebeau Hi, here are two lines on the response that may or may not may a difference:
content-security-policy default-src 'self'; child-src 'none'; object-src 'none'; style-src 'self' 'unsafe-inline'; font-src data:; connect-src 'self' https://auth.iextrading.com wss://iextrading.com wss://tops.iextrading.com; script-src 'self';

x-content-security-policy default-src 'self'; child-src 'none'; object-src 'none'; style-src 'self' 'unsafe-inline'; font-src data:; connect-src 'self' https://auth.iextrading.com wss://iextrading.com wss://tops.iextrading.com; script-src 'self';

what I also noticed on the header going out were these two lines:

Accept-Encoding gzip, deflate, br
Upgrade-Insecure-Requests 1

How do I add an image here or can I attach a file ?

Remy Lebeau
@rlebeau
@SamBirnHaum The 'Accept-Encoding' header is not relevant to your issue. However, if you want to enable compression, you can assign a TIdZLibCompressorBase-derived component to the TIdHTTP.Compressor property, such as TIdCompressorZLib. Indy does not support the 'br' encoding. As for the 'Upgrade-Insecure-Requests' header, you can add that using the TIdHTTP.Request.CustomHeaders property
@SamBirnhaum 'content-security-policy' is a response header, not a request header, so not relevant to your issue, either.
Sam B
@SamBirnbaum
@rlebeau Thanks. I don't want to bother you. I try to figure out things by myself by experimenting. 99% of the time that works. I wish it would have worked this time as well. I did send you an email. Hope you got it. Thanks again.
Remy Lebeau
@rlebeau
@SamBirnbaum I got it, and what it shows is not relevant to this issue. But if you really want to rule things out, simply make TIdHTTP send everything the browser sends, and see what happens. Like I said though, I tested it myself and it worked fine without having to do anything extra to make it work. So I still think you are looking in the wrong places for the culprit.
Sam B
@SamBirnbaum
@rlebeau I was afraid you would might say that. This may sound silly, but can you email me a simple executable that just does the get to that site. on a button press Showmessage(get(...)); If this does not runs on my PC, then I know that its my connection.