Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Oct 20 14:59
    IgorKaplya opened #385
  • Oct 20 10:05
    Hugie opened #384
  • Oct 20 09:51
    Hugie opened #383
  • 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
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.
Remy Lebeau
@rlebeau
@SamBirnbaum done
Sam B
@SamBirnbaum
@rlebeau Thanks, I was just about ready to send you my program to see if it works on your end.
Sam B
@SamBirnbaum
@rlebeau Test your little program. Works like a charm.
Sam B
@SamBirnbaum
@rlebeau I guess its time to reload Indy10 and hope it works.
@rlebeau really appreciate all the help and effort you made in this regards. Thank you very much.
Sam B
@SamBirnbaum
@rlebeau Hi, sorry to bother you again, based on the instructions, I was looking for the batch command file FULLD_XE5 inside the zip file in the lib folder. Not there. There is FULLC_XE5.bat that looks for c++ only. Is that an oversight, is there another automated way to do this ?
Remy Lebeau
@rlebeau
@SamBirnbaum Indy stopped using command-line scripts for Delphi in like 2010, they are only needed for C++Builder. For Delphi, you can just open and install the projects directly from the IDE.
Sam B
@SamBirnbaum
@rlebeau Ok, is the dpk package #190 the correct one for xe5?
Remy Lebeau
@rlebeau
@SamBirnbaum yes