Repository: phoenixframework/phoenix (elixir)

Issue:
Could not check origin for Phoenix.Socket transport. Can we log the origin?
### Issue

I am having an issue with the socket connection, I have some connections from a website that I ignore, I would like to know what's the origin. 

I have logged and found were the requests were coming from using a plug before `sockets` in the endpoint.ex file.

But, would it be possible to log the origin in: https://github.com/phoenixframework/phoenix/blob/master/lib/phoenix/socket/transport.ex#L363
I can help.

### Environment

* Elixir version (elixir -v): Elixir 1.6.6 (compiled with OTP 20)
* Phoenix version (mix deps): 1.3.3
* Operating system: Mac os

Pull request description:
log origin when error on check_origin
fixes #2983

Patch:
diff --git a/lib/phoenix/socket/transport.ex b/lib/phoenix/socket/transport.ex
index 9ebe72ad8..66609db1e 100644
--- a/lib/phoenix/socket/transport.ex
+++ b/lib/phoenix/socket/transport.ex
@@ -363,6 +363,8 @@ defmodule Phoenix.Socket.Transport do
         Logger.error """
         Could not check origin for Phoenix.Socket transport.
 
+        Origin of the request: #{origin}
+
         This happens when you are attempting a socket connection to
         a different host than the one configured in your config/
         files. For example, in development the host is configured


Test patch:
diff --git a/test/phoenix/socket/transport_test.exs b/test/phoenix/socket/transport_test.exs
index b81a383d4..888ce00af 100644
--- a/test/phoenix/socket/transport_test.exs
+++ b/test/phoenix/socket/transport_test.exs
@@ -1,9 +1,11 @@
 System.put_env("TRANSPORT_TEST_HOST", "host.com")
 
 defmodule Phoenix.Socket.TransportTest do
-  use ExUnit.Case, async: true
+  use ExUnit.Case, async: false
   use RouterHelper
 
+  import ExUnit.CaptureLog
+
   alias Phoenix.Socket.Transport
 
   Application.put_env :phoenix, __MODULE__.Endpoint,
@@ -79,15 +81,21 @@ defmodule Phoenix.Socket.TransportTest do
       assert conn.halted
     end
 
-
     test "halts invalid URIs when check origin is configured" do
+      Logger.enable(self())
       origins = ["//example.com", "http://scheme.com", "//port.com:81"]
 
-      for config <- [origins, true] do
-        assert check_origin("file://", check_origin: config).halted
-        assert check_origin("null", check_origin: config).halted
-        assert check_origin("", check_origin: config).halted
-      end
+      logs =
+        capture_log(fn ->
+          for config <- [origins, true] do
+            assert check_origin("file://", check_origin: config).halted
+            assert check_origin("null", check_origin: config).halted
+            assert check_origin("", check_origin: config).halted
+          end
+        end)
+
+      assert logs =~ "file://"
+      assert logs =~ "null"
     end
 
     def invalid_allowed?(%URI{host: nil}), do: true