wifang / mollify

Automatically exported from code.google.com/p/mollify
0 stars 0 forks source link

Unable to resolve address host #317

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. install in the intranet lan
2. go to backend/admin url
3. I get this error

last version of mollify

(if I open backend/admin url from localhost pc all works fine)

error:

MySQL DB: upload_user@localhost:upload(up_) port= 
socket=/tmp/mysql5.sock,VERSION: 1.8.4.4 SERVER: 
{HTTP_X_REQUESTED_WITH:XMLHttpRequest, HTTP_MOLLIFY_HTTP_METHOD:GET, 
HTTP_COOKIE:div_filter_reportsmanager=N; 
MOLLIFY-SESSION=g061k45gva5nd1rj1888umal21, SystemRoot:C:\WINDOWS, 
COMSPEC:C:\WINDOWS\system32\cmd.exe, 
PATHEXT:.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH, WINDIR:C:\WINDOWS, 
SCRIPT_FILENAME:C:/www/upload/backend/r.php, SERVER_PROTOCOL:HTTP/1.1, 
REQUEST_METHOD:GET, QUERY_STRING:type=admin, 
REQUEST_URI:/upload/backend/r.php/session/info/3?type=admin, 
SCRIPT_NAME:/upload/backend/r.php, PATH_INFO:/session/info/3, 
PATH_TRANSLATED:C:\www\session\info\3, 
PHP_SELF:/upload/backend/r.php/session/info/3, 
REQUEST_TIME:1320617491},SETTINGS: {debug:1},CONFIGURATION PROVIDER 
(MySQLConfiguration): supported features={0:change_password, 1:descriptions, 
2:administration, 3:user_groups, 4:permission_inheritance} auth=1,FEATURES: 
{limited_http_methods:, file_upload:1, folder_actions:1, file_upload_progress:, 
zip_download:, change_password:1, descriptions:1, administration:1, 
user_groups:1, public_links:, mail_notification:, retrieve_url:, 
folder_protection:},FILESYSTEM: allowed_file_upload_types={},SESSION: {},AUTH: 
is_authentication_required=1, is_authenticated=,REQUEST: method=get, 
path={0:session, 1:info, 2:3}, ip=10.220.101.224, params={type:admin}, 
data=,SERVICE (SessionServices): is_auth_required=,No authenticated session 
active,Requesting session info for protocol version 3,ServiceException: Cannot 
resolve 
host=,{0:{file:C:\www\upload\backend\include\ServiceEnvironment.class.php, 
line:210, function:getHost, class:ServiceEnvironment, type:->, args:{}}, 
1:{file:C:\www\upload\backend\include\ServiceEnvironment.class.php, line:184, 
function:getRootUrl, class:ServiceEnvironment, type:->, args:{}}, 
2:{file:C:\www\upload\backend\include\ServiceEnvironment.class.php, line:176, 
function:getResourceUrl, class:ServiceEnvironment, type:->, args:{0:plugin/}}, 
3:{file:C:\www\upload\backend\include\services\SessionServices.class.php, 
line:78, function:getPluginBaseUrl, class:ServiceEnvironment, type:->, 
args:{}}, 
4:{file:C:\www\upload\backend\include\services\SessionServices.class.php, 
line:40, function:getSessionInfo, class:SessionServices, type:->, args:{0:3}}, 
5:{file:C:\www\upload\backend\include\services\ServicesBase.class.php, line:54, 
function:processGet, class:SessionServices, type:->, args:{}}, 
6:{file:C:\www\upload\backend\include\MollifyBackend.class.php, line:79, 
function:processRequest, class:ServicesBase, type:->, args:{}}, 
7:{file:C:\www\upload\backend\r.php, line:57, function:processRequest, 
class:MollifyBackend, type:->, args:{0:Request}}},RESPONSE error {0:0, 
1:Unknown error: Cannot resolve host, 2:403} 

Original issue reported on code.google.com by A.Monteb...@gmail.com on 6 Nov 2011 at 10:23

GoogleCodeExporter commented 9 years ago
Sounds like this: 
http://code.google.com/p/mollify/wiki/BackendSettings#Host_public_address_(_host
_public_address_)

Original comment by samuli.j...@gmail.com on 10 Nov 2011 at 6:44

GoogleCodeExporter commented 9 years ago
the problem is that if I set the variable
"host_public_address" => "http://10.220.100.18"
I have the same error, cannot resolve address.

the method to resolve address in this framework is little complicated, maybe we 
can rewrite in a simplest way...

What do you think?

However, thanks for this great work...

Original comment by A.Monteb...@gmail.com on 10 Nov 2011 at 7:20

GoogleCodeExporter commented 9 years ago
If you still get the same error, it means that the setting is not defined 
correctly.

This is how the host is determined:

                private function getHost() {
                        if (!$this->settings->hasSetting("host_public_address")) {
                                if (!isset($_SERVER['HTTP_REFERER'])) throw new ServiceException("Cannot resolve host");

                                $protocol = substr($_SERVER['HTTP_REFERER'], 0, strpos($_SERVER['HTTP_REFERER'], ":"));
                                $start = strlen($protocol) + 3;
                                $end = strpos($_SERVER['HTTP_REFERER'], "/", $start);
                                if ($end > 0)
                                        $host = substr($_SERVER['HTTP_REFERER'], $start, $end - $start);
                                else
                                        $host = substr($_SERVER['HTTP_REFERER'], $start);
                                return $protocol."://".$host;
                        }

                        return $this->settings->setting("host_public_address");
                }

You can see that this error is not thrown if the setting exists.

Of course, please tell me how to determine the host without the setting, 
haven't found any better solution so far.

Original comment by samuli.j...@gmail.com on 10 Nov 2011 at 7:52

GoogleCodeExporter commented 9 years ago
Forgot to clarify, that this setting goes to configuration.php $SETTINGS, so 
it's not a variable itself.

Original comment by samuli.j...@gmail.com on 10 Nov 2011 at 8:23

GoogleCodeExporter commented 9 years ago
Thanks Samuli,

in fact if I set the proper ip in configuration.php the error gone...

just for other guys that have the same error, edit configuration.php and insert 
this line:

        $SETTINGS = array(
                "debug" => TRUE,
                "host_public_address" => "http://ip_address_ord_dns/folder_where_mollify_is_installed",
                );

Thanks for your suggestion, the function getHost is write well.

A.

Original comment by A.Monteb...@gmail.com on 10 Nov 2011 at 8:42

GoogleCodeExporter commented 9 years ago
Great!

Original comment by samuli.j...@gmail.com on 10 Nov 2011 at 8:45