Comments (23)
UrlFor
depends of TRequest.PathInfo
, and it must return the current PATH_INFO
. Can you execute the test below?:
procedure TMyAction.Request(ARequest: TRequest; AResponse: TResponse);
begin
Write(ARequest.PathInfo);
end;
initialization
TMyAction.Register('/a/b'); // call http://localhost/cgi-bin/cgi1/a/b
If you not got /a/b
on the browser, the problem is in FCL-Web for FastCGI.
from brookframework.
Yes, I do get /a/b on the browser. THome is registered with '*' pattern (and is set as default), would that be the problem? Since the pathinfo will be / (tested and proven), even if I give a non-existent path (because it's set as default).
from brookframework.
The 'problem' is in the FCL-Web for FastCGI. Using this code below:
procedure TMyAction.Request(ARequest: TRequest; AResponse: TResponse);
begin
Write(GetEnvironmentVariable('SCRIPT_NAME'));
end;
compiled for CGI and calling http://localhost/cgi-bin/cgi1
, the result is: /cgi-bin/cgi1
. But, compiled for FastCGI and calling http://localhost/cgi-bin/cgi1
, the result is empty.
So the problem isnt in Brook. :/ Open a entry in Free Pascal bugtracker?
from brookframework.
OK, but actually I don't know what's wrong with that. I mean, should SCRIPT_NAME be equal for both?
from brookframework.
I don't think so. :(
Please see: http://www.fastcgi.com/devkit/doc/fcgi-spec.html
from brookframework.
I'm still not sure what to report to FPC mantis (my brain has a problem reading specs :p), could you do that instead?
from brookframework.
I do not feel safe to report this due to limitation of my English. XD
So, what will we do hehehe?
It would be interesting to test a small FastCGI script in another programming language (Perl?) and check if it returns this variable.
from brookframework.
Oh god, Perl FCGI return the SCRIPT_NAME, please see:
http://brookframework.org/test.fbf
Response:
FastCGI Demo Page (perl)
This is coming from a FastCGI server.
Running on brookframework.org - /test.fbf to XXX
This is connection number 1
The code of this test:
#!/usr/bin/perl -wT
use strict;
use vars qw( $cnt );
use FCGI;
local $cnt = 0;
while ( FCGI::accept >= 0 ) {
print "Content-type: text/html\r\n\r\n";
print "<head>\n<title>FastCGI Demo Page (perl)</title>\n</head>\n";
print "<h1>FastCGI Demo Page (perl)</h1>\n";
print "This is coming from a FastCGI server.\n<BR>\n";
print "Running on <EM>$ENV{SERVER_NAME}-$ENV{SCRIPT_NAME}</EM> to <EM>$ENV{REMOTE_HOST}</EM>\n<BR>\n";
$cnt++;
print "This is connection number $cnt\n";
}
from brookframework.
Perhaps this report is enough: SCRIPT_NAME in a FastCGI application returns empty string. What do you think?
from brookframework.
Perfect! Send me the issue link after you submit.
from brookframework.
Could you try this first on Apache? In my Nginx, I don't even find SCRIPT_NAME at all...
from brookframework.
Yes:
http://brookframework.org/project1.fbf
But if I'm not mistaken, the FastCGI not read the informations directly from the environment variables.
But in my mind there is way to solve this easily: BrookSettings.RootUrl
. By default this property is filled by SCRIPT_NAME value. It seems a good idea? :)
from brookframework.
This will be implemented as soon as possible. :)
ps. Oh, sorry friend, I accidentally deleted your comment, but I pasted it below (copied from my Gmail). x(
2013/1/7 Mario Ray Mahardhika says:
But if I'm not mistaken, the FastCGI not read the informations directly
from the environment variables.I'll ask Michael to ensure.
But in my mind there is way to solve this easily: BrookSettings.RootUrl.
By default this property is filled by SCRIPT_NAME value. It seems a good
idea? :)Filled automatically on each request? Seems good.
from brookframework.
Hello Mario,
Done (685a03e).
Can you test it please?
Thanks! :)
from brookframework.
I implemented it in "working" branch (http://imagebin.org/243220).
from brookframework.
Tested and works, the documentation needs to be expanded though. It should say that RootURL must be filled in order for Redirect (or UrlFor) to work
from brookframework.
Guy, more adjusts: cb3fcb4
Can you help me to add more details on documentation? My translator is still on vacation hehehe...
from brookframework.
Nice?:
(...)
{ Set the default root URL. This is used by methods such as
@code(TBrookAction.UrlFor), @code(TBrookActionHelper.LinkTo),
@code(TBrookActionHelper.ButtonTo) etc. By default, Brook assumes
@code(SCRIPT_NAME) as root URL. }
RootUrl: string;
(...)
from brookframework.
By default, Brook assumes @code(SCRIPT_NAME) as root URL
Just to be sure, which code fills this field when it's empty?
from brookframework.
In the router:
1 - https://github.com/silvioprog/brookframework/blob/master/core/brookrouter.pas#L360
2 - https://github.com/silvioprog/brookframework/blob/master/core/brookrouter.pas#L368
from brookframework.
The new "pasdoc comment" for documentation is good?
from brookframework.
OK, then it's good.
from brookframework.
Done (538afb4). Thank you friend!
from brookframework.
Related Issues (20)
- Why plugins projects on github to brookframework is closing? HOT 4
- Telegram plugin for brookframework HOT 15
- i18n HOT 4
- Version 4 ? HOT 14
- libbrook.pas in Source HOT 3
- tardigrade demos throwing errors in libbrook HOT 4
- Server requirements? HOT 4
- dopf & LastInsertID HOT 4
- httprouter.lpr throwing error HOT 2
- How am I supposed to free worker thread in brook daemon? HOT 9
- Use legacy application with tardigrade HOT 19
- CPU Activity is high for tardigrade projects BROOK4 HOT 4
- More documentation HOT 1
- Can't get POST request data HOT 13
- Brookframework with sagui (legacy) HOT 11
- HTTP Client HOT 1
- Where did the captcha plugin for 4.0 go? HOT 1
- Some suggestion about JTemplate? HOT 3
- [IDEA] New repository HOT 1
- EBrookHTTPServer: Failed to send data in request for HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from brookframework.