cgi

CGI 萃取技术 __type_traits

青春壹個敷衍的年華 提交于 2019-12-01 05:22:12
前言 上一篇文章讲了 iterator_traits 的编程技法,非常棒适度弥补了 C++ 语言的不足。 STL 只对迭代器加以规范,制定了 iterator_traits 这样的东西。 CGI 把这种技法进一步扩大到迭代器以外的世界,于是有了 __type_traits。双划线前缀词意指只是 CGI STL 内部所有的东西,不在 STL 标准规范之内。 __type_traits 定义和作用 在源码中 __type_traits 在 type_traits.h 文件定义,以下是泛化版本: struct __true_type { }; struct __false_type { }; //泛化版本 template <class type> struct __type_traits { typedef __true_type this_dummy_member_must_be_first; typedef __false_type has_trivial_default_constructor; typedef __false_type has_trivial_copy_constructor; typedef __false_type has_trivial_assignment_operator; typedef __false_type has_trivial

How to maintain sessions with C++ code?

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-01 05:19:52
问题 There is a cgi code written in C++. Currently there is no session management done in the web pages. There is a need to provide sessions in the web pages so that the user can login, maintain session and then logoff. While this is a fairly simple task in java with HttpSession, I have no clue how to do this with C++ code. 回答1: C++ is not like Java in the breadth of the functionality of the bundled libraries, so you need to extend the language with some extra libraries for not so common tasks

How can I tell if a Perl script is executing in CGI context?

♀尐吖头ヾ 提交于 2019-12-01 03:27:49
I have a Perl script that will be run from the command line and as CGI. From within the Perl script, how can I tell how its being run? The best choice is to check the GATEWAY_INTERFACE environment variable. It will contain the version of the CGI protocol the server is using, this is almost always CGI/1.1 . The HTTP_HOST variable mentioned by Tony Miller (or any HTTP_* variable) is only set if the client supplies it. It's rare but not impossible for a client to omit the Host header leaving HTTP_HOST unset. #!/usr/bin/perl use strict; use warnings; use constant IS_CGI => exists $ENV{'GATEWAY

How can I continuously inform the user of progress from a Perl CGI script?

本秂侑毒 提交于 2019-12-01 03:23:34
问题 I have this Perl script sitting in the cgi-bin folder of my Apache server: #!/usr/bin/perl use strict; use warnings; $| = 1; print "Content-type: text/html\r\n\r\n"; print "Hello there!<br />\nJust testing .<br />\n"; my $top = 5; foreach (1..$top) { print "i = $_<br />\n"; sleep 1; } What I want to achieve here is a gradual update of the web page to show the user an updated status. However, what I'm actually getting is the entire output at once, after a delay of 5 secs. Is there any way I

When should I use Perl CGI instead of PHP (or vice versa)?

房东的猫 提交于 2019-12-01 03:05:32
For hobby purposes, I have a shared space on a hosting server that is providing, as many of them are, both PHP and Perl CGI. I have read on several places that CGI scripts are obsolete now, I think mainly for performance issues (like Is PHP or vanilla Perl CGI faster? ). But since I just started studying Perl, I wouldn't want to waste time on implementing solutions in PHP that are way easier (or only possible) in Perl. Also there are the boilerplate issues, I'm aware of CPAN (that is the existence, not yet the content), but not familiar with PHP libraries (although I have no doubt they exist).

Python noob here: On a Python enabled web server, how do I use Python?

僤鯓⒐⒋嵵緔 提交于 2019-12-01 01:54:14
#!/usr/bin/env python # -*- coding: UTF-8 -*- # enable debugging import cgitb cgitb.enable() print "Content-Type: text/plain;charset=utf-8" print print "Hello World!" My goal is to replace PHP with Python. I'm pretty good with PHP and I can use Python on my own local machine, but I can't get it to work on my web server. My web host says they support Python, so I must be doing something wrong. Now, Python is associated with CGI. Do python files have to go into my cgi-bin folder? I've never seen a web file with a py extension or a cgi extension, I don't know how these things work, I'm really

Perl updating a value in .conf file from a form

不想你离开。 提交于 2019-12-01 01:45:15
I have a admin.conf file and the file looks like this. For example, [online_offline_status] online_offline_status.online_offline_state = ONLINE i have another file called index.cgi that works as a form. For example, #!/usr/bin/perl #index.cgi require 'foobar-lib.pl'; ui_print_header(undef, $module_info{'desc'}, "", undef, 1, 1); ui_print_footer("/", $text{'index'}); print "Content-type:text/html\n\n"; print qq~ <html> <head> <link rel="stylesheet" type="text/css" href="cstyle17.css"> </head> <body> <div id="content"> <div id="bar"> <span><p>Controller Settings</p></span> </div> <div id="tab

how to get POST values in perl

核能气质少年 提交于 2019-12-01 01:41:56
问题 I am trying to customize a script and need to get a POST value from a form using perl. I have no background of perl but this is a fairly simple thing so I guess it should not be hard. This is the php version of the code I would like to have in PERL: <?php $download = ($_POST['dl']) ? '1' : '0'; ?> I know this may not be at all related to the PERL version but it could help I guess clarifying what exactly I am looking to do. 回答1: Well, in that case please have a look at this simple code: This

php安装模式mod_php和Fastcgi的选择与对比

匆匆过客 提交于 2019-11-30 23:06:32
安装php又面临到了模式的选择,以前都是选择mod_php模式,因为这样安装比较方便哈,今天突然关心起FastCGI这种模式,败毒了一把,找到了一些关于mod_php和Fastcgi的选择与对比这方面的讨论,现在发出来留一个记号,以便进一步研究: 第一篇: php在apache中安装模式的区别:fastcgi和mod_php 说到fastCgi就不得不说Cgi。 CGI英文全称是 Common Gateway Interface,通常翻译为共同网关接口,是HTTP服务器与机器上的其他程序进行通信的一个接口。这个“其他程序”可以使用任何计算机语言来编写,它通过CGI这个接口从HTTP服务器取得输入,然后把运行的结果又通过CGI这个接口交给HTTP服务器,而HTTP服务器把这个结果送给浏览器。 CGI的出现让WEB从静态变为为动态,随着Web的越来越普及,很多的网站的都需要有动态的页面,以便与浏览者互交。CGI方式的缺点也越来越突出。因为HTTP要生成一个动态页面,系统就必须启动一个新的进程以运行CGI程序,不断地fork是一项很消耗时间和资源的工作。这就出现了FastCGI。 百度百科关于FastCGI 2. FastCGI 可在任何平台上使用,Netscape Enterprise 及 IIS 都有 FastCGI 的模块可供使用,阿帕契 (Apache,以及利用 Apache

How do I programatically restart a system service(not apache) from apache in linux?

北城余情 提交于 2019-11-30 21:39:34
I need to simple way to allow an end user to restart tomcat from a web page served from apache on the same box. We're trying to make it easy for our QC department to deploy a new version of our webapp to apache. We're using samba, but we need an easy way for them to stop / start the tomcat server before/after the deployment. This would only be for internal qc boxes. Is there an existing solution for this? or would it be easier to write a few quick php application to handle this? Like Skip said, but don't run the CGI as root. Instead, have the CGI call sudo. You can give your web server