[rt-commit] r302 - in rt/branches/rt-3.1: . bin
jesse at fsck.com
jesse at fsck.com
Sun Dec 14 23:32:19 EST 2003
Author: jesse
Date: 2003-12-12 03:45:44 -0500 (Fri, 12 Dec 2003)
New Revision: 302
Added:
rt/branches/rt-3.1/bin/standalone_httpd.in
Modified:
rt/branches/rt-3.1/Makefile
rt/branches/rt-3.1/Makefile.in
rt/branches/rt-3.1/config.status
rt/branches/rt-3.1/configure
rt/branches/rt-3.1/configure.ac
Log:
Added a standalone "personal" httpd for RT
Modified: rt/branches/rt-3.1/Makefile
===================================================================
--- rt/branches/rt-3.1/Makefile 2003-12-10 04:23:27 UTC (rev 301)
+++ rt/branches/rt-3.1/Makefile 2003-12-12 08:45:44 UTC (rev 302)
@@ -55,11 +55,11 @@
# Group that should own all of RT's libraries, generally root.
LIBS_GROUP = bin
-WEB_USER = www-data
-WEB_GROUP = www-data
+WEB_USER = www
+WEB_GROUP = www
-APACHECTL = /usr/sbin/apachectl
+APACHECTL =
# {{{ Files and directories
@@ -404,6 +404,7 @@
bin/rt-mailgate \
bin/mason_handler.fcgi \
bin/mason_handler.scgi \
+ bin/standalone_httpd \
bin/mason_handler.svc \
bin/rt \
bin/webmux.pl \
Modified: rt/branches/rt-3.1/Makefile.in
===================================================================
--- rt/branches/rt-3.1/Makefile.in 2003-12-10 04:23:27 UTC (rev 301)
+++ rt/branches/rt-3.1/Makefile.in 2003-12-12 08:45:44 UTC (rev 302)
@@ -404,6 +404,7 @@
bin/rt-mailgate \
bin/mason_handler.fcgi \
bin/mason_handler.scgi \
+ bin/standalone_httpd \
bin/mason_handler.svc \
bin/rt \
bin/webmux.pl \
Added: rt/branches/rt-3.1/bin/standalone_httpd.in
===================================================================
--- rt/branches/rt-3.1/bin/standalone_httpd.in 2003-12-10 04:23:27 UTC (rev 301)
+++ rt/branches/rt-3.1/bin/standalone_httpd.in 2003-12-12 08:45:44 UTC (rev 302)
@@ -0,0 +1,137 @@
+#!@PERL@ -w
+
+use strict;
+
+use lib( "@LOCAL_LIB_PATH@", "@RT_LIB_PATH@");
+use RT;
+RT::LoadConfig();
+
+use CGI qw(-private_tempfiles); #bring this in before mason, to make sure we
+ #set private_tempfiles
+use HTML::Mason::CGIHandler;
+use HTML::Mason; # brings in subpackages: Parser, Interp, etc.
+
+use RT::Tickets;
+use RT::Transactions;
+use RT::Users;
+use RT::CurrentUser;
+use RT::Templates;
+use RT::Queues;
+use RT::ScripActions;
+use RT::ScripConditions;
+use RT::Scrips;
+use RT::Groups;
+use RT::GroupMembers;
+use RT::CustomFields;
+use RT::CustomFieldValues;
+use RT::TicketCustomFieldValues;
+
+use RT::Interface::Web;
+use MIME::Entity;
+use Text::Wrapper;
+use CGI::Cookie;
+use Time::ParseDate;
+use HTML::Entities;
+
+use Socket;
+
+RT::Init();
+
+my $port = 4711;
+
+main_loop($port);
+
+sub main_loop {
+ my $port = shift;
+ my $tcp = getprotobyname('tcp');
+ socket( Server, PF_INET, SOCK_STREAM, $tcp ) or die "socket: $!";
+ setsockopt( Server, SOL_SOCKET, SO_REUSEADDR, pack( "l", 1 ) )
+ or warn "setsockopt: $!";
+ bind( Server, sockaddr_in( $port, INADDR_ANY ) ) or die "bind: $!";
+ listen( Server, SOMAXCONN ) or die "listen: $!";
+ $RT::Logger->info("server started on port $port");
+
+ CONNECT:
+
+ RT::Init();
+ my $h = &RT::Interface::Web::NewCGIHandler(@RT::MasonParameters);
+
+ for ( ; accept( Client, Server ) ; close Client ) {
+
+ *STDIN = *Client;
+ *STDOUT = *Client;
+
+ my $remote_sockaddr = getpeername(STDIN);
+ my ( undef, $iaddr ) = sockaddr_in($remote_sockaddr);
+ my $peername = gethostbyaddr( $iaddr, AF_INET ) || "localhost";
+ my $peeraddr = inet_ntoa($iaddr) || "127.0.0.1";
+
+ my $local_sockaddr = getsockname(STDIN);
+ my ( undef, $localiaddr ) = sockaddr_in($local_sockaddr);
+ my $localname = gethostbyaddr( $localiaddr, AF_INET ) || "localhost";
+ my $localaddr = inet_ntoa($iaddr) || "127.0.0.1";
+
+ chomp( $_ = <STDIN> );
+ my ( $method, $url, $proto, undef ) = split;
+
+ $url =~ s#\\#/#g;
+ $RT::Logger->info("<- $peername: $_");
+ my ( $file, undef, $arglist ) =
+ ( $url =~ /([^?]*)(\?(.*))?/ ); # split at ?
+ my $file_escaped = $file;
+ $file =~ s/%([\dA-Fa-f]{2})/chr(hex($1))/eg; # %20 -> space
+
+ if ( $method !~ /^(GET|POST|HEAD)$/ ) {
+ next CONNECT;
+ }
+
+ my @env_vars = qw(USER_AGENT CONTENT_LENGTH CONTENT_TYPE);
+ foreach my $var (@env_vars) {
+ delete $ENV{$var};
+ }
+ while (<STDIN>) {
+ s/[\r\l\n\s]+$//;
+ /^User-Agent: (.+)/i and $ENV{USER_AGENT} = $1;
+ /^Content-length: (\d+)/i and $ENV{CONTENT_LENGTH} = $1;
+ /^Content-type: (.+)/i and $ENV{CONTENT_TYPE} = $1;
+ /^Cookie.?: (.+)/i and $ENV{COOKIE} .= $1 . "; ";
+ last if (/^$/);
+ }
+
+ print "HTTP/1.0 200 OK\n"; # probably OK by now
+
+ $ENV{SERVER_PROTOCOL} = $proto;
+ $ENV{SERVER_PORT} = $port;
+ $ENV{SERVER_NAME} = $localname;
+ $ENV{SERVER_URL} = "http://$localname:$port/";
+ $ENV{PATH_INFO} = $file;
+ $ENV{SCRIPT_FILENAME} = "file";
+ $ENV{REQUEST_URI} = $url;
+ $ENV{REQUEST_METHOD} = $method;
+ $ENV{REMOTE_ADDR} = $peeraddr;
+ $ENV{REMOTE_HOST} = $peername;
+ $ENV{QUERY_STRING} = $arglist ||'';
+ $ENV{SERVER_SOFTWARE} = "rt-standalone/$RT::VERSION";
+
+ RT::ConnectToDatabase();
+
+ CGI::initialize_globals();
+ my $cgi = CGI->new();
+
+ if ( ( !$h->interp->comp_exists( $cgi->path_info ) )
+ && ( $h->interp->comp_exists( $cgi->path_info . "/index.html" ) ) ) {
+ $cgi->path_info( $cgi->path_info . "/index.html" );
+ }
+
+ eval { $h->handle_cgi_object($cgi); };
+ $RT::Logger->crit($@) if ($@);
+
+ if ( $RT::Handle->TransactionDepth ) {
+ $RT::Handle->ForceRollback;
+ $RT::Logger->crit( "Transaction not committed. Usually indicates a software fault. Data loss may have occurred");
+ }
+
+ }
+ next CONNECT;
+
+}
Property changes on: rt/branches/rt-3.1/bin/standalone_httpd.in
___________________________________________________________________
Name: svn:executable
+ *
Modified: rt/branches/rt-3.1/config.status
===================================================================
--- rt/branches/rt-3.1/config.status 2003-12-10 04:23:27 UTC (rev 301)
+++ rt/branches/rt-3.1/config.status 2003-12-12 08:45:44 UTC (rev 302)
@@ -271,7 +271,7 @@
_CSEOF
echo "on `(hostname || uname -n) 2>/dev/null | sed 1q`" >&5
echo >&5
-config_files=" sbin/rt-setup-database sbin/rt-test-dependencies Makefile etc/RT_Config.pm lib/RT.pm lib/t/00smoke.t lib/t/01harness.t lib/t/02regression.t lib/t/03web.pl lib/t/04_send_email.pl bin/mason_handler.fcgi bin/mason_handler.scgi bin/mason_handler.svc bin/rt-commit-handler bin/rt-crontool bin/rt-mailgate bin/rt bin/webmux.pl"
+config_files=" sbin/rt-setup-database sbin/rt-test-dependencies Makefile etc/RT_Config.pm lib/RT.pm lib/t/00smoke.t lib/t/01harness.t lib/t/02regression.t lib/t/03web.pl lib/t/04_send_email.pl bin/mason_handler.fcgi bin/mason_handler.scgi bin/standalone_httpd bin/mason_handler.svc bin/rt-commit-handler bin/rt-crontool bin/rt-mailgate bin/rt bin/webmux.pl"
ac_cs_usage="\
\`$as_me' instantiates files from templates according to the
@@ -294,7 +294,7 @@
ac_cs_version="\
RT config.status 3.1.1
configured by ./configure, generated by GNU Autoconf 2.58,
- with options \"'--with-web-user=www-data' '--with-web-group=www-data'\"
+ with options \"\"
Copyright (C) 2003 Free Software Foundation, Inc.
This config.status script is free software; the Free Software Foundation
@@ -373,8 +373,8 @@
fi
if $ac_cs_recheck; then
- echo "running /bin/sh ./configure " '--with-web-user=www-data' '--with-web-group=www-data' $ac_configure_extra_args " --no-create --no-recursion" >&6
- exec /bin/sh ./configure '--with-web-user=www-data' '--with-web-group=www-data' $ac_configure_extra_args --no-create --no-recursion
+ echo "running /bin/sh ./configure " $ac_configure_extra_args " --no-create --no-recursion" >&6
+ exec /bin/sh ./configure $ac_configure_extra_args --no-create --no-recursion
fi
for ac_config_target in $ac_config_targets
@@ -393,6 +393,7 @@
"lib/t/04_send_email.pl" ) CONFIG_FILES="$CONFIG_FILES lib/t/04_send_email.pl" ;;
"bin/mason_handler.fcgi" ) CONFIG_FILES="$CONFIG_FILES bin/mason_handler.fcgi" ;;
"bin/mason_handler.scgi" ) CONFIG_FILES="$CONFIG_FILES bin/mason_handler.scgi" ;;
+ "bin/standalone_httpd" ) CONFIG_FILES="$CONFIG_FILES bin/standalone_httpd" ;;
"bin/mason_handler.svc" ) CONFIG_FILES="$CONFIG_FILES bin/mason_handler.svc" ;;
"bin/rt-commit-handler" ) CONFIG_FILES="$CONFIG_FILES bin/rt-commit-handler" ;;
"bin/rt-crontool" ) CONFIG_FILES="$CONFIG_FILES bin/rt-crontool" ;;
@@ -530,9 +531,9 @@
s, at DB_DATABASE@,rt3,;t t
s, at DB_RT_USER@,rt_user,;t t
s, at DB_RT_PASS@,rt_pass,;t t
-s, at WEB_USER@,www-data,;t t
-s, at WEB_GROUP@,www-data,;t t
-s, at APACHECTL@,/usr/sbin/apachectl,;t t
+s, at WEB_USER@,www,;t t
+s, at WEB_GROUP@,www,;t t
+s, at APACHECTL@,,;t t
s, at RT_VERSION_MAJOR@,3,;t t
s, at RT_VERSION_MINOR@,1,;t t
s, at RT_VERSION_PATCH@,1,;t t
Modified: rt/branches/rt-3.1/configure
===================================================================
--- rt/branches/rt-3.1/configure 2003-12-10 04:23:27 UTC (rev 301)
+++ rt/branches/rt-3.1/configure 2003-12-12 08:45:44 UTC (rev 302)
@@ -1993,7 +1993,7 @@
- ac_config_files="$ac_config_files sbin/rt-setup-database sbin/rt-test-dependencies Makefile etc/RT_Config.pm lib/RT.pm lib/t/00smoke.t lib/t/01harness.t lib/t/02regression.t lib/t/03web.pl lib/t/04_send_email.pl bin/mason_handler.fcgi bin/mason_handler.scgi bin/mason_handler.svc bin/rt-commit-handler bin/rt-crontool bin/rt-mailgate bin/rt bin/webmux.pl"
+ ac_config_files="$ac_config_files sbin/rt-setup-database sbin/rt-test-dependencies Makefile etc/RT_Config.pm lib/RT.pm lib/t/00smoke.t lib/t/01harness.t lib/t/02regression.t lib/t/03web.pl lib/t/04_send_email.pl bin/mason_handler.fcgi bin/mason_handler.scgi bin/standalone_httpd bin/mason_handler.svc bin/rt-commit-handler bin/rt-crontool bin/rt-mailgate bin/rt bin/webmux.pl"
cat >confcache <<\_ACEOF
# This file is a shell script that caches the results of configure
@@ -2558,6 +2558,7 @@
"lib/t/04_send_email.pl" ) CONFIG_FILES="$CONFIG_FILES lib/t/04_send_email.pl" ;;
"bin/mason_handler.fcgi" ) CONFIG_FILES="$CONFIG_FILES bin/mason_handler.fcgi" ;;
"bin/mason_handler.scgi" ) CONFIG_FILES="$CONFIG_FILES bin/mason_handler.scgi" ;;
+ "bin/standalone_httpd" ) CONFIG_FILES="$CONFIG_FILES bin/standalone_httpd" ;;
"bin/mason_handler.svc" ) CONFIG_FILES="$CONFIG_FILES bin/mason_handler.svc" ;;
"bin/rt-commit-handler" ) CONFIG_FILES="$CONFIG_FILES bin/rt-commit-handler" ;;
"bin/rt-crontool" ) CONFIG_FILES="$CONFIG_FILES bin/rt-crontool" ;;
Modified: rt/branches/rt-3.1/configure.ac
===================================================================
--- rt/branches/rt-3.1/configure.ac 2003-12-10 04:23:27 UTC (rev 301)
+++ rt/branches/rt-3.1/configure.ac 2003-12-12 08:45:44 UTC (rev 302)
@@ -230,6 +230,7 @@
lib/t/04_send_email.pl
bin/mason_handler.fcgi
bin/mason_handler.scgi
+ bin/standalone_httpd
bin/mason_handler.svc
bin/rt-commit-handler
bin/rt-crontool
More information about the Rt-commit
mailing list