HomePhabricator

Allow empty Reason-Phrases

Description

Allow empty Reason-Phrases

Summary:
According to RFC 7230, the reason-phrase section of a HTTP response can be empty. This regex expects a space before an optional reason-phrase. This diff patches it so the space is optional as well.

I discovered recently when integrating a JIRA instance with a self hosted version of Phabricator that the JIRA OAUTH endpoint would respond with just HTTP/1.1 200 instead of the much more common HTTP/1.1 200 OK message. This caused this regex to fail to match the successful response and JIRA account linking to fail, disappointing my corporate overlords.

Test Plan:
I tested this regex in isolation using a scratch PHP file to check its behavior. I then patched it into our instance of Phabricator and tried linking a JIRA account to a Phabricator account and saw that it succeeded.

An example response that would not parse correctly before is

HTTP/1.1 200

Content-Type: text/plain

content

Reviewers: Blessed Reviewers, epriestley

Reviewed By: Blessed Reviewers, epriestley

Subscribers: Korvin, epriestley

Differential Revision: https://secure.phabricator.com/D19628

Details

Provenance
nickAuthored on Sep 4 2018, 3:22 PM
epriestleyCommitted on Sep 4 2018, 3:22 PM
epriestleyPushed on Sep 4 2018, 3:22 PM
Reviewer
Blessed Reviewers
Differential Revision
D19628: Allow empty Reason-Phrases
Parents
rPHUddc0e031461b: When including files, also print E_COMPILE_ERROR to avoid dying silently
Branches
Unknown
Tags
Unknown
Build Status
Buildable 20727
Build 28175: Run Core Tests