Allow patches to be attached via the web page.
Thanks to Marius Nuennerich for submitting the idea and for never giving up on nagging me about it. PR: www/83397
This commit is contained in:
parent
a212b70d19
commit
9231a0d249
Notes:
svn2git
2020-12-08 03:00:23 +00:00
svn path=/www/; revision=28788
2 changed files with 46 additions and 4 deletions
|
@ -8,7 +8,7 @@
|
|||
# GNU General Public License Version 2.
|
||||
# (http://www.gnu.ai.mit.edu/copyleft/gpl.html)
|
||||
#
|
||||
# $FreeBSD: www/en/cgi/dosendpr.cgi,v 1.25 2005/12/04 22:25:20 simon Exp $
|
||||
# $FreeBSD$
|
||||
|
||||
use Socket;
|
||||
use CGI qw/:standard/;
|
||||
|
@ -24,6 +24,12 @@ my $openproxy;
|
|||
my $expiretime = 2700;
|
||||
$dbpath = "/usr/local/www/var/confirm-code/sendpr-code.db";
|
||||
|
||||
# Maximum size of patch that we'll accept from send-pr.html.
|
||||
$maxpatch = 102400;
|
||||
|
||||
my $patchbuf;
|
||||
my $patchhandle;
|
||||
|
||||
# Environment variables to stuff in the PR header.
|
||||
my @ENV_captures = qw/ REMOTE_HOST
|
||||
REMOTE_ADDR
|
||||
|
@ -77,12 +83,32 @@ sub prerror {
|
|||
exit (1);
|
||||
}
|
||||
|
||||
sub piloterror {
|
||||
print start_html("Problem Report Error");
|
||||
print "<p>There is an error with your problem\n",
|
||||
"report submission.\n",
|
||||
"The problem was: <span class=\"prerror\">$_[0]</span>.</p>";
|
||||
print end_html();
|
||||
exit (1);
|
||||
}
|
||||
|
||||
print header();
|
||||
|
||||
&prerror("request method problem") if $ENV{'REQUEST_METHOD'} eq 'GET';
|
||||
|
||||
if (!$submission_program) { &prerror("submit program problem"); }
|
||||
|
||||
if ($patchhandle = upload('patch')) {
|
||||
use bytes;
|
||||
unless (uploadInfo($patchhandle)->{'Content-Type'} =~ m!text/.*!) {
|
||||
&piloterror("Patch file has wrong content type");
|
||||
}
|
||||
read($patchhandle,$patchbuf,$maxpatch + 1);
|
||||
if (length($patchbuf) > $maxpatch) {
|
||||
&piloterror("Patch file too big (over ${maxpatch} bytes)");
|
||||
}
|
||||
}
|
||||
|
||||
# Verify the code...
|
||||
|
||||
$db_obj = tie(%db_hash, 'DB_File', $dbpath, O_CREAT|O_RDWR, 0644)
|
||||
|
@ -168,7 +194,12 @@ $pr .= "X-Send-Pr-Version: www-2.3\n\n" .
|
|||
">Environment:\t" . param('environment') . "\n" .
|
||||
">Description:\n" . param('description') . "\n" .
|
||||
">How-To-Repeat:\n" . param('howtorepeat') . "\n" .
|
||||
">Fix:\n" . param('fix') . "\n";
|
||||
">Fix:\n" . param('fix');
|
||||
|
||||
if (length($patchbuf) > 0) {
|
||||
$pr .= "\n\nPatch attached with submission follows:\n\n"
|
||||
. $patchbuf . "\n";
|
||||
}
|
||||
|
||||
# remove any carriage returns that appear in the report.
|
||||
$pr =~ s/\r//g;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<!DOCTYPE html PUBLIC "-//FreeBSD//DTD HTML 4.01 Transitional-Based Extension//EN" [
|
||||
<!ENTITY date "$FreeBSD: www/en/send-pr.sgml,v 1.52 2006/02/24 21:23:32 ceri Exp $">
|
||||
<!ENTITY date "$FreeBSD: www/en/send-pr.sgml,v 1.53 2006/08/19 21:20:30 hrs Exp $">
|
||||
<!ENTITY title "Submit a FreeBSD problem report">
|
||||
<!ENTITY copyright "This gnats pr-submission mechanism Copyright © 1996
|
||||
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.">
|
||||
|
@ -47,6 +47,12 @@
|
|||
available to the public through the web interface, so you should
|
||||
already have an effective spam filter in place.</p>
|
||||
|
||||
<p>If you are submitting a patch file, note that we only accept
|
||||
text/* content types, and you must therefore ensure that your
|
||||
browser sends the correct type. If your browser does not like
|
||||
to do this, a good way to convince it to do so is to ensure that
|
||||
the file name ends with the string '.txt'.</p>
|
||||
|
||||
<p>Finally, be forewarned that this page requires that you are able
|
||||
to view images as a measure against abuse of the system. We regret
|
||||
having to have imposed this measure, but it is completey unavoidable.
|
||||
|
@ -62,7 +68,8 @@
|
|||
browser, you might <b>lose work</b> in this case. Help save yourself
|
||||
from this common frustration.</p>
|
||||
|
||||
<form action="http://www.FreeBSD.org/cgi/dosendpr.cgi" method="post">
|
||||
<form action="http://www.FreeBSD.org/cgi/dosendpr.cgi" method="post"
|
||||
enctype="multipart/form-data">
|
||||
<input type="hidden" name="submitterid" value="current-users" >
|
||||
<input type="hidden" name="confidential" value="no" >
|
||||
|
||||
|
@ -136,6 +143,10 @@
|
|||
<label for="fix">Fix to the problem if known</label>: <br>
|
||||
<textarea name="fix" id="fix" rows="20" cols="80"></textarea><br><br>
|
||||
|
||||
<label for="patch">And/or patch file (100KB max)</label>:
|
||||
<input type="file" name="patch" id="patch" maxlength="102400"
|
||||
accept="text/*" ><br>
|
||||
|
||||
<label for="code-confirm">Finally, please enter the code from the image
|
||||
below to prove you're not a robot: <br><br>
|
||||
<img src="http://www.FreeBSD.org/cgi/confirm-code.cgi?db=sendpr"
|
||||
|
|
Loading…
Reference in a new issue