1
0
mirror of https://github.com/php/web-php.git synced 2026-03-23 23:02:13 +01:00

Use HTTPS URL for event submission to main.php.net, match spam check expectation to web-master (#1017)

* Use HTTPS URL for event submission to main.php.net

Resolves #999

At some point in the past 12 years (this line was modified in the last 3 years
but I doubt it got tested when modified) main.php.net started redirecting
insecure HTTP to HTTPS, including for POSTs. The catch with those redirects is
that POSTs won't get resubmitted when redirected, so when submitting an event
the redirect would result in a GET with no parameters to the event submission
endpoint, hence "Missing parameters." So event submission has been broken since
main.php.net started redirecting HTTP to HTTPS.

Back in 2012 there was an attempt to switch this and other URLs to HTTPS, but
it got rolled back because "there could be mirrors without ssl support." (see
blame for the line this commit modifies). Since then, mirrors have been phased
out, so we can safely assume we're calling HTTPS endpoints now (and that's the
only way this will work anyway).

Verified by hitting the mentioned endpoint both on HTTP and HTTPS. HTTP gets
redirected and fails due to missing parameters, HTTPS makes it through to the
next step.

* Match "sane" value on event submission to web-master expectation

This reverts part of f1b8134041 as that wasn't quite the right fix
This commit is contained in:
Ian Littman
2024-06-23 04:22:22 -05:00
committed by GitHub
parent fadb53cb6d
commit bd487306ae

View File

@@ -110,13 +110,13 @@ if ($process) {
}
// Spam question
if ($_POST["sane"] != 4) {
if ($_POST["sane"] != 3) {
$errors[] = "It's OK. I'm not real either";
}
if (isset($_POST['action']) && $_POST['action'] === 'Submit' && empty($errors)) {
// Submit to main.php.net
$result = posttohost("http://main.php.net/entry/event.php", $_POST);
$result = posttohost("https://main.php.net/entry/event.php", $_POST);
if ($result) {
$errors[] = "There was an error processing your submission: $result";
}
@@ -257,7 +257,7 @@ if ($process && count($errors) === 0) {
</tr>
<tr>
<th class="subr">Are you real?</th>
<td><select name="sane"><?php display_options(["I, Robot", "I used to be", "WTF?", "No, but I'd still want to submit this", "Yes"], "2"); ?></select></td>
<td><select name="sane"><?php display_options(["I, Robot", "I used to be", "WTF?", "Yes", "No, but I'd still want to submit this"], "2"); ?></select></td>
</tr>
</table>
</form>