1

Reference to this question I am running a tika service on my server:

-bash-3.2$ netstat -tulpn | egrep 'Proto|LISTEN'
(Not all processes could be identified, non-owned process info
 will not be shown, you would have to be root to see it all.)
Proto Recv-Q Send-Q Local Address               Foreign Address             State       PID/Program name
tcp        0      0 72.167.2.1:50336            0.0.0.0:*                   LISTEN      -
tcp        0      0 0.0.0.0:1248                0.0.0.0:*                   LISTEN      -
tcp        0      0 0.0.0.0:4118                0.0.0.0:*                   LISTEN      -
tcp        0      0 72.167.2.1:50328            0.0.0.0:*                   LISTEN      -
tcp        0      0 0.0.0.0:12345               0.0.0.0:*                   LISTEN      4767/java

and I can connect normally to it with python through the command line:

-bash-3.2$ python
Python 2.4.3 (#1, Nov 11 2010, 13:34:43)
[GCC 4.1.2 20080704 (Red Hat 4.1.2-48)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import socket
>>> s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
>>> port=12345
>>> host='127.0.0.1'
>>> s.connect((host,port))

but when I run it through the following cgi script, it is unable to connect:

s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
port=12345
host='127.0.0.1'
try:
    s.connect((host,port))
except:
    print sys.exc_info()

It gives me the following:

(, error(111, 'Connection refused'), ) 

I checked the cgi file permissions, and they are 755 (rwxr-xr-x).

Do I need to specify something in the service to make it accessible for cgi scripts to connect to it? Or is there soething that I can do from the cgi script itself or any other suggestion?


EDIT: I found this piece of info that the hosting company godaddy doesn't support socket creation from cgi:

http://support.godaddy.com/help/article/20/does-your-cgi-service-support-socket-connections-or-socket-modules

So, is there another way to send a file to tika from CGI?

Community
  • 1
  • 1
hmghaly
  • 1,411
  • 3
  • 29
  • 47
  • Could it be something like SELinux which is stopping outgoing connections from a CGI for security reasons? – Gagravarr Oct 24 '13 at 16:34
  • yes, probably it is, that's why I am now looking at other ways to run tika from CGI – hmghaly Oct 24 '13 at 17:35
  • Does it have to be a CGI? Tika is a Java library, so deploying a WAR to something like Tomcat would let you have a web-facing Java app. That an option? – Gagravarr Oct 24 '13 at 17:56
  • I don't think I will be able to use Tomcat (I don't have enough privileges to install anything new), and all my code in python and so I use CGI for it – hmghaly Oct 24 '13 at 18:32

0 Answers0