Author: Ian Littman (iansltx)
Committer: GitHub (web-flow)
Pusher: saundefined
Date: 2024-06-23T12:22:22+03:00

Commit: 
https://github.com/php/web-php/commit/bd487306aefe7139513237ff1dd58fcf03fed7ba
Raw diff: 
https://github.com/php/web-php/commit/bd487306aefe7139513237ff1dd58fcf03fed7ba.diff

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 f1b8134041b8afefd18e0013a07e1aa310c38c44 as that wasn't 
quite the right fix

Changed paths:
  M  submit-event.php


Diff:

diff --git a/submit-event.php b/submit-event.php
index 55b51ce8a0..7b5fdabed6 100644
--- a/submit-event.php
+++ b/submit-event.php
@@ -110,13 +110,13 @@
     }
 
     // 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 @@
  </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>

Reply via email to