Recent

Author Topic: TfpHTTPClient - AllowRedirect not a member  (Read 2319 times)

Awesome Programmer

  • Sr. Member
  • ****
  • Posts: 421
  • Programming is FUN only when it works :)
    • Cool Technology
TfpHTTPClient - AllowRedirect not a member
« on: March 05, 2019, 06:13:35 pm »
I am trying to compile the demo for TMapViewer after downloading and installing its package. Compiler keeps saying AllowRedirect is not a member and quits. It looks like AllowRedirect is suppose to be found within TfpHttpClient and it is not found.

Has anyone seen this bug before? Please, help. Thank you.

dsiders

  • Full Member
  • ***
  • Posts: 225
Re: TfpHTTPClient - AllowRedirect not a member
« Reply #1 on: March 05, 2019, 06:30:40 pm »
I am trying to compile the demo for TMapViewer after downloading and installing its package. Compiler keeps saying AllowRedirect is not a member and quits. It looks like AllowRedirect is suppose to be found within TfpHttpClient and it is not found.

Has anyone seen this bug before? Please, help. Thank you.

AllowRedirect is present in FPC 3.0.4. What version are you using?

It was added in Mar 2013 in rev 23677, so it's been there for some time.
« Last Edit: March 05, 2019, 06:45:09 pm by dsiders »
Lazarus 2.0.4 / FPC 3.0.4 / Windows 8.1 64-bit

Awesome Programmer

  • Sr. Member
  • ****
  • Posts: 421
  • Programming is FUN only when it works :)
    • Cool Technology
Re: TfpHTTPClient - AllowRedirect not a member
« Reply #2 on: March 05, 2019, 07:39:15 pm »
Oh :-[

I didn't know that...
my fpc is 2.6.4

So, can I just update fl-web folder with the latest files?

lucamar

  • Hero Member
  • *****
  • Posts: 2081
Re: TfpHTTPClient - AllowRedirect not a member
« Reply #3 on: March 05, 2019, 08:06:57 pm »
So, can I just update fl-web folder with the latest files?

You can try. Or you could bite the bullet and update your installation to, at least, FPC 3.0.4
Turbo Pascal 3 CP/M - Amstrad PCW 8256 (512 KB !!!) :P
Lazarus 2.0.2/2.0.4  - FPC 3.0.4 on:
(K|L)Ubuntu 12..16, Windows XP SP3, various DOSes.

Awesome Programmer

  • Sr. Member
  • ****
  • Posts: 421
  • Programming is FUN only when it works :)
    • Cool Technology
Re: TfpHTTPClient - AllowRedirect not a member
« Reply #4 on: March 05, 2019, 08:47:11 pm »
hi lucamar

Well, for the heck of it I took your advice and replaced just the folder fcl-web with the latest fcl-web I found on SourceForge website. I did check to make sure that fpHttpClient.pas file had AllowRedirect and IT IS. At this point, I thought I was home free... Unfortunately, When I compile TMapViewer demo Lazarus keep reporting that AllowRedirect is not a MEMBER, even though Lazarus is able to see that fpHttpClient has AllowRedirect property now.

Any idea? why? Should I reboot my system? or should I go ahead and replace the WHOLE fpcsrc folder? The interesting thing to note here, lucamar, is that TMapViewer demo is UP and RUNNING even though it is not fully running. I am able to move around and zoom in and out on the map. However, it is very choppy and any time I switch to a different type of map, it crashes...
« Last Edit: March 05, 2019, 08:50:30 pm by Awesome Programmer »

jmpessoa

  • Hero Member
  • *****
  • Posts: 1470
Re: TfpHTTPClient - AllowRedirect not a member
« Reply #5 on: March 05, 2019, 09:12:22 pm »


What about

"Run"  --> "Clean up and Build..."
Lamw: Lazarus Android Module Wizard
https://github.com/jmpessoa/lazandroidmodulewizard

lucamar

  • Hero Member
  • *****
  • Posts: 2081
Re: TfpHTTPClient - AllowRedirect not a member
« Reply #6 on: March 05, 2019, 10:19:48 pm »
When Lazarus compiles your project and searches in the lcl, fcl, rtl, etc. it looks only in the pre-compiled archives' .ppu

Even if you replace the source folder, it's not recompiled unless you do it specifically, by hand or otherwise.

What about
"Run"  --> "Clean up and Build..."

That wion't work either, because it refers only to the current project unless you select also "Package output directories" ... in which case it will clean-up and rebuild almost the whole LCL and FCL, any packages you're using, etc. (see attached image)
« Last Edit: March 05, 2019, 10:28:14 pm by lucamar »
Turbo Pascal 3 CP/M - Amstrad PCW 8256 (512 KB !!!) :P
Lazarus 2.0.2/2.0.4  - FPC 3.0.4 on:
(K|L)Ubuntu 12..16, Windows XP SP3, various DOSes.

wp

  • Hero Member
  • *****
  • Posts: 6337
Re: TfpHTTPClient - AllowRedirect not a member
« Reply #7 on: March 05, 2019, 10:34:14 pm »
You still did not tell us your Lazarus/fpc versions. You could try to copy the new fphttpclient unit into the LazMapviewer source folder so that it will be compiled hopefully. But depending on your fpc version the new fphttpclient may use features not supported by your compiler.

But what is so bad about installing fpc 3.0.4?

In the current version of LazViewer you can also use Synapse instead of fphttpclient to load the maps: Put a TMVDESynapse component on the main form of the demo and link it to the property "DownloadEngine" of the MapView.

As for the crashes: I just tested the demo. All maps are working except for the Ovi maps: 'Host name resolution for "b.maptile.maps.svc.ovi.com" failed.' Probably, this url is no longer valid.
Lazarus trunk / fpc 3.0.4 / all 32-bit on Win-10

lucamar

  • Hero Member
  • *****
  • Posts: 2081
Re: TfpHTTPClient - AllowRedirect not a member
« Reply #8 on: March 05, 2019, 10:51:51 pm »
You still did not tell us your Lazarus/fpc versions.
He said he's using FPC 2.6.4, so his Lazarus is probably one of the 1.4 series, IIRC.
Turbo Pascal 3 CP/M - Amstrad PCW 8256 (512 KB !!!) :P
Lazarus 2.0.2/2.0.4  - FPC 3.0.4 on:
(K|L)Ubuntu 12..16, Windows XP SP3, various DOSes.

wp

  • Hero Member
  • *****
  • Posts: 6337
Re: TfpHTTPClient - AllowRedirect not a member
« Reply #9 on: March 06, 2019, 12:31:41 am »
After copying the fpc3.0.4-fphttpclient into the LazMapViewer source folder the package does not compile with Laz 1.4.4/fpc 2.6.4. You can compile the package, however, with the original fphttpclient of fpc 2.6.4 if you comment the offending line with AllowRedirect. This is enough to run the demo and play with it. However, you cannot execute the city name search which results in an error 302 (redirection).

Using the Synapse download engine with Laz 1.4.4/fpc 2.6.4 works too, but again there is the 302 error. Please download the new MapViewer version from ccr in which this issue is fixed.
Lazarus trunk / fpc 3.0.4 / all 32-bit on Win-10

Awesome Programmer

  • Sr. Member
  • ****
  • Posts: 421
  • Programming is FUN only when it works :)
    • Cool Technology
Re: TfpHTTPClient - AllowRedirect not a member
« Reply #10 on: March 06, 2019, 06:33:51 am »
Hi wp and lucamar

You guys do know your stuff that you figured out what version I am using. Well, I have had very bad experience upgrading to the latest version of Lazarus. Plus, some of the components I use don't seem to work with the latest Lazarus unless I am wrong. For instance, I must be able to install and use BGRA Controls in my project.

That's why I don't want to update the whole fpcsrc folder and brake the whole compiler and/or Lazarus setup only to start all over again. I have been there and done that and it is no fun getting back to square one...lol... Anyways, so what you are saying is that I have to either install the latest fpcsrc 3.0.4 and then rebuild Lazarus and packages with clean up + Build option or just install fpcsrc 3.0.4 and hope that it works.

By the way wp, yes I did have to comment out the offending line for the demo to successfully compile. However, my TMapViewer demo crashes anytime I do anything other than zooming in, zooming out and going to Longitude X and Latitude Y. If I do anything else, it throws RunError(211). That error as I found out has something to do with Call to abstract method Your program tried to execute an abstract virtual method. Abstract methods should be overridden, and the overriding method should be called.

When you okay the popup message box, it opens the assembler window with highlighted line CThread INIT something to do with cThread initialization.

jmpessoa
That's what I need to do first thing in the morning at work tomorrow. :)

I do want to say one thing. Even though Lazarus has bugs and holes, it is one fine compiler, if you know the way around it or how it all comes together in the background.  :)
« Last Edit: March 06, 2019, 06:39:06 am by Awesome Programmer »

dsiders

  • Full Member
  • ***
  • Posts: 225
Re: TfpHTTPClient - AllowRedirect not a member
« Reply #11 on: March 06, 2019, 07:13:53 am »
Well, I have had very bad experience upgrading to the latest version of Lazarus. Plus, some of the components I use don't seem to work with the latest Lazarus unless I am wrong. For instance, I must be able to install and use BGRA Controls in my project.

My experience with components is exactly the opposite. They put out new versions and pretty much expect you to have recent compilers and IDEs. And BGRA works just fine in FPC 3.0.4/Lazarus 2.0 (for me).

That's why I don't want to update the whole fpcsrc folder and brake the whole compiler and/or Lazarus setup only to start all over again. I have been there and done that and it is no fun getting back to square one...lol... Anyways, so what you are saying is that I have to either install the latest fpcsrc 3.0.4 and then rebuild Lazarus and packages with clean up + Build option or just install fpcsrc 3.0.4 and hope that it works.

IMO, if you install a partial 3.X source tree and try to use a 2.6 compiler, you'll be starting from scratch anyway. But it'll be a nice experiment. Let us know how that works out. ;)

I never have any big issues when I upgrade the compiler and/or the IDE. I use Windows. And a lot of components - including Indy. The last time I upgraded, I left my components in place and just did a Clean and Rebuild in the IDE. Didn't have to re-install a single thing. Of course I wasn't upgrading from a really old version of either tool.

Maybe I'd feel differently if I was using Linux and had to deal with its packaging issues.
Lazarus 2.0.4 / FPC 3.0.4 / Windows 8.1 64-bit

wp

  • Hero Member
  • *****
  • Posts: 6337
Re: TfpHTTPClient - AllowRedirect not a member
« Reply #12 on: March 06, 2019, 07:15:13 am »
I have had very bad experience upgrading to the latest version of Lazarus.
Latest? Assuming that you have Laz 1.4.4 your version is 7 release versions behind the current one!

For instance, I must be able to install and use BGRA Controls in my project.
These are much-used and well-maintained components. What makes you believe that after 7 release versions BGRA won't work any more?

That's why I don't want to update the whole fpcsrc folder and brake the whole compiler and/or Lazarus setup only to start all over again. I have been there and done that and it is no fun getting back to square one...lol... Anyways, so what you are saying is that I have to either install the latest fpcsrc 3.0.4 and then rebuild Lazarus and packages with clean up + Build option or just install fpcsrc 3.0.4 and hope that it works.
Use fpcupdeluxe to create a secondary up-to-date installation of fpc and Lazarus which does not interfere with the version that you normally use. Trying to compile fpc3.0.4 sources with a 2.6 compiler will fail. And it will destroy your currently working installation. Don't blame Lazarus/fpc for that.

By the way wp, yes I did have to comment out the offending line for the demo to successfully compile. However, my TMapViewer demo crashes anytime I do anything other than zooming in, zooming out and going to Longitude X and Latitude Y. If I do anything else, it throws RunError(211). That error as I found out has something to do with Call to abstract method Your program tried to execute an abstract virtual method. Abstract methods should be overridden, and the overriding method should be called.

When you okay the popup message box, it opens the assembler window with highlighted line CThread INIT something to do with cThread initialization.
My fault. I am normally working on Windows and usually fall into the Linux-trap: When you work on Linux and have issues with threads you must define UseThreads to add the unit cthreads to the project (or simply remove the {$IFDEF UseCThreads}...{$ENDIF} around "cthreads" in the project unit:
Code: Pascal  [Select]
  1. program MapViewer_Demo;
  2.  
  3. {$mode objfpc}{$H+}
  4.  
  5. uses
  6.   {$IFDEF UNIX}
  7.   cthreads,
  8.   {$ENDIF}
  9.   Interfaces,
  10. ...
« Last Edit: March 06, 2019, 07:28:29 am by wp »
Lazarus trunk / fpc 3.0.4 / all 32-bit on Win-10

Awesome Programmer

  • Sr. Member
  • ****
  • Posts: 421
  • Programming is FUN only when it works :)
    • Cool Technology
Re: TfpHTTPClient - AllowRedirect not a member
« Reply #13 on: March 06, 2019, 04:02:38 pm »
That's another thing too.

The window version of Lazarus is pretty much solid. I have used Lazarus on Windows and it rarely failed on me when it came to updating or upgrading Lazarus and its component. It is only on Linux OS that people seem to run into all sorts of issues. And by the way, 90% of the time I work on Linux OS and use Lazarus on them.

No I am not blaming Lazarus for anything. I am just pointing out what I am seeing and experiencing. If it wasn't for Lazarus, I would be working with totally different programming language and RE-WRITING my project from SCRATCH. Oh thank god for Lazarus. Because of Lazarus I was able to take 90% of my Windows Delphi project (about 200 different PAS files) and turn it into FreePascal or Lazarus compatible in no time. And then run my program on Linux OS within weeks instead of months... lol

Yes, that's the first thing I did for RunError (211) define UseThreads.

Anyways I will have to try out the latest suggestions.

Thanks,

Awesome Programmer

  • Sr. Member
  • ****
  • Posts: 421
  • Programming is FUN only when it works :)
    • Cool Technology
Re: TfpHTTPClient - AllowRedirect not a member
« Reply #14 on: March 06, 2019, 10:07:07 pm »
I am upgrading Lazarus and fpc to the latest and the greatest version. After installing the RPM files - fpc-src, fpc, lazarus, I start Lazarus and a window pops up showing lazarus, fpc-src, make and debugger is all fine but the COMPILER. Lazarus is complaining that it can't find the COMPILER. So, I looked in the folder /usr/bin/ and fpc compiler is there defined as an EXECUTABLE.

I downloaded the lazarus RPM files from sourceforge website and ran the following command on the terminal in the order it is listed below.

rpm -Uhv fpc-src
rpm -Uhv fpc
rpm -Uhv Lazarus

On top of all this, there is no Lazarus Shortcuts anywhere on my system after the install. I had to search for startlazarus file to start Lazarus app.

So, what am I doing wrong? fpc is found where it is suppose to be.
Please, help. Thank you.