Recent

Author Topic: Get and post request to URL  (Read 35488 times)

torbente

  • Sr. Member
  • ****
  • Posts: 325
    • Noso Main Page
Re: Get and post request to URL
« Reply #15 on: January 26, 2018, 06:03:03 pm »
Since you're on windows it's very easy. Just uninstall the old version, then install the new one with the installer. Make sure you delete the old config files.

I have LOT of packages installed. Will i need reinstall all those packages?

Best to use the official repositories  or fpcupdeluxe to upgrade.

Any link please?

EDIT: Downloading last version
« Last Edit: January 26, 2018, 06:09:59 pm by torbente »
Noso Cryptocurrency Main Developer
https://github.com/DevTeamNoso/NosoWallet

balazsszekely

  • Guest
Re: Get and post request to URL
« Reply #16 on: January 26, 2018, 06:10:26 pm »
@torbente
There is an Online Package Manager in Lazarus 1.8 with 130 + packages, most of them up to date. Installing packages is pretty much automated so it shuldn't be a problem. If you are still afraid you can install a separate instance of Lazarus which do not interfere with your current installation, for this use FPCUpDeluxe: https://github.com/newpascal/fpcupdeluxe/releases/tag/v1.6.0m

magikfingerz

  • Newbie
  • Posts: 5
Re: Get and post request to URL
« Reply #17 on: January 26, 2018, 07:13:46 pm »
@torbente
There is an Online Package Manager in Lazarus 1.8 with 130 + packages, most of them up to date. Installing packages is pretty much automated so it shuldn't be a problem. If you are still afraid you can install a separate instance of Lazarus which do not interfere with your current installation, for this use FPCUpDeluxe: https://github.com/newpascal/fpcupdeluxe/releases/tag/v1.6.0m
.. and before you ask, is a simple 2-step procedure. After download the file, run it and simply do this: 1.- Choose a path where you want to install lazarus (default is c:\fpcupdeluxe) and 2.- press the button "stable", this will install the latest stable version of lazarus and FPC. Btw. go for a coffee and relax... it will take time... :)

torbente

  • Sr. Member
  • ****
  • Posts: 325
    • Noso Main Page
Re: Get and post request to URL
« Reply #18 on: January 26, 2018, 10:13:17 pm »
I uninstalled the old version and installed the new one (1.8.0)

I now receive a warning when launch lazarus : "Can not open "editortoolbar" pacl. This pack is marked to be installed", but the IDE opens anyway.

I try runing the Post Request function and now it runs but very buggy. Sometimes i receive "Could not initialize OpenSSL library", sometimes runs normally but suddenly the aplication closes without error or warning message, and sometimes i recevie a SIGSEV error.

Lazarus seems a lot more complicated than what i remember some years ago  %)
Noso Cryptocurrency Main Developer
https://github.com/DevTeamNoso/NosoWallet

balazsszekely

  • Guest
Re: Get and post request to URL
« Reply #19 on: January 26, 2018, 10:58:39 pm »
Quote
I now receive a warning when launch lazarus : "Can not open "editortoolbar" pacl.
You did not delete the old config directory did you?

Quote
Lazarus seems a lot more complicated than what i remember some years ago  %)
No is not. It's much simpler with 1.8 in my opinion. Please attach a demo program so we can run a few test.

torbente

  • Sr. Member
  • ****
  • Posts: 325
    • Noso Main Page
Re: Get and post request to URL
« Reply #20 on: January 27, 2018, 01:01:28 am »
Quote
Quote
Quote
You did not delete the old config directory did you?

ehhh.. i think no.... :'(

Quote
No is not. It's much simpler with 1.8 in my opinion. Please attach a demo program so we can run a few test.

Ok, i will "clean" the code since im just developong the necessary functions/procedures before start with the final make up
Noso Cryptocurrency Main Developer
https://github.com/DevTeamNoso/NosoWallet

torbente

  • Sr. Member
  • ****
  • Posts: 325
    • Noso Main Page
Re: Get and post request to URL
« Reply #21 on: January 28, 2018, 04:50:22 pm »
Uninstalled lazarus again and reinstalled v1.8.0 deleting the previous config. Now lazarus runs without previous warning.

Form1 contains: 2 stringgrids, 2 timers and 1 memo (only for debug).

Now, im receiving the "Could not initialize SSL library" error but i can see the program running as expected until i close it. I guess is something with threads, but not sure.

Noso Cryptocurrency Main Developer
https://github.com/DevTeamNoso/NosoWallet

balazsszekely

  • Guest
Re: Get and post request to URL
« Reply #22 on: January 28, 2018, 05:12:09 pm »
@torbente

Before we continue, download the following example from here(ssl libraries included): http://packages.lazarus-ide.org/test/test.zip and test if it works or not. (I assume you use Lazarus 32 bit, if not let me know).


PS: I also a attach the test project here without the ssl libraries.

torbente

  • Sr. Member
  • ****
  • Posts: 325
    • Noso Main Page
Re: Get and post request to URL
« Reply #23 on: January 28, 2018, 05:17:27 pm »
It runs without error on my machine.
Yes, i am using 32 bit.
The test runs perfect even if i delete the OpenSSL libraries from its directory (remember i have both libraries in my windows/system)

@torbente

Before we continue, download the following example from here(ssl libraries included): http://packages.lazarus-ide.org/test/test.zip and test if it works or not. (I assume you use Lazarus 32 bit, if not let me know).


PS: I also a attach the test project here without the ssl libraries.
« Last Edit: January 28, 2018, 05:21:27 pm by torbente »
Noso Cryptocurrency Main Developer
https://github.com/DevTeamNoso/NosoWallet

balazsszekely

  • Guest
Re: Get and post request to URL
« Reply #24 on: January 28, 2018, 05:39:06 pm »
@torbente
Quote
The test runs perfect even if i delete the OpenSSL libraries from its directory (remember i have both libraries in my windows/system)
Good! Then it's nothing wrong with Lazarus 1.8/FPC 3.0.4, but that's not a surprise. :D I will take a look at your project tomorrow, but please attach a zip file with the whole project, not just a txt file. You can cut it down to bare minimum.
Until then instead of BeginThread started from a timer, you should switch to a TThread, if you need an internal timing mechanism you can do it inside the thread.

torbente

  • Sr. Member
  • ****
  • Posts: 325
    • Noso Main Page
Re: Get and post request to URL
« Reply #25 on: January 28, 2018, 05:53:39 pm »
Here is my entire project until now (GetSignature and PostRequest not yet added since those functions do not make sense until i can fix the SSL issue)

Before make those changes with BeginThread (changes i actually do not know how to do), could you test it one moment? The prject runs perfect here if i remove calls from procedure TForm1.Timer2Timer (HTTP only) but if i make calls to HTTPS the problems begins.

EDIT: This is the issue: Note that the app is receiving the info properly, but lazarus throws an error anyway.

https://imageshack.com/a/img924/632/AWx8k0.png
« Last Edit: January 28, 2018, 06:16:23 pm by torbente »
Noso Cryptocurrency Main Developer
https://github.com/DevTeamNoso/NosoWallet

balazsszekely

  • Guest
Re: Get and post request to URL
« Reply #26 on: January 28, 2018, 06:12:12 pm »
Quote
Before make those changes with BeginThread (changes i actually do not know how to do), could you test it one moment?
I cannot open your project.

torbente

  • Sr. Member
  • ****
  • Posts: 325
    • Noso Main Page
Re: Get and post request to URL
« Reply #27 on: January 28, 2018, 06:18:30 pm »
Quote
I cannot open your project.
Somehting wrong with the files i uploaded?

I have a new info: i believe the problem is when the app sends 2 request to HTTPS sites at the same time (if timer2 only makes requests to 1 site the app works perfect)  That is a big issue for me, since it is supossed that the app will manage many HTTPS request at the same time.
« Last Edit: January 28, 2018, 06:28:37 pm by torbente »
Noso Cryptocurrency Main Developer
https://github.com/DevTeamNoso/NosoWallet

rvk

  • Hero Member
  • *****
  • Posts: 7044
Re: Get and post request to URL
« Reply #28 on: January 28, 2018, 06:28:49 pm »
Quote
I cannot open your project.
Somehting wrong with the files i uploaded?
Yes,

Choose Project > Project inspector.
You have a "hard path" coded for mastertraderunit1.pas

See attached image.

Removing it and adding it again should work though.
« Last Edit: January 28, 2018, 06:30:35 pm by rvk »

rvk

  • Hero Member
  • *****
  • Posts: 7044
Re: Get and post request to URL
« Reply #29 on: January 28, 2018, 06:51:00 pm »
I do get the same OpenSSL error.
(Edit: It's probably a thread problem, see edit below)

Note that Update_BitStamp does work correctly.
Only the call to Update_BitFinex gives the error.

Maybe api.bitfinex.com uses some SSL protocol which needs extra attention. (not sure yet what)

Also note that calling GetJSON(Read_URL_GET('url')) isn't really wise. When Read_URL_GET fails you don't have the option to catch that before reading an empty string into JSON. It would be wise to first read it into a string and then call GetJSON with that string.

Also... do I see correctly that you have switched the cells for bitfinex and bitstamp?

Edit: I think the problem is calling the OpenSSL libraries in multiple threads at the same time. Try to call them one at a time and it should go correctly.

I believe OpenSSL can be used in multi-thread but the calling library needs to be aware of those threads and I don't thing the one in FPC is. (https://www.openssl.org/blog/blog/2017/02/21/threads/)
« Last Edit: January 28, 2018, 06:58:58 pm by rvk »

 

TinyPortal © 2005-2018