Jump to content

Angus Robertson

Members
  • Content Count

    2010
  • Joined

  • Last visited

  • Days Won

    36

Everything posted by Angus Robertson

  1. URL encoding for GET and POST is the same, although POST may accept Json or XML instead. Don't like + for space, should always be %20. The + originates from browser form fields with application/x-www-form-urlencoded MIME POST content, and should not be used in URLs or parameters. Angus
  2. THttpCli does not encode any parameters, you added that coding, so if the URL does not work you need to correct your code as I suggested yesterday. Angus
  3. The server has decided it does not like your parameter encoding, but you don't say you how you do it. Generally, you encode to UTF8 first, then use IcsUrlEncode for each parameter, then combine the parameters. But there are variations on URL encoding, the latest beta has a new strict parameter for Twitter which is very fussy. The better way is to change your application to use TSslHttpRest component, which has RestParams that do all this stuff for you, mostly correctly. . But update to at least V8.64 first, or even the overnight zip, there have been a lot of changes this year. Angus
  4. Angus Robertson

    TriggerSendData

    I've made TriggerSendData virtual in wsocket, most other triggers are already virtual but guess no other component needed to override until now. The change will be in the overnight zip later this week. Angus
  5. Angus Robertson

    SSL GetRemoteFile not transferring the whole image

    THttpsGetFile was probably one of the many Usermade components written 20 years ago and not touched since. But he now has a modern version. TIcsHttpMulti. Angus
  6. Angus Robertson

    SSL GetRemoteFile not transferring the whole image

    As I said, it may use ICS components, but is not part of the ICS distribution. Need to see the source code to know who wrote it and how. For simple file downloads build the OverbyteIcsXferTst.dpr sample and try HTTP Downloads. Angus
  7. Angus Robertson

    SSL GetRemoteFile not transferring the whole image

    THttpsGetFile is not an ICS component. It may be derived from an ICS component, but you need to ask whoever wrote it. Angus
  8. Angus Robertson

    HTTP/1.1 + 302 + Cloudflare = 404

    If you really need progress indication, make sure you don't update it more than once a second, certainly not every time the onDocData event is called. Doing so will slow down your transfers due to the overhead of updating the screen control so often. Look at the TIcsHttpMulti.onHttpDataEvent function in OverbyteIcsHttpMulti.pas, which is another new component specifically designed for downloading files, from a list of URLs or by parsing an HTML page, it checks for existing older versions of the files which are updated if newer. The sample is OverbyteIcsXferTst1.dpr. Angus
  9. Angus Robertson

    HTTP/1.1 + 302 + Cloudflare = 404

    I used your URL with the OverbyteIcsHttpRestTst sample, and it works perfectly with http/1.1 and Cloudfare and correctly redirects to your executable and downloads it: < Content-Type: application/x-executable < Content-Length: 5286400 You are assuming DocBegin is only called for a successful 200 request, when it is called otherwise. Not sure why you want a download bar, they were useful 20 years ago with slow downloads, or for very large files, but 5MB comes down in a couple of seconds in the modern world. You may want to consider changing to use TSslHttpRest which will simplify your application and make it more robust and future proof, you don't really need any events. Angus
  10. Angus Robertson

    HTTP/1.1 + 302 + Cloudflare = 404

    It is unlikely to be related to chunking, this fails before the body is processed. You can not disable chunking at the client, only the server. All I need is the URL that fails, not demos. Angus
  11. Angus Robertson

    HTTP/1.1 + 302 + Cloudflare = 404

    Looks like a bug in the ICS relocation code, which is quite complex, messy and hard to maintain, but I will not look at it without being able to reproduce the problem, not interested in logs, although someone else may spot the problem from them. Angus
  12. Angus Robertson

    Class TSslHttpCli not found - DELPHI5

    The most common reason for altering HttpPror.pas was to add extra HTTP headers that the early versions did not support directly, although they could be added using events. Typically authentication headers. But a lot has changed over the years, there are many new authentication methods supported and a new property ExtraHeaders for unusual headers. Angus
  13. Angus Robertson

    Class TSslHttpCli not found - DELPHI5

    Not sure which certificates you are referring to, HTTPS clients receive certificates from servers, and can check they are legitimate, but can accept them anyway. In rare high security cases HTTPS clients have a certificate to prove their identity issued by a company they want to access, mostly VPNs, but any you had 13 years ago will be useless now. Angus
  14. Angus Robertson

    ICS crash

    Yes, OnSessionConnected event is fired for UDP, but should be virtually instantaneous since no traffic is sent, you should have waited until the state changed before sending anything, but send would just fail and you are ignoring errors and it would not explain the exception. Angus
  15. Angus Robertson

    ICS crash

    Using a redundant MessagePump without threads is untested and certainly serves no purpose before making any requests or listening. If you remove it, does the code work? The LocalIPList function is an easier way to get a list of addresses as strings, you need to set family and IPPROTO_UDP protocol, the default is TCP only. Angus
  16. Angus Robertson

    ICS crash

    I have never seen a message pump crash with ICS. But I know using a non-existent interface will fail. Been a long time since I did a project with UDP broadcasts. Angus
  17. Angus Robertson

    ICS crash

    If you are connecting to another device, you don't need to set a local IP address, use 0.0.0.0 and let Windows worry about it. Sometimes interfaces come and go, that could cause an error. Local address is really for listening sockets, although can be used on servers with multiple IP addresses to select an outgoing address. Angus
  18. Angus Robertson

    Class TSslHttpCli not found - DELPHI5

    The version of OpenSSL that ICS v5 used will not work today, the protocols have changed since then. It may be worth trying to build a subset of ICS v8 with Delphi 5, language wise it was really 64-bit streams I think which you could change, not sure when Int64 came in, that would be harder. There are also minimum version checks you'd have to disable. Or get Delphi 7 or 2007 and upgrade your project, fewer changes and testing than unicode versions, unless a simple project. Angus
  19. I have a stress testing tool ComGen, written using ICS, that will generate multiple TCP or UDP streams (or serial RS232), short or long, sending variable volumes of custom data including HTTP,, with or without SSL/TLS. It will create up to 2,000 client simultaneous connections, with x per second, that was used for testing SSL Socket Server where the SSL connection overhead restricts how many connections a single thread can accept per second. This is all done in a single thread. ComGen is part of my ComCap package (ComCap collects data) but can be used on it;s own. Angus
  20. Angus Robertson

    Trying to move from SslContext to ICSHosts

    There is a new ICS Multi Host FTP Server sample using IcsHosts in the overnight zip, really designed to be a Windows service application. It supports multiple SSL hosts with multiple listeners, can order it's own SSL certificates and will create self signed certificates for any missing, and will email status information and errors to an administrator. Angus
  21. Angus Robertson

    FTP and non SSL

    If you connect on port 21, SSL only starts if you send the AUTH command, The SslType method specifies how AUTH is used, but won't stop it. Angus
  22. Angus Robertson

    general question about embedding docs in an app

    Because pure Delphi renderers are far less likely to have security holes than proper browsers, partly because they don't usually run scripts, but you also have control over what external links they load if any. We all know clicking on dodgy email links is the main way nasties like ransomware gets onto networks, sometimes just displaying an external web page. Sure they don't usually handle all the latest browser capabilities, but that is the compromise you make for safely, and you design your pages to match their capability. ICS includes a Web Browser sample using the THtmlViewer component with tick boxes to enable or disable links and external graphics. and also log all HTML and HTTPS protocol. Angus
  23. Angus Robertson

    Automatically killing a service when stuck

    While services should be stopped by the service manager, this won't work if if the main thread in the service has stopped and messages are not being processed. So you need a backup after repeated stop attempts with timeouts fail. the equivalent of End Task in Task Manager which sometimes is needed to stop non-responding applications. I've done this with TerminateProcess which needs a process handle which you can get from a process ID, which requires searching the process list to match exe names. I did this from a second service that monitored the first, making sure the message queue was working and a few other things. The second service also sent emails so this could be checked manually to make sure it restarted ok. Service manager should already be set-up to immediately restart a stopped service, so that part is easy once it stops. Angus
  24. Angus Robertson

    How to use TSslHttpRest?

    Build and test the OverbyteIcsHttpRestTst.dpr sample. The OverbyteIcsSslHttpRest.pas unit itself has several examples of how to create new components using TSslHttpRest like TIcsSMS, ,TIcsTwitter, TDnsQueryHttps (DoH) and real soon TIcsRestEmail for GMail. All with demos in OverbyteIcsHttpRestTst.dpr. Angus
  25. Totally agree, I have no intention of vegatating in front of day time TV, which is why I still work on ICS. At leat while Moorfields Hospital keeps my eyes working, victims of diabetes. Angus
×