Skip to content

Commit

Permalink
Fix #2 Access to oauth methods fails
Browse files Browse the repository at this point in the history
  • Loading branch information
mynetx committed Aug 20, 2013
2 parents 90c1adb + fd4eb1b commit 380ff58
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
codebird-cors-proxy - changelog
===============================

1.2.1 (2013-08-20)
- #2 Access to oauth methods fails

1.2.0 (2013-08-20)
+ Extract files from src folder

Expand Down
10 changes: 8 additions & 2 deletions codebird-cors-proxy.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* Proxy to the Twitter API, adding CORS headers to replies.
*
* @package codebird
* @version 1.2.0
* @version 1.2.1
* @author J.M. <me@mynetx.net>
* @copyright 2013 J.M. <me@mynetx.net>
*
Expand Down Expand Up @@ -157,8 +157,14 @@ function http_get_request_body()

}

// URLs always start with 1.1
// URLs always start with 1.1 or oauth
$version_pos = strpos($url, '/1.1/');
if ($version_pos === -1) {
$version_pos = strpos($url, '/oauth/');
}
if ($version_pos === -1) {
$version_pos = strpos($url, '/oauth2/');
}
if ($version_pos === -1) {
header('HTTP/1.1 412 Precondition failed');
die('This proxy only supports requests to API version 1.1.');
Expand Down

0 comments on commit 380ff58

Please sign in to comment.