Permalink
Browse files

changes to maybe_authenticate_http, includes debug stuff

  • Loading branch information...
1 parent 970cd1e commit f5b52c75c7b75e9482e46a0f257b6f43b2b57faf @afragen committed Mar 10, 2014
Showing with 13 additions and 2 deletions.
  1. +13 −2 includes/class-github-updater.php
View
15 includes/class-github-updater.php
@@ -415,10 +415,20 @@ public function no_ssl_http_request_args( $args ) {
*
* @return mixed Amended HTTP Request arguments
*/
- public function maybe_authenticate_http( $args ) {
+ public function maybe_authenticate_http( $args, $type=null ) {
$username = null;
$password = null;
- if ( ! empty( $this->type->access_token ) ) { return $args; }
+
+ $ptype = explode( '/', parse_url( $type, PHP_URL_PATH ) );
+ $mybase = basename( $type, ".php" );
+ $repo = $this->type->repo;
+ $ext = pathinfo( basename( $type) , PATHINFO_EXTENSION);
+
+ if ( isset( $args['headers'] ) ) { unset( $args['headers']['Authorization'] ); }
+ //if ( ! empty( $this->type->access_token ) ) { return $args; }
+ //if ( 'zip' === pathinfo( basename( $type ) , PATHINFO_EXTENSION ) ) { return $args; }
+ if ( ! isset( $this->type ) ) { return $args; }
+ if ( ! in_array( $this->type->repo, explode( '/', parse_url( $type, PHP_URL_PATH ) ) ) ) { return $args; }
if ( ! isset( $this->type->user ) || ! isset( $this->type->pass ) ) { return $args; }
if ( $this->type->user && $this->type->pass ) {
@@ -432,4 +442,5 @@ public function maybe_authenticate_http( $args ) {
return $args;
}
+
}

0 comments on commit f5b52c7

Please sign in to comment.