Skip to content
This repository has been archived by the owner on Jan 25, 2019. It is now read-only.

Some issues in the wizard generated project (Lazarus) #1

Closed
leledumbo opened this issue Dec 17, 2012 · 13 comments
Closed

Some issues in the wizard generated project (Lazarus) #1

leledumbo opened this issue Dec 17, 2012 · 13 comments
Assignees
Labels

Comments

@leledumbo
Copy link
Collaborator

  • Action editor problem: cannot edit action. Whenever I press OK on action being edited, it always says: The action "" already exists. Steps:
    • Project->New Project->Full CGI / FastCGI application
    • Fill the form (whatever)
    • Actions form appear, click add
    • Give a name and OK
    • Back to actions form, select the newly created action and press edit
    • Simply press OK
  • HTTP_CHARSET_UTF_8 identifier in generated Brokers unit, should be BROOK_HTTP_CHARSET_UTF_8 (causes identifier not found)
  • Can't execute the resulting binary. Executing from IDE shows nothing, executing from terminal gives

Exception at 080AAAFA: Exception:
Failed to open input-handle passed from server. Socket Error: 88.

Lazarus 1.1 r38762 FPC 2.7.1 rXXXX (about 1 month old)

@ghost ghost assigned silvioprog Dec 18, 2012
@silvioprog
Copy link
Owner

Fixed (45df610). Please test it. Thank you! :)

@leledumbo
Copy link
Collaborator Author

Sorry for the late reply, just remembered about this issue. The charset problem is fixed, but action already exists and binary execution problem is still there. The problem is still exactly as above. Moreover, by default, the project is not runnable even though I choose FastCGI. Is this intended?

@leledumbo leledumbo reopened this Dec 25, 2012
@leledumbo
Copy link
Collaborator Author

Closed by mistake

@silvioprog
Copy link
Owner

No problem friend. These days I was away partying the Christmas. :)
Finally, the problem in action editor is solved (e3f5567). Now, I'm using the "Index" instead "Data" property.
About the "error 88", what's your environment (Linux, Windows, Apache ...)? I'm using Apache (32/64bit) on Linux and Windows, and it works fine with CGI and/or FastCGI.
The intended is to disable the "Run" button. You could to run a CGI inside the IDE? I've never tried it, because the CGI/FCGI depend of environment variables to work.

@leledumbo
Copy link
Collaborator Author

OK, I'll pull again.
About error 88, I'm using Nginx on 32-bit Linux. Nginx doesn't manage the FastCGI binary by itself and we have to start the binary ourselves. Moreover, I'll need to run from IDE in order to debug. That's what I did with my fpweb projects.

@silvioprog
Copy link
Owner

If the error in the action editor occurs again, we will solve it.
I have the Linux Mint (64bit), I'll try to install Nginx to reproduce the problem with error 88.
So, by default, fpWeb keeps the Run button enabled? If yes, I may change the brookex to maintain compatibility with fpWeb.

@leledumbo
Copy link
Collaborator Author

Yes, even it's enabled for CGI, though it's relevant only in FastCGI.

@silvioprog
Copy link
Owner

Hm... so it would be interesting to let enabled for CGI and FastCGI?

@silvioprog
Copy link
Owner

[I'm downloading the Nginx for Windows to reproduce the error 88: http://nginx.org/en/docs/windows.html]

@leledumbo
Copy link
Collaborator Author

I'd say let it enabled for FastCGI only.
You don't need to download any webserver, since the error happens immediately after starting the binary.

@silvioprog
Copy link
Owner

Now the Run button is enabled for FastCGI applications (a8e0cfc). Thank you!

Yes, after starting the binary, I got:

C:\Users\silvioprog\Desktop\fcgi>cgi1.exe
Exception at 00434BAC: Exception:
Failed to open input-handle passed from server. Socket Error: 6.

But...

For FastCGI applications, maybe you must be specify the port. Please test this demo, I specified a port (2015) to it:

http://www.sendspace.com/file/mwm0ct

In two pictures below, see FastCGI working:

1 - http://imagebin.org/240843
2 - http://imagebin.org/240844

I think that it will work now for you. :)

@leledumbo
Copy link
Collaborator Author

YES!!! IT WORKS!!! I'll keep exploring the framework, it's damn big.
Now that you know FastCGI requires Port to be set, would you modify the generated project? IMO, it's better to put the Port initialization in the .lpr, but if you want to put it in Brokers (I don't really know what's this unit's job actually, request broker?), that's fine.

@silvioprog
Copy link
Owner

Nice job guy! 👍

The Port is necessary when you use FastCGI manually (starting the executable via terminal). Using automatically (for example, in Apache) the Port used is the default.

In Brokers unit you configure any part of your application. The idea is exactly have a central point for you find everything related to initializations and settings. :)
E.g (pseudo example):

unit Brokers;

{$mode objfpc}{$H+}

interface

uses
  BrookApplication, BrookFCLCGIBroker, BrookSQLdbBroker, SQLite3Conn,
  BrookUtils, Classes, SysUtils;

implementation

var
  App: TBrookCGIApplication;
  EnvVars: TStringList;

initialization
  EnvVars := TStringList.Create;
  App := TBrookCGIApplication(BrookApp.Instance);
  App.GetCGIVarList(EnvVars);
  App.Email := 'webmaster@localhost';
  App.ApplicationURL := 'http://localhost';
  App.RedirectOnError := True;
  App.RedirectOnErrorURL := 'http://localhost/500.html';
  BrookSettings.Configuration := 'db.cfg';
  BrookSettings.Page404 :=
    '<html><head><title>Page not found</title></head><body>' +
    '<h1>404 - Page not found</h1></body></html>';

finalization
  FreeAndNil(EnvVars);

end.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants