You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openwhisk.apache.org by mh...@apache.org on 2017/09/17 20:06:26 UTC

[incubator-openwhisk-apigateway] branch master updated (28546b4 -> f29d872)

This is an automated email from the ASF dual-hosted git repository.

mhamann pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-openwhisk-apigateway.git.


    from 28546b4  lower case bearer (#252)
     new 72b183c  Allow credentials for cors requests
     new f29d872  Add gateway specific scancode config file

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 scripts/lua/cors.lua          | 21 ++++++---------------
 tests/scripts/lua/routing.lua |  1 -
 tools/build/scanCode.cfg      | 43 +++++++++++++++++++++++++++++++++++++++++++
 tools/travis/build.sh         |  2 +-
 4 files changed, 50 insertions(+), 17 deletions(-)
 create mode 100644 tools/build/scanCode.cfg

-- 
To stop receiving notification emails like this one, please contact
['"commits@openwhisk.apache.org" <co...@openwhisk.apache.org>'].

[incubator-openwhisk-apigateway] 01/02: Allow credentials for cors requests

Posted by mh...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

mhamann pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-openwhisk-apigateway.git

commit 72b183cbbd4ea373fb0f82e099121156aaf0b39f
Author: Alex Song <so...@us.ibm.com>
AuthorDate: Tue Aug 22 14:18:29 2017 -0400

    Allow credentials for cors requests
---
 scripts/lua/cors.lua | 21 ++++++---------------
 1 file changed, 6 insertions(+), 15 deletions(-)

diff --git a/scripts/lua/cors.lua b/scripts/lua/cors.lua
index 6e5c6db..ea11579 100644
--- a/scripts/lua/cors.lua
+++ b/scripts/lua/cors.lua
@@ -19,13 +19,13 @@
 -- Used to set cors headers for preflight and simple requests
 
 local _M = {}
-local request = require "lib/request"
+local request = require 'lib/request'
 
 function _M.processCall(resourceConfig)
   if resourceConfig.cors ~= nil then
     ngx.var.cors_origins = resourceConfig.cors.origin
     ngx.var.cors_methods = resourceConfig.cors.methods
-    if resourceConfig.cors.origin ~= 'false' and ngx.req.get_method() == "OPTIONS" then
+    if resourceConfig.cors.origin ~= 'false' and ngx.req.get_method() == 'OPTIONS' then
       request.success(200)
     end
   end
@@ -33,23 +33,14 @@ end
 
 function _M.replaceHeaders()
   if ngx.var.cors_origins ~= nil then
-    if ngx.var.cors_origins == 'true' then
-      ngx.header['Access-Control-Allow-Headers'] = ngx.req.get_headers()['Access-Control-Request-Headers']
-      ngx.header['Access-Control-Allow-Origin'] = '*'
-      ngx.header['Access-Control-Allow-Methods'] = ngx.var.cors_methods
-      if ngx.var.cors_methods == nil then
-        ngx.header['Access-Control-Allow-Methods'] = 'GET, POST, PUT, DELETE, PATCH, HEAD, OPTIONS'
-      end
-    elseif ngx.var.cors_origins == 'false' then
+    if ngx.var.cors_origins == 'false' then
       ngx.header['Access-Control-Allow-Origin'] = nil
       ngx.header['Access-Control-Allow-Methods'] = nil
     else
-      ngx.header['Access-Control-Allow-Origin'] = ngx.var.cors_origins
-      ngx.header['Access-Control-Allow-Methods'] = ngx.var.cors_methods
+      ngx.header['Access-Control-Allow-Origin'] = ngx.var.cors_origins == 'true' and (ngx.var.http_origin or '*') or ngx.var.cors_origins
+      ngx.header['Access-Control-Allow-Methods'] = ngx.var.cors_methods or 'GET, POST, PUT, DELETE, PATCH, HEAD, OPTIONS'
       ngx.header['Access-Control-Allow-Headers'] = ngx.req.get_headers()['Access-Control-Request-Headers']
-      if ngx.var.cors_methods == nil then
-        ngx.header['Access-Control-Allow-Methods'] = 'GET, POST, PUT, DELETE, PATCH, HEAD, OPTIONS'
-      end
+      ngx.header['Access-Control-Allow-Credentials'] = 'true'
     end
   end
 end

-- 
To stop receiving notification emails like this one, please contact
"commits@openwhisk.apache.org" <co...@openwhisk.apache.org>.

[incubator-openwhisk-apigateway] 02/02: Add gateway specific scancode config file

Posted by mh...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

mhamann pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-openwhisk-apigateway.git

commit f29d8722bb41c5cb18ff3ee6b80f86fa2052674e
Author: Alex Song <so...@us.ibm.com>
AuthorDate: Wed Aug 23 15:17:39 2017 -0400

    Add gateway specific scancode config file
---
 tests/scripts/lua/routing.lua |  1 -
 tools/build/scanCode.cfg      | 43 +++++++++++++++++++++++++++++++++++++++++++
 tools/travis/build.sh         |  2 +-
 3 files changed, 44 insertions(+), 2 deletions(-)

diff --git a/tests/scripts/lua/routing.lua b/tests/scripts/lua/routing.lua
index 7869a7a..1f10763 100644
--- a/tests/scripts/lua/routing.lua
+++ b/tests/scripts/lua/routing.lua
@@ -134,7 +134,6 @@ describe('Testing routing with snapshotting', function()
     local dataStore = ds.initWithDriver(red)
     dataStore:setSnapshotId('test')
     local result = dataStore:getAllResources('test')[1]
-    print ('etst')
     assert.are.same(result, 'resources:test:v1/test')
     local routing = require  'routing'
     local result = routing.findResource(dataStore, dataStore:getAllResources('test'), 'test', 'v1/test')
diff --git a/tools/build/scanCode.cfg b/tools/build/scanCode.cfg
new file mode 100644
index 0000000..fa451e0
--- /dev/null
+++ b/tools/build/scanCode.cfg
@@ -0,0 +1,43 @@
+# scanCode.py configuration file
+
+# List of filenames containing the text of valid license (headers)
+# These files SHOULD be in the same directory path where scanCode.py
+# resides.
+[Licenses]
+ASFLicenseHeaderLua.txt
+
+# Filters (path/filename) with wildcards and associated scan checks
+# that are to be run against them.  The checks are actual valid
+# function names found in scanCode.py.
+[Includes]
+*=is_not_symlink
+*.scala=has_block_license, no_tabs, no_trailing_spaces, eol_at_eof
+*.py=no_tabs, no_trailing_spaces, eol_at_eof
+*.java=has_block_license, no_tabs, no_trailing_spaces, eol_at_eof
+*.js=no_tabs, no_trailing_spaces, eol_at_eof
+*.gradle=no_tabs, no_trailing_spaces, eol_at_eof
+*.md=no_tabs, eol_at_eof
+*.go=has_block_license, no_trailing_spaces, eol_at_eof
+*.lua=has_block_license
+build.xml=no_tabs, no_trailing_spaces, eol_at_eof
+deploy.xml=no_tabs, no_trailing_spaces, eol_at_eof
+
+# List of paths (inclusive of subdirectories) to exlude from code scanning
+[Excludes]
+# General exclusions
+.tox
+.git
+.bin
+
+# OpenWhisk APIGateway exclusions
+lua_install
+tests/lua_modules
+
+[Options]
+# Not all code files allow licenses to appear starting at the first character
+# of the file. This option tells the scan to allow licenses to appear starting
+# within first 'x' characters of each code file (as provided by this option's
+# value).
+LICENSE_SLACK_LENGTH=500
+
+[Regex]
\ No newline at end of file
diff --git a/tools/travis/build.sh b/tools/travis/build.sh
index ebb0a66..731a74f 100755
--- a/tools/travis/build.sh
+++ b/tools/travis/build.sh
@@ -10,7 +10,7 @@ WHISKDIR="$ROOTDIR/../openwhisk"
 
 # run the scancode util. against project source code starting at its root
 cd $HOMEDIR
-incubator-openwhisk-utilities/scancode/scanCode.py $ROOTDIR
+incubator-openwhisk-utilities/scancode/scanCode.py $ROOTDIR --config $ROOTDIR/tools/build/scanCode.cfg
 
 # Install OpenWhisk
 cd $WHISKDIR/ansible

-- 
To stop receiving notification emails like this one, please contact
"commits@openwhisk.apache.org" <co...@openwhisk.apache.org>.