diff --git a/mozilla/webtools/tinderbox2/src/clientbin/HTTPPost b/mozilla/webtools/tinderbox2/src/clientbin/HTTPPost new file mode 100755 index 00000000000..3d3b347b7c3 --- /dev/null +++ b/mozilla/webtools/tinderbox2/src/clientbin/HTTPPost @@ -0,0 +1,130 @@ +#!#perl# -- +# -*- Mode: perl; indent-tabs-mode: nil -*- +# + +# This script does not need to run under taint perl. + +# HTTPost.cgi - A perl script for uploading datafiles to the +# Webserver. Via HTTP Post. + +# Taken from code found on the mailing list: +# http://www.mail-archive.com/modperl@apache.org/msg35695.html +# * From: Steve Bannerman +# * Subject: HTTP POST: parameters "empty" when using ModPerl::Registry (okay when using ModPerl:PerlRun)... +# * Date: Thu, 14 Aug 2003 11:38:50 -0700 + +# $Revision: 1.1 $ +# $Date: 2003-12-23 12:50:36 $ +# $Author: kestes%walrus.com $ +# $Source: /home/befator/cvs/jail/cvsroot/mozilla/webtools/tinderbox2/src/clientbin/HTTPPost,v $ +# $Name: not supported by cvs2svn $ + + +# The contents of this file are subject to the Mozilla Public +# License Version 1.1 (the "License"); you may not use this file +# except in compliance with the License. You may obtain a copy of +# the License at http://www.mozilla.org/NPL/ +# +# Software distributed under the License is distributed on an "AS +# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or +# implied. See the License for the specific language governing +# rights and limitations under the License. +# +# The Original Code is the Tinderbox build tool. +# +# The Initial Developer of the Original Code is Netscape Communications +# Corporation. Portions created by Netscape are +# Copyright (C) 1998 Netscape Communications Corporation. All +# Rights Reserved. +# + +# complete rewrite by Ken Estes for contact info see the +# mozilla/webtools/tinderbox2/Contact file. +# Contributor(s): + +# Standard perl libraries + +use LWP::UserAgent; +use HTTP::Request::Common; + +# Tinderbox libraries + +use lib '#tinder_libdir#'; + +use TinderConfig; +use Utils; + +$VERSION = '0.09'; + + +sub usage { + + my $usage =<; + + my $postType = 'form-data'; + + my $ua = new LWP::UserAgent; + my $req = POST($postUrl, + Content_Type => $postType, + Content => $data); + + my $res = $ua->request($req); + + if (!($res->is_success())) { + print STDERR "HTTP POST failed"; + print STDERR "code: " . $res->code() . "\n"; + print STDERR "message: " . $res->message() . "\n"; + die("\n"); + } + + return ; +} + + + +# --------------------main------------------------- +{ + set_static_vars(); + get_env(); + + my $postUrl = $ARGV[0]; + + if ( + (!($ARGV[0])) || + ($ARGV[0] =~ m/-?\?/) || + ($ARGV[0] =~ m/help/) + ) { + usage(); + } + + post(); + + exit 0; +}