Skip to content
Open
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
12 changes: 6 additions & 6 deletions ba-simple-proxy.php
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@
curl_setopt( $ch, CURLOPT_POSTFIELDS, $_POST );
}

if ( $_GET['send_cookies'] ) {
if (isset($_GET['send_cookies']) && $_GET['send_cookies'] ) {
$cookie = array();
foreach ( $_COOKIE as $key => $value ) {
$cookie[] = $key . '=' . $value;
Expand All @@ -181,7 +181,7 @@
curl_setopt( $ch, CURLOPT_HEADER, true );
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true );

curl_setopt( $ch, CURLOPT_USERAGENT, $_GET['user_agent'] ? $_GET['user_agent'] : $_SERVER['HTTP_USER_AGENT'] );
curl_setopt( $ch, CURLOPT_USERAGENT, isset($_GET['user_agent']) && $_GET['user_agent'] ? $_GET['user_agent'] : $_SERVER['HTTP_USER_AGENT'] );

list( $header, $contents ) = preg_split( '/([\r\n][\r\n])\\1/', curl_exec( $ch ), 2 );

Expand All @@ -193,7 +193,7 @@
// Split header text into an array.
$header_text = preg_split( '/[\r\n]+/', $header );

if ( $_GET['mode'] == 'native' ) {
if (isset($_GET['mode']) && $_GET['mode'] == 'native' ) {
if ( !$enable_native ) {
$contents = 'ERROR: invalid mode';
$status = array( 'http_code' => 'ERROR' );
Expand All @@ -214,7 +214,7 @@
$data = array();

// Propagate all HTTP headers into the JSON data object.
if ( $_GET['full_headers'] ) {
if (isset($_GET['full_headers']) && $_GET['full_headers'] ) {
$data['headers'] = array();

foreach ( $header_text as $header ) {
Expand All @@ -226,7 +226,7 @@
}

// Propagate all cURL request / response info to the JSON data object.
if ( $_GET['full_status'] ) {
if (isset($_GET['full_status']) && $_GET['full_status'] ) {
$data['status'] = $status;
} else {
$data['status'] = array();
Expand All @@ -251,4 +251,4 @@

}

?>
?>