Skip to content

Error when execute socket.getaddrinfo #4

@seuoliveira

Description

@seuoliveira

Hi,

I'm having a error when trying to execute socket.getaddrinfo with included script:

[error] 15067#15067: *12 python error: missing resolver [/tmp/tests.py:4] while sending response to client, client: 192.168.1.177, server: pipz.io, request: "GET / HTTP/1.1", host: "coliveira.pipz.io"

But if I try to execute in python console it's works.

My nginx config file:

/etc/nginx/conf.d/tests.conf
python_include /tmp/tests.py;
python_set $result "check(r)";
server {
    listen       WWW-MAE:80;
    server_name   pipz.io *.pipz.io;
    access_log  /var/log/nginx/access.log;
    error_log   /var/log/nginx/error.log;
    root /tmp/nginx-test/;
    add_header X-custom-header $result;
}

My python script:

/tmp/tests.py
import socket

def check(r):
    socket.getaddrinfo('192.168.1.91', 6379, 0, socket.SOCK_STREAM)
    return "ok"

This is a module limitation or wrong configuration?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions