cgi

Can I use Perl CGI::Sessions data in PHP?

I'm using Perl's CGI::Session with MySQL. No problems there. I want to incorporate some other languages, most notably PHP, to use the same session cookie. How would I do that? Almost the entire site is in Perl, but I want to use free PHP things, like forums and mediawiki, and still use the same session cookie. ...

Returning http status codes in Python CGI

Is it possible to send a status code other than 200 via a python cgi script (such as 301 redirect) ...

Python cgi and stdin

I'm using pycurl to upload a file via put and python cgi script to receive the file on the server side. Essentially, the code on the server side is: while True: next = sys.stdin.read(4096) if not next: break #.... write the buffer This seems to work with text, but not binary files (I'm on windows). With binary files, t...

C++ html forms

How do i get form data from HTML page using c++ ,as far as the basics of post and get? EIDT1: CGI using apache 2 on windows, i got c++ configured and tested with with apache already. ...

Having a CGI script catch all requests to a domain with Apache.

Hi, Using Apache 2, I want to configure my website so that any requests to the domain are forwarded to a Python CGI script. Basically, if the user goes to http://www.example.com i want the cgi /cgi-bin/cgi.py to execute. If the user goes to http://www.example.com/index.rss I want /cgi-bin/cgi.py to be executed with /index.rss as the ar...

How to hide "cgi-bin", ".py", etc from my URLs?

Brand new to web design, using python. Got Apache up and running, test python script working in cgi-bin directory. Get valid results when I type in the URL explicitly: ".../cgi-bin/showenv.py" But I don't want the URL to look that way. Here at stackoverflow, for example, the URLs that display in my address bar never have the messy d...

Making a python cgi script to finish gracefully

I have a python cgi script that accepts user uploads (via sys.stdin.read). After receiving the file (whether successfully or unsuccessfully), the script needs to do some cleanup. This works fine when upload finishes correctly, however if the user closes the client, the cgi script is silently killed on the server, and as a result no clean...

Can I have an application scope variable in Perl?

Hello everybody, I'm somewhat new to Perl/CGI, and I'm coming from a Java/JSP background. I'm writing a small prototype and need to load some "heavy" data (~200MB) into a data structure. Now, I'd obviously like to avoid loading the data with every request. So far I managed to use a "static" variable (one enclosed in a {} block), but t...

Is there an easy way to convert HTTP_ACCEPT_LANGUAGE to Oracle NLS_LANG settings?

When adding internationalisation capabilities to an Oracle web application (build on mod_plsql), I'd like to interpret the HTTP_ACCEPT_LANGUAGE parameter and use it to set various NLS_* settings in the Oracle session. For example: HTTP_ACCEPT_LANGUAGE=de alter session set nls_territory=germany; alter session set nls_lang=... However...

Python cgi FieldStorage slow, alternatives?

I have a python cgi script that receives files uploaded via a http post. The files can be large (300+ Mb). The thing is, cgi.FieldStorage() is incredibly slow for getting the file (a 300Mb file took 6 minutes to be "received"). Doing the same by just reading the stdin took around 15 seconds. The problem with the latter is, i would have t...

[HTTP Basic Auth] Is there a way to force the browser to always pass the Authorization header if credential is already available?

Using Basic Authentication, if the user has already logged in, the browser will include the username/password in the http request in the succeeding http requests ONLY IF it receives a 401 response containing an authentication challenge. Username/password is passed via Authorization header. Is there a way to force the browser to always i...

How can I get the entire request body with CGI.pm?

I'm trying to write a Perl CGI script to handle XML-RPC requests, in which an XML document is sent as the body of an HTTP POST request. The CGI.pm module does a great job at extracting named params from an HTTP request, but I can't figure out how to make it give me the entire HTTP request body (i.e. the XML document in the XML-RPC requ...

Why does my CGI header print as part of the body?

Hello, I am having a strange problem, maybe something to do with Apache more than Perl. In my code when I write: print "content-type: text/html\n\n"; it prints that along with the code. But when I type: $c = new CGI; $c->header(); it works fine and displays the HTML rendered output. What could the problem be? Thank you ...

Python Cookies question

import cgitb import Cookie, urllib2 from cookielib import FileCookieJar cgitb.enable() c = Cookie.SmartCookie() c['ini'] = 1 savedc = FileCookieJar() savedc.add_cookie_header(c.output()) savedc.save() shoulden't this save the cookie?... i've been reading over the python documentation like 1 million times, i just don't get it :( pleas...

Passing Information from Java (Servlet) to CGI method?

Hey folks, I have this java servlet that grabs information from a form, I need to then take that information and pass it to a specific method in an .exe program and get the value that method returns. Is there a good way to go about doing this? ...

Configuring IIS 6.0 to execute cgi(.exe)

Hi guys... I already create a virtual directory (cgi-bin) with permission : Scripts and Executable... When I test : http://localhost/cgi-bin/mapserv.exe, I got 404 error, The page cannot be found Am I supposed to Add a EXTENSION mapping to .exe files ? Which executable ? Thanks! ...

Is it possible to get unbuffered web browser output?

I have a small cgi script that fetches and validates a configuration file for Nagios. The typical run time is several minutes, and I would like to get some feedback in the browser during the run. To illustrate what I would like to happen, consider this: #!/bin/sh echo "Content-type: text/plain" echo for i in A B C D E do echo...

Running Ruby scripts under JRuby/Rack as if they were CGIs

Is there a way to map *.rb files to be executed under JRuby with the output being sent out to the browser like a CGI? Basically I'm looking for a JRuby CGI servlet. Ideally, I'd like to define a JRuby servlet in web.xml and then be able to put *.rb files in WEB-INF/ruby and be able to call them via http://servername/contextname/rubypro...

Reading from a socket 1 byte a time vs reading in large chunk

What's the difference - performance-wise - between reading from a socket 1 byte a time vs reading in large chunk? I have a C++ application that needs to pull pages from a web server and parse the received page line by line. Currently, I'm reading 1 byte at a time until I encounter a CRLF or the max of 1024 bytes is reached. If reading ...

Upload file using Delphi CGI

Could anyone please give a working example of how to upload a file using Delphi CGI. I have googled but so far haven't had any luck. This is what I have been trying but I am getting access violations. procedure TWebModule1.WebModule1WebActionItem1Action(Sender: TObject; Request: TWebRequest; Response: TWebResponse; var Handled: Bool...