dgl / cgiirc

CGI:IRC web based IRC client
http://cgiirc.org
54 stars 8 forks source link

Undefined subroutine &main::1 called. #9

Open ghost opened 8 years ago

ghost commented 8 years ago

So I'm running with nginx and uwsgi.

i'm trying to get this to work but it seems to be failing. I have no idea if it's something i'm doing or not.

nginx config (scrubbed):

server {
listen [::]:443 ssl;
    server_name my.server.com;
    error_page 404 /usr/share/nginx/errors/404.html;
    access_log /var/log/nginx/vhost/chat/ssl_access.log main;
    #error_log /var/log/nginx/vhost/chat/ssl_error.log;
    error_log /var/log/nginx/vhost/chat/ssl_error.log debug;
    ssl_certificate /etc/nginx/ssl/certs/wildcard.crt;
    ssl_certificate_key /etc/nginx/ssl/keys/myserver.key;
    ssl_session_timeout  5m;
    ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
    ssl_ciphers 'ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-DSS-AES128-GCM-SHA256:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-DSS-AES128-SHA256:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA:DHE-RSA-AES256-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:AES:CAMELLIA:DES-CBC3-SHA:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!MD5:!PSK:!aECDH:!EDH-DSS-DES-CBC3-SHA:!EDH-RSA-DES-CBC3-SHA:!KRB5-DES-CBC3-SHA';
    ssl_dhparam /etc/nginx/ssl/keys/dh4096.pem;
    ssl_prefer_server_ciphers   on;

    #root /srv/http/chat;

    location / {
        root   /srv/http/chat;
        index  index.html index.htm;
        include uwsgi_params;
        uwsgi_pass unix:/run/uwsgi/cgiirc.sock;
        uwsgi_modifier1 5;
        #uwsgi_pass 127.0.0.1:3031;
    }
}

/etc/uwsgi/cgiirc.ini:

[uwsgi]
master = true
chdir = /srv/http/chat
plugins = psgi
socket = /run/uwsgi/cgiirc.sock
cgi = /srv/http/chat
cgi-allowed-ext = .cgi
uid = http
gid = http
psgi = /srv/http/chat/irc.cgi
http-socket-modifier1 = 5

and the config:

[root@alpha chat.src]# egrep -vE '^[[:space:]]*($|#)' cgiirc.config
default_server = irc.freenode.net
default_port = 7000
default_channel = #mychannel
default_name = https://my.server.com
default_nick = web|???????
default_user = cgiirc
quit_message = https://my.server.com
script_nph = nph-irc.cgi
script_form = client-perl.cgi
script_login = irc.cgi
image_path = images
socket_prefix = /tmp/cgiirc-
encoded_ip = 2
ip_access_file = ipaccess
allow_non_default = 0
access_channel = .*
access_server = .*
access_port = .*
access_command = msg me whois nick q !
session_timeout = 3600
dnsbl = dnsbl.dronebl.org
login basic = Nickname
login advanced = Nickname, Realname, Password, Format, Character set
format = default
interface timestamp = 1
interface smilies = 0
interface scrollback = 0

hitting https://my.server.com with curl causes the following to appear in the uwsgi logs (and returns a 500):

Jan 20 23:36:25 my.server.com uwsgi[31536]: [uwsgi-perl error] Undefined subroutine &main::1 called.
Jan 20 23:36:25 my.server.com uwsgi[31536]: [pid: ####|app: 0|req: 2/2] ::ffff:my.client.ip.addr () {42 vars in 626 bytes} [Wed Jan 20 23:36:25 2016] GET / => generated 21 bytes in 0 msecs (HTTP/1.1 500) 2 headers in 83 bytes (0 switches on core 0)

any ideas? this is reproducible for me on both the git HEAD and on the latest release tarball.

software/versions: nginx 1.9.9 Arch Linux (kernel 4.3.3) uwsgi 2.0.12 perl 5.22.1

dgl commented 8 years ago

You need to run it as a CGI program, it doesn't support servlet style execution. (It would be possible to do though -- there's some unfinished fastcgi support which might give an idea -- patches welcome).