Re: [naviserver-devel] Ns_conn location questions

2023-01-29 Thread Maksym Zinchenko
Thank you, I realised that it comes from my config  < docker.
Now I pass --hostname=${HOSTNAME} to docker run and set it up in
nsd-config.tcl as


set server [ns_info hostname]
ns_section ns/module/nssock/servers {
ns_param default${server}
}

About the second question, I didn't notice this before :) Thank you
for your information.


On Sun, Jan 29, 2023 at 3:02 PM Gustaf Neumann  wrote:

> > My first question is where this localhost comes from?
>
> I would think, this comes from your configuration file and/of from the
> request.
>
> If one starts e.g. with the sample configuration file nsd-config.tcl, one
> sees entries like:
>
> [29/Jan/2023:16:35:24][54720.100490580][-main:default-] Notice: nssock:0: 
> adding virtual host entry for host  location: 
> http://localhost:8080 mapped to server: default ctx 0x0
> [29/Jan/2023:16:35:24][54720.100490580][-main:default-] Notice: nssock:0: 
> adding virtual host entry for host  location: 
> http://MacBook-Pro-6.local:8080 mapped to server: default ctx 0x0
>
> These log-entries are coming e.g. from the following section
>
> ns_section ns/module/nssock/servers {
> ns_param defaultlocalhost
> ns_param default[ns_info hostname]
> }
>
> from the configuration file that define the mapping of hostnames for the
> "default" server. When there are incoming requests following HTTP/1.1,
> these come with a "Host:" header field, which might be in your case as well
> "localhost".
>
>
> > When I try to run ns_conn location in nsshell it gives me error
> bad_option "location".
>
> This is a know limitation (see first line of "Current shortcomings" on
> https://bitbucket.org/naviserver/nsshell/src/main/
>
> The reason for this is that nsshell communicates with a "kernel" thread in
> the background that keeps the state of your nsshell session (e.g. to be
> able to obtain the variable value for later requests, if one types "set x
> 1" in nsshell). Since this kernel runs in the background, it is no
> connection thread, and has no connection information available.
>
> Theoretically, one could stretch the limits of nsshell further, but it is
> quite hard to make the background job look completely like the a connection
> thread.
>
> -gn
> ___
> naviserver-devel mailing list
> naviserver-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/naviserver-devel
>
___
naviserver-devel mailing list
naviserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/naviserver-devel


Re: [naviserver-devel] Ns_conn location questions

2023-01-29 Thread Gustaf Neumann

> My first question is where this localhost comes from?

I would think, this comes from your configuration file and/of from the 
request.


If one starts e.g. with the sample configuration file nsd-config.tcl, 
one sees entries like:


[29/Jan/2023:16:35:24][54720.100490580][-main:default-] Notice: nssock:0: adding 
virtual host entry for host  location:http://localhost:8080  
mapped to server: default ctx 0x0
[29/Jan/2023:16:35:24][54720.100490580][-main:default-] Notice: nssock:0: adding 
virtual host entry for host  
location:http://MacBook-Pro-6.local:8080  mapped to server: default ctx 0x0

These log-entries are coming e.g. from the following section

ns_section ns/module/nssock/servers {
ns_param defaultlocalhost
ns_param default[ns_info hostname]
}

from the configuration file that define the mapping of hostnames for the 
"default" server. When there are incoming requests following HTTP/1.1, 
these come with a "Host:" header field, which might be in your case as 
well "localhost".



> When I try to run ns_conn location in nsshell it gives me error 
bad_option "location".


This is a know limitation (see first line of "Current shortcomings" on
https://bitbucket.org/naviserver/nsshell/src/main/

The reason for this is that nsshell communicates with a "kernel" thread 
in the background that keeps the state of your nsshell session (e.g. to 
be able to obtain the variable value for later requests, if one types 
"set x 1" in nsshell). Since this kernel runs in the background, it is 
no connection thread, and has no connection information available.


Theoretically, one could stretch the limits of nsshell further, but it 
is quite hard to make the background job look completely like the a 
connection thread.


-gn
___
naviserver-devel mailing list
naviserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/naviserver-devel