You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@zeppelin.apache.org by jo...@apache.org on 2017/03/27 09:21:56 UTC

zeppelin git commit: [ZEPPELIN-2314] Fix watcher websocket origin header

Repository: zeppelin
Updated Branches:
  refs/heads/master 78e2e912b -> 444ec6ded


[ZEPPELIN-2314] Fix watcher websocket origin header

### What is this PR for?
this is to add `Origin` header to ws client, and fix ws connection error after merging ZEPPELIN-2288, breaking ZEPPELIN-1697. more details in issue. also since breaking some changes in 0.7.0 branch, better include in `0.7.1`

### What type of PR is it?
Bug Fix

### Todos
* [x] - add header

### What is the Jira issue?
[ZEPPELIN-2314](https://issues.apache.org/jira/browse/ZEPPELIN-2314)

### How should this be tested?
same as in #2161

### Screenshots (if appropriate)

### Questions:
* Does the licenses files need update? no
* Is there breaking changes for older versions? no
* Does this needs documentation? no

Author: Khalid Huseynov <kh...@gmail.com>

Closes #2187 from khalidhuseynov/fix/ZEPPELIN-2314 and squashes the following commits:

05fced20 [Khalid Huseynov] add origin header to ws connect


Project: http://git-wip-us.apache.org/repos/asf/zeppelin/repo
Commit: http://git-wip-us.apache.org/repos/asf/zeppelin/commit/444ec6de
Tree: http://git-wip-us.apache.org/repos/asf/zeppelin/tree/444ec6de
Diff: http://git-wip-us.apache.org/repos/asf/zeppelin/diff/444ec6de

Branch: refs/heads/master
Commit: 444ec6ded23ffa0a502b6cca1f84a20340af565c
Parents: 78e2e91
Author: Khalid Huseynov <kh...@gmail.com>
Authored: Fri Mar 24 20:18:45 2017 +0900
Committer: Jongyoul Lee <jo...@apache.org>
Committed: Mon Mar 27 18:21:52 2017 +0900

----------------------------------------------------------------------
 .../notebook/repo/zeppelinhub/websocket/ZeppelinClient.java       | 3 +++
 1 file changed, 3 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/zeppelin/blob/444ec6de/zeppelin-zengine/src/main/java/org/apache/zeppelin/notebook/repo/zeppelinhub/websocket/ZeppelinClient.java
----------------------------------------------------------------------
diff --git a/zeppelin-zengine/src/main/java/org/apache/zeppelin/notebook/repo/zeppelinhub/websocket/ZeppelinClient.java b/zeppelin-zengine/src/main/java/org/apache/zeppelin/notebook/repo/zeppelinhub/websocket/ZeppelinClient.java
index fe70f71..9847e1c 100644
--- a/zeppelin-zengine/src/main/java/org/apache/zeppelin/notebook/repo/zeppelinhub/websocket/ZeppelinClient.java
+++ b/zeppelin-zengine/src/main/java/org/apache/zeppelin/notebook/repo/zeppelinhub/websocket/ZeppelinClient.java
@@ -68,6 +68,7 @@ public class ZeppelinClient {
   private SchedulerService schedulerService;
   private Authentication authModule;
   private static final int MIN = 60;
+  private static final String ORIGIN = "Origin";
 
   private static final Set<String> actionable = new  HashSet<String>(Arrays.asList(
       // running events
@@ -188,6 +189,7 @@ public class ZeppelinClient {
   private Session openWatcherSession() {
     ClientUpgradeRequest request = new ClientUpgradeRequest();
     request.setHeader(WatcherSecurityKey.HTTP_HEADER, WatcherSecurityKey.getKey());
+    request.setHeader(ORIGIN, "*");
     WatcherWebsocket socket = WatcherWebsocket.createInstace();
     Future<Session> future = null;
     Session session = null;
@@ -241,6 +243,7 @@ public class ZeppelinClient {
   
   private Session openNoteSession(String noteId, String principal, String ticket) {
     ClientUpgradeRequest request = new ClientUpgradeRequest();
+    request.setHeader(ORIGIN, "*");
     ZeppelinWebsocket socket = new ZeppelinWebsocket(noteId);
     Future<Session> future = null;
     Session session = null;