Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .github/workflows/quicktest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,15 @@ jobs:
php-version: ${{ matrix.php }}
coverage: none

# At least one test needs a non-en_US locale to be available, so make sure it is.
- name: Install locales
run: |
sudo apt-get update
sudo apt-get install locales-all

- name: Show available locales
run: locale -a

# Install dependencies and handle caching in one go.
# @link https://github.com/marketplace/actions/install-composer-dependencies
- name: Install Composer dependencies - normal
Expand Down
9 changes: 9 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,15 @@ jobs:
coverage: ${{ steps.set_cov.outputs.COV }}
tools: cs2pr

# At least one test needs a non-en_US locale to be available, so make sure it is.
- name: Install locales
run: |
sudo apt-get update
sudo apt-get install locales-all

- name: Show available locales
run: locale -a

# Install dependencies and handle caching in one go.
# @link https://github.com/marketplace/actions/install-composer-dependencies
- name: Install Composer dependencies - normal
Expand Down
29 changes: 29 additions & 0 deletions tests/Transport/FsockopenTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,33 @@ public function testContentLengthHeader() {
public function checkContentLengthHeader($headers) {
$this->assertStringContainsString('Content-Length: 0', $headers);
}

/**
* Issue #335/#339.
*/
public function testHTTPVersionHeader() {
// Remember the original locale.
$locale = setlocale(LC_NUMERIC, 0);

// Set the locale to one using commas for the decimal point.
setlocale(LC_NUMERIC, 'de_DE@euro', 'de_DE.utf8', 'de_DE', 'de', 'ge');

// Make sure the locale was changed.
$this->assertNotSame($locale, setlocale(LC_NUMERIC, 0), 'Changing the locale failed');

$hooks = new Requests_Hooks();
$hooks->register('fsockopen.after_headers', array($this, 'checkHTTPVersionHeader'));

Requests::post(httpbin('/post'), array(), array(), $this->getOptions(array('hooks' => $hooks)));

// Reset the locale.
setlocale(LC_NUMERIC, $locale);
}

/**
* Issue #335/#339.
*/
public function checkHTTPVersionHeader($headers) {
$this->assertStringContainsString('HTTP/1.1', $headers, 'HTTP header is influenced by the system locale');
}
}