Jump to content

Carlos Tré

  • Content Count

  • Joined

  • Last visited

Community Reputation

4 Neutral

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Carlos Tré

    TIdHTTP SSL and error 'HTTP/1.1 403 Forbidden'

    Thank you very much, now it works like a charm. Next step is filling a form fields, I hope I can translate you English explanation into "Indysh" by myself. We''ll see. 🙂
  2. Carlos Tré

    TIdHTTP SSL and error 'HTTP/1.1 403 Forbidden'

    Luckily I had the strength required do hold the rod. 🙂
  3. Carlos Tré

    TIdHTTP SSL and error 'HTTP/1.1 403 Forbidden'

    Dear Kas Ob, Many thanks for help, very much appreciated. A precious lesson you taught me here, it will most certainly will be of help in the future as well. The browser debugger was instrumental here.
  4. Carlos Tré

    TIdHTTP SSL and error 'HTTP/1.1 403 Forbidden'

    Dear Remy, Many thanks for your help, I'll try not to be PITA. If SSL was not the problem I set out to find what could it be that I was missing. As I told before, I'm a newbie to internet programming, and was unaware that I should set a few more properties. I'm not completely there yet, but made some progress and now there is no authorization error. The response I get is encrypted and I don't know how to decrypt it. Is this another property I must set in order to solve it? Or shall I do further processing? As you probably must have noted by now, this is related to the problem I had with ICS, one that you kindly help me with. Having failed that POST attempt a few times I asked for and the webmaster set a lean and mean to get it working through a simple GET. And it did alright. Discussing my lack of experience on this matter with a fellow programmer, she suggested the change to Indy, so here I am 🙂 This is the relevant part of the code that works procedure TForm1.btnGetClick(Sender: TObject); var LResp : string; begin IdHTTP1.Request.Accept := 'text/html, image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, */*'; IdHTTP1.Request.AcceptEncoding := 'gzip, deflate'; IdHTTP1.Request.UserAgent := 'Mozilla/4.0'; IdHTTP1.IOHandler := IdSSLIOHandler1; IdSSLIOHandler1.SSLOptions.SSLVersions := [sslvTLSv1_2]; IdLogFile1.Open; try LResp := IdHTTP1.Get('https://www.trivial.com.br/envia_arq3.php?senha=violeta&nome=tre'); finally IdLogFile1.Close; end; Memo1.Lines.Add(LResp); LResp should get 'tre' and I get '*)Jÿÿ=h' instead. Also, the log file created is empty, most certainly due to something I'm missing again. The only property set at run time is the file name in the component, and the IsHTTP1.Intercept is set to the logger. Again, many thanks for all your help. Edit: The code began to work after setting the UserAgent property.
  5. Dear All, I'm not versed in HTTP a SSL, so excuse-me if I make any confusion. A FMX project I'm working on demands GET, POST, FTP and email receiving and parsing capabilities. I started with a simple GET do a HTTPS server, so I dropped a TIdHTTP and a TIdSSLIOHandlerSocketOpenSSL components in a bare form and configured as follows: IdHTTP1.Request.ContentType := 'application/x-www-form-urlencoded'; IdHTTP1.IOHandler := IdSSLIOHandler; IdSSLIOHandler1.SSLOptions.SSLVersions := [sslvTLSv1, sslvTLSv1_1, sslvTLSv1_2]; IdSSLIOHandler1.SSLOptions.SSLMode apparently has no impact and then called IdHTTP1.Get(<https url>); In the application executable folder there are 3 files: libeay32.dll, ssleay32.dll and the application executable. The GET method raises an exception EIdHTTPProtocolException with the message 'HTTP/1.1 403 Forbidden', so I think I'm missing something very basic because the <https url> works in the browser, I just could't figure it out what that would be by going through both component's properties. Can you help me? Also, a long time ago I needed to use Indy in a project, and there were paid support available. Is there nowadays? As I said before, this line of work is not my strong suit and I don't want to be the PITA I'll probably be - I think I'll have many more questions. Best regards & TIA Carlos
  6. Thank you all for helping an old dog to learn a new trick. -- Carlos
  7. Thank you very much for input, very much appreciated. How would I encode the submit button? Considering the code snippet input name="enviar" type="submit" value="Enviar"> the URL encoded parameters shall be "senha=violeta&nome=tre&enviar=Enviar" (https://www.trivial.com.br/envia_arq2.htm?senha=violeta&nome=tre&enviar=Enviar)? -- Carlos
  8. Thanks to both of you for your input, very much appreciated. I'll comeback and post the results. -- Carlos
  9. Dear All, I need to fill two fields in a form and then submit it. As I'm not well versed in this area, I come here and for some guidance. The page where they sit is coded as follows: <html> <body> <form id="form1" name="form1" action="envia_arq2.php" method="post"> Senha: <input TYPE="password" NAME="senha" SIZE="12"><br /><br /> Seu nome: <input TYPE="text" NAME="nome" SIZE="12"> <input name="enviar" type="submit" value="Enviar"> </form> </body> </html> This is a FMX application, so I can't use TWebBrowser as I've found in several articles in the internet. Furthermore, even the VCL version I couldn't make work, after navigating to the page the Document property is nil, making it impossible to retrieve the fields as indicated in those articles. I then moved on to ICS TSslHttpCli, tried a few basic things, but I came up empty on the very first attempt where I just set the URL (https://www.trivial.com.br/envia_arq2.htm) and did a GET to try and see how to proceed from there. An exception is raised signaling a missing SSL Context. Perhaps this is not the way to go. Could you please kindly share some light on this? Thanks in advance. -- Carlos
  10. It was past time I'd come back and share my conclusion. I'm not well versed in OOP, I'm just an old dog — *very* old, btw — and lack the mind sharpness I used to have back in the day. The best I could come up with in order to make the implementation independent was to drop the interface approach completely and go the abstract class way. That better implementation tool or technology waiting around the corner will pose no problem. Also, they tend to be simple classes since they model data entry controls, so they don't require exhaustive testing. Thank you all for the input provided. Best, Carlols
  11. Hi @pcplayer99 Thank you very much for your input. I went on with it just for the sake of my overdoing things impetus, and it worked all right. But, in the end, I think it's just not worth it, a lot of extra coding to get a hell of a kludge. On the bright side I now have a better understanding of the border separating "creatables" and "injectables". -- Carlos
  12. @David Champion Thank you very much, I'll look into it right away. -- Carlos
  13. I've failed to mention it is for a FMX application, so dataware is not possible. Once again, than you very much for your input, I'll try not to overdo things which, unfortunately, I only notice way down the road.
  14. Hello Stefan. Yes, there is. And I remember you've told so some time ago, when I was toying with REST DataSnap and run into a similar situation. What bothers me is that if I need to create objects for every UI class a great deal of decoupling will be gone. In your opinion, the use of an intermediate abstract class is too much of a kludge or a time bomb just waiting for the worst possible moment to explode in face? On the other hand, thinking while typing this reply, if I skip the interface declaration for UI objects, and stick to abstract classes to hide the implementation details, I'll be as good as, right? Well, they joy of old dogs insisting in learning new tricks, senile moments get in the way mora and more. 🙂 Thank you so much for your time.
  15. Dear fellow programmers, I'm trying to stick to Nick Hodges advice and keep the code loosely coupled, separating business from presentation, and observing oop principles. In order to accomplish this I: 1) code against interfaces; 2) adopted a sort of MVVM design pattern. Sort of because i don't really understand the difference among MVVM, MVC, MVP, etc. I thought that if I have business logic, view logic and persistence logic in separated units, apart from the views, and fully testable, I'd would be Ok to go; 3) I use Spring4D all around because in the future I want to take advantage of it's dependency injection capabilities. When it came to implement LiveBindings I stumbled into a problem: in order to create the adapters I need the actual classes, and to make the class implementation details visible in the module I call ViewModel would defeat all the isolation I accomplished so far. The solution I came up with is to keep interfaces in one module, implement them with abstract classes in another codeless module, and inherit from them and writing all the code in a third unit. I could keep the interface and it's abstract implementation in the same unit, both have no code, or separated and add another level of organization. That said, I kindly ask for your input on the solution I came up with. My goal is to keep Nick happy with interfaces, keep Delphi happy with classes, and myself happy with Spring4D. Is this the way to go or is there a better solution? Thank you so very much in advance . Best regards, Carlos Tré