diff options
7 files changed, 100 insertions, 67 deletions
diff --git a/components/congress/test-webapp/www/centos-httpd.conf b/components/congress/test-webapp/www/centos-httpd.conf index a7af0dc..05241d7 100644 --- a/components/congress/test-webapp/www/centos-httpd.conf +++ b/components/congress/test-webapp/www/centos-httpd.conf @@ -1,3 +1,19 @@ +# Copyright 2015-2016 Open Platform for NFV Project, Inc. and its contributors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# What this is: Apache configuration file for Centos +# Status: this is a work in progress, under test. # # This is the main Apache HTTP server configuration file. It contains the # configuration directives that give the server its instructions. diff --git a/components/congress/test-webapp/www/html/congress_translators.js b/components/congress/test-webapp/www/html/congress_translators.js index 951cbcb..9390032 100644 --- a/components/congress/test-webapp/www/html/congress_translators.js +++ b/components/congress/test-webapp/www/html/congress_translators.js @@ -1,5 +1,5 @@ /* - Copyright 2015 Open Platform for NFV Project, Inc. and its contributors + Copyright 2015-2016 Open Platform for NFV Project, Inc. and its contributors Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/components/congress/test-webapp/www/html/copper.css b/components/congress/test-webapp/www/html/copper.css index af86d52..9d5c355 100644 --- a/components/congress/test-webapp/www/html/copper.css +++ b/components/congress/test-webapp/www/html/copper.css @@ -1,5 +1,5 @@ -*/
-# Copyright 2015 Open Platform for NFV Project, Inc. and its contributors
+/*
+# Copyright 2015-2016 Open Platform for NFV Project, Inc. and its contributors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
diff --git a/components/congress/test-webapp/www/html/copper.js b/components/congress/test-webapp/www/html/copper.js index ddc395e..5b4ee4d 100644 --- a/components/congress/test-webapp/www/html/copper.js +++ b/components/congress/test-webapp/www/html/copper.js @@ -1,5 +1,5 @@ /*
- Copyright 2015 Open Platform for NFV Project, Inc. and its contributors
+ Copyright 2015-2016 Open Platform for NFV Project, Inc. and its contributors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -13,7 +13,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
-var origin = "http://localhost/proxy/?~url=";
+var origin = "http://COPPER_HOST/proxy/?~url=";
var dataSources = [];
var datasource_tables = [];
var datasource_rows = [];
diff --git a/components/congress/test-webapp/www/html/index.html b/components/congress/test-webapp/www/html/index.html index 4d0164d..670e9c8 100644 --- a/components/congress/test-webapp/www/html/index.html +++ b/components/congress/test-webapp/www/html/index.html @@ -4,7 +4,7 @@ <title>OPNFV Congress Test</title>
<link rel='stylesheet' type='text/css' href='copper.css'/>
<!--
- Copyright 2015 Open Platform for NFV Project, Inc. and its contributors
+ Copyright 2015-2016 Open Platform for NFV Project, Inc. and its contributors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/components/congress/test-webapp/www/html/proxy/index.php b/components/congress/test-webapp/www/html/proxy/index.php index 1ce4e45..5a4b595 100644 --- a/components/congress/test-webapp/www/html/proxy/index.php +++ b/components/congress/test-webapp/www/html/proxy/index.php @@ -1,60 +1,60 @@ -<?php
-/*
- Copyright 2015 Open Platform for NFV Project, Inc. and its contributors
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-*/
-$method = $_SERVER['REQUEST_METHOD'];
-if ($method == 'OPTIONS') {
- header("Content-Type: application/json");
- header("Access-Control-Allow-Origin: *");
- header("Access-Control-Allow-Headers: Content-Type");
- header("Access-Control-Allow-Methods: GET, POST, DELETE");
- exit();
-}
-
-$url = "http://192.168.10.117:1789".$_GET['~url'];
-$curlop = curl_init();
-curl_setopt($curlop, CURLOPT_URL, $url);
-curl_setopt($curlop, CURLOPT_CUSTOMREQUEST, $method);
-//curl_setopt($curlop, CURLOPT_HEADER, 0);
-//curl_setopt($curlop, CURLINFO_HEADER_OUT, 0);
-curl_setopt($curlop, CURLOPT_RETURNTRANSFER, 1);
-curl_setopt($curlop, CURLOPT_SSL_VERIFYPEER, false);
-curl_setopt($curlop, CURLINFO_HEADER_OUT, true);
-
-if ($method == "POST") {
- curl_setopt($curlop, CURLOPT_HTTPHEADER, array("Content-Type: application/json"));
- $body = file_get_contents('php://input');
- curl_setopt($curlop, CURLOPT_POSTFIELDS, $body);
-}
-
-$response = curl_exec($curlop);
-$req_time=time();
-
-$info = curl_getinfo($curlop);
-$result = file_put_contents("/home/ubuntu/logs/".date('ymd').".log", "proxy.php, ".$req_time.", ".$url.", ".$type.", ".$body."\n",FILE_APPEND);
-if ($result === false) $response = "PHP error in index.php";
-$responseCode=curl_getinfo($curlop,CURLINFO_HTTP_CODE);
-$header_size = curl_getinfo($response, CURLINFO_HEADER_SIZE);
-$header = substr($response, 0, $header_size);
-$type = curl_getinfo($curlop,CURLINFO_CONTENT_TYPE);
-$body = substr($response, $header_size);
-$result = file_put_contents("/home/ubuntu/logs/".date('ymd').".log", "proxy.php, ".$req_time.", ".$responseCode.", ".$type.", ".$header.", ".$body."\n",FILE_APPEND);
-if ($result === false) $response = "PHP error in index.php";
-
-// header("Location: ".$url);
-header("Content-Type: ".$type);
-header("Access-Control-Allow-Origin: *");
-echo $response;
-curl_close($curlop);
+<?php +/* + Copyright 2015-2016 Open Platform for NFV Project, Inc. and its contributors + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ +$method = $_SERVER['REQUEST_METHOD']; +if ($method == 'OPTIONS') { + header("Content-Type: application/json"); + header("Access-Control-Allow-Origin: *"); + header("Access-Control-Allow-Headers: Content-Type"); + header("Access-Control-Allow-Methods: GET, POST, DELETE"); + exit(); +} + +$url = "http://CONGRESS_HOST:1789".$_GET['~url']; +$curlop = curl_init(); +curl_setopt($curlop, CURLOPT_URL, $url); +curl_setopt($curlop, CURLOPT_CUSTOMREQUEST, $method); +//curl_setopt($curlop, CURLOPT_HEADER, 0); +//curl_setopt($curlop, CURLINFO_HEADER_OUT, 0); +curl_setopt($curlop, CURLOPT_RETURNTRANSFER, 1); +curl_setopt($curlop, CURLOPT_SSL_VERIFYPEER, false); +curl_setopt($curlop, CURLINFO_HEADER_OUT, true); + +if ($method == "POST") { + curl_setopt($curlop, CURLOPT_HTTPHEADER, array("Content-Type: application/json")); + $body = file_get_contents('php://input'); + curl_setopt($curlop, CURLOPT_POSTFIELDS, $body); +} + +$response = curl_exec($curlop); +$req_time=time(); + +$info = curl_getinfo($curlop); +$result = file_put_contents("/home/ubuntu/logs/".date('ymd').".log", "proxy.php, ".$req_time.", ".$url.", ".$type.", ".$body."\n",FILE_APPEND); +if ($result === false) $response = "PHP error in index.php"; +$responseCode=curl_getinfo($curlop,CURLINFO_HTTP_CODE); +$header_size = curl_getinfo($response, CURLINFO_HEADER_SIZE); +$header = substr($response, 0, $header_size); +$type = curl_getinfo($curlop,CURLINFO_CONTENT_TYPE); +$body = substr($response, $header_size); +$result = file_put_contents("/home/ubuntu/logs/".date('ymd').".log", "proxy.php, ".$req_time.", ".$responseCode.", ".$type.", ".$header.", ".$body."\n",FILE_APPEND); +if ($result === false) $response = "PHP error in index.php"; + +// header("Location: ".$url); +header("Content-Type: ".$type); +header("Access-Control-Allow-Origin: *"); +echo $response; +curl_close($curlop); diff --git a/components/congress/test-webapp/www/ubuntu-apache2.conf b/components/congress/test-webapp/www/ubuntu-apache2.conf index f5d5408..6561e4b 100644 --- a/components/congress/test-webapp/www/ubuntu-apache2.conf +++ b/components/congress/test-webapp/www/ubuntu-apache2.conf @@ -1,10 +1,27 @@ +# Copyright 2015-2016 Open Platform for NFV Project, Inc. and its contributors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# What this is: Apache configuration file for Ubuntu +# Status: this is a work in progress, under test. +# # This is the main Apache server configuration file. It contains the # configuration directives that give the server its instructions. # See http://httpd.apache.org/docs/2.4/ for detailed information about # the directives and /usr/share/doc/apache2/README.Debian about Debian specific # hints. # -# + # Summary of how the Apache 2 configuration works in Debian: # The Apache 2 web server configuration in Debian is quite different to # upstream's suggested way to configure the web server. This is because Debian's |