cgi

500 internal server error when importing a python module in wsgi

≯℡__Kan透↙ 提交于 2019-12-06 08:42:47
I've got a Python script that is executing functions asynchronously by using PEST wsgi library. However, when I try to import another module it simply results in a 500 error. The way I try to reference it is: from foo import * from foo import Foo where foo is a file .py in which I have the object that I want to reference to. Tried to monitor the calls through Chrome's Inspect Element Control but couldn't find a thing. Also tried to debug using Apache's error log, but nothing there. Any hints appreciated. Update: I've tried the following which resulted in the same 500 error: --make use of

Are Rack-based web servers represent FastCGI protocol?

浪子不回头ぞ 提交于 2019-12-06 08:37:08
问题 I've read that CGI/FastCGI is a protocol for interfacing external applications to web servers. so the web server (like Apache or NginX) sends environment information and the page request itself to a FastCGI process over a socket and responses are returned by FastCGI to the web server over the same connection, and the web server subsequently delivers that response to the end-user. Now I'm confused between this and Rack, which is used by almost all Ruby web frameworks and libraries. It provides

How to override @INC settings in httpd.conf on OSX

混江龙づ霸主 提交于 2019-12-06 07:39:22
How can I set where Perl looks for modules in Apache httpd.conf file on OSX? I've installed several modules via CPAN, which were installed successfully in /opt/local/lib/perl5/site_perl/5.8.9 I can verify this via perldoc perllocal If I run perl -V on the command line, I get (among other dirs): @INC: /opt/local/lib/perl5/site_perl/5.8.9/darwin-2level /opt/local/lib/perl5/site_perl/5.8.9 When I run a perl script as CGI via Apache, however, I get errors that the modules I'm use ing can not be found. The list of dirs being included in @INC do not match my local perl configuration. [error] [client

CGI form submit button using python

杀马特。学长 韩版系。学妹 提交于 2019-12-06 07:21:41
问题 I am trying to create a cgi form that will allow a user to type in a word and then it will take that word and send it off to the next page (another cgi). I know how to do it with a .html file but I am lost when it comes to doing it with python/cgi. Here is what I need to do but it is in html. <html> <h1>Please enter a keyword of your choice</h1> <form action="next.cgi" method="get"> Keyword: <input type="text" keyword="keyword"> <br /> <input type="submit" value="Submit" /> </form> </html>

Returning a response with Ruby CGI before script is finished?

心不动则不痛 提交于 2019-12-06 06:45:46
问题 Anyone know how to send a CGI response in Ruby before the CGI script is finished executing? I'm creating a fire-and-forget HTTP API. I want a client to push data to me via HTTP and have the response return successfully, and then it swizzles the data and does some processing (without the client having to wait for a response). I've tried several things that don't work, including fork. The following will just wait 5 seconds when invoked via HTTP. #!/usr/bin/ruby require 'cgi' cgi = CGI.new cgi

MySQL connection not working from within Perl CGI script

时光总嘲笑我的痴心妄想 提交于 2019-12-06 06:11:51
I can easily connect to a remote MySQL server using the DBI module in my Perl scripts. However, when I try to use the same connection settings/properties from within a CGI script, the connection fails. There are no helpful errors/warnings being logged either in the apache error log, or the browser, in spite of using use CGI::Carp qw(warningsToBrowser fatalsToBrowser); Strangely, the exact same script works fine when executed from the terminal. I also tried connecting the CGI script to the MySQL server on localhost, but without any success. On the other hand, phpMyAdmin works great on the

Meaning of apache2 CONTEXT_DOCUMENT_ROOT and CONTEXT_PREFIX?

蹲街弑〆低调 提交于 2019-12-06 06:10:46
How are the Apache2 (2.4) CGI environment variables CONTEXT_DOCUMENT_ROOT and CONTEXT_PREFIX defined? From experimentation, I've determined the following: CONTEXT_DOCUMENT_ROOT appears to be the full local path to the original request when DirectoryIndex or ErrorDocument call a CGI script. CONTEXT_PREFIX appears to be the original REQUEST_URI , sans any query part, when DirectoryIndex or ErrorDocument have called a CGI script. (In these cases, REQUEST_URI is set to the URI of the CGI script, rather than the original.) However, I can't seem to find any official documentation from Apache on

Streaming stdout to a web page

房东的猫 提交于 2019-12-06 04:41:38
This seems like it should be a really simple thing to achieve, unfortunately web development was never my strong point. I have a bunch of scripts, and I would like to launch them from a webpage and see the realtime stdout text on the page. Some of the scripts take a long time to run so the normal single response isn't good enough (I have this working already). As far as I can see, my options are stdout to a file, and periodically (every couple of seconds) send a request from the client and respond with the contents of this file. Chunked HTTP responses? I'm not sure if this is what they are

How to read cookie in python

此生再无相见时 提交于 2019-12-06 04:25:36
问题 I am new in python cgi script. I want to read cookie in python. I tried following code: from urllib2 import Request, build_opener, HTTPCookieProcessor, HTTPHandler import cookielib #Create a CookieJar object to hold the cookies cj = cookielib.CookieJar() #Create an opener to open pages using the http protocol and to process cookies. opener = build_opener(HTTPCookieProcessor(cj), HTTPHandler()) #Check out the cookies print "the cookies are: " for cookie in cj: print cookie But, I see only the

How do you access the HTTP basic authentication username from perl?

只谈情不闲聊 提交于 2019-12-06 02:13:23
问题 I need to get the remote user name in my CGI script. Where do I find that? I want to display that name on the page that I return. 回答1: Under the CGI spec, the HTTP-auth user name will be in the environment variable REMOTE_USER . In Perl you can get this via $ENV{REMOTE_USER} . You can find descriptions of all the standard CGI environment variables, including REMOTE_USER , in section 4 of RFC 3875. 回答2: The remote_user() method in the CGI module. If you're not using the CGI module, the