Re: [naviserver-devel] Ns_conn location questions

2023-01-30 Thread Gustaf Neumann


On 29.01.23 19:36, Maksym Zinchenko wrote:
About the second question, I didn't notice this before :) Thank you 
for your information.


When you fetch a new version of the nsshell module, it supports now 
"ns_conn location" (it's an emulaton, but probably for most situations 
good enough).


all the best

-g
___
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 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


[naviserver-devel] Ns_conn location questions

2023-01-28 Thread Maksym Zinchenko
Hello, I have some questions about ns_conn location.
According to manual "The location is determined via the following means:

1. if *ns_locationproc
*
is configured, its result is returned.
2. if virtual hosting is enabled, and the "Host:" header field is provided
and valid, it returns its content.
3. If everything above fails, it is determined by virtual hosts mapping
table (as defined in the "ns/module/nssock/servers" or
"ns/module/nsssl/servers" section in the configuration file).
4. If everything above fails, and a connection is open, it is determined by
the current socket address.
5. If everything above fails, it is determined by configuration values of
the driver."

First and second is not my case, because i'm not using virtual hosting, in
my config i have part like that:

ns_section "ns/module/nsssl" {
ns_param defaultserver $hostname
ns_param address $ip_addr
ns_param port $ssl_port
ns_param hostnamens_section "ns/module/nsssl" {
ns_param defaultserver $hostname
ns_param certificate /opt/ns/modules/nsssl/daidze.pem
ns_param address $ip_addr
ns_param port $ssl_port
ns_param hostname $hostname
...
}

So I'm assuming i'm gonna get $hostname:$ssl_port when i run [ns_conn
location]
I'm running Naviserver inside Docker container, and instead getting
localhost.

My first question is where this localhost comes from?

And second question when I try to run ns_conn location in nsshell it gives
me error bad_option "location". Actually it gives this error when I try to
run any subcommand of ns_conn inside nsshell.

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