lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


All,

I notice if I use copas with luasocket (socket.ftp) the error message
for "host not found" is returned in a table.

The following examples illustrate the issue:

# works as expected
$ lua -e 'local ftp = require("socket.ftp") ; print(ftp.get("ftp://foobar";))'
nil     host not found

# returns the same error message but in a table i.e. { "host not found" }
$ lua -l copas -e 'local ftp = require("socket.ftp") ;
print(ftp.get("ftp://foobar";))'
nil     table: 0x10031a00

I am using lua 5.1.4, luasocket version 2.0.2, copas version 1.1.6 and
coxpcall 1.13.

I have a situation where I need the dispatcher functionality of copas,
but still need to be able make client requests (ftp,tftp, and http).

If I prevent socket.protect() from being overridden by copas the error
is returned as expected.  I am not sure if copcall() is making
assumptions about the exceptions that it may catch or if it is
actually encapsulating the error message in a table.  I am continuing
to attempt to root cause the issue, but thought I would post my
observations in case anyone else has run into this.

Interestingly, ftp is the only client transfer module that has the
issue (tftp and http report the error correctly while using copas):

# the following calls report the error as expected
$ lua -l copas -e 'local tftp = require("socket.tftp") ;
print(tftp.get("tftp://foobar";))'
nil     host not found
$ lua -l copas -e 'local http = require("socket.http") ;
print(http.request("tftp://foobar";))'
nil     host not found

Thanks,

Jon Nalley