jrconlin/pushgo

smoke_test.py response pushEndpoint is dropping the port number

Closed this issue · 6 comments

  1. run server on localhost:8080
  2. cd simplepush_test then run: python smoke_test.py

actual: notice the output: endpoint is missing :8080 in string

Edwin@edog:~/github/edmoz/simplepush_test$ python smoke_test.py 
smoke_test.py:131: SyntaxWarning: assertion is always true, perhaps remove parentheses?
  assert(msg.get("uaid") == uaid, "did not echo UAID")
smoke_test.py:140: SyntaxWarning: assertion is always true, perhaps remove parentheses?
  assert(msg.get("updates")[0].get("channelID") == ws.chid,
smoke_test.py:143: SyntaxWarning: assertion is always true, perhaps remove parentheses?
  assert(msg.get("updates")[0].get("version") == ws.version,
smoke_test.py:153: SyntaxWarning: assertion is always true, perhaps remove parentheses?
  assert(msg.get("pushEndpoint") is not None, "Missing pushEndpoint")
smoke_test.py:154: SyntaxWarning: assertion is always true, perhaps remove parentheses?
  assert(msg.get("channelID") is not None, "Missing channelID")
--- request header ---
GET / HTTP/1.1
Upgrade: websocket
Connection: Upgrade
Host: localhost:8080
Origin: http://localhost:8080
Sec-WebSocket-Key: ipjdu+gxSkumw0q6nP1Dhg==
Sec-WebSocket-Version: 13


-----------------------
--- response header ---
HTTP/1.1 101 Switching Protocols
Upgrade: websocket
Connection: Upgrade
Sec-WebSocket-Accept: afYilnjPCdq+AGFMxqdlcBUc1+w=
-----------------------
initialize
>>> Sending 'Hello'
send: ''
recv: '\x81R{"messageType":"hello","status":200,"uaid":"decafbad-0000-0000-0000-000000000000"}'
<<< Recv'd:: hello>> {"messageType":"hello","status":200,"uaid":"decafbad-0000-0000-0000-000000000000"}
<<< {u'messageType': u'hello',
 u'status': 200,
 u'uaid': u'decafbad-0000-0000-0000-000000000000'}
send: ''
recv: '\x81~\x00\xcd{"channelID":"deadbeef-0000-0000-0000-000000000000","messageType":"register","pushEndpoint":"http://localhost/update/decafbad-0000-0000-0000-000000000000.deadbeef-0000-0000-0000-000000000000","status":200}'
<<< Recv'd:: register>> {"channelID":"deadbeef-0000-0000-0000-000000000000","messageType":"register","pushEndpoint":"http://localhost/update/decafbad-0000-0000-0000-000000000000.deadbeef-0000-0000-0000-000000000000","status":200}
<<< {u'channelID': u'deadbeef-0000-0000-0000-000000000000',
 u'messageType': u'register',
 u'pushEndpoint': u'http://localhost/update/decafbad-0000-0000-0000-000000000000.deadbeef-0000-0000-0000-000000000000',
 u'status': 200}
>>> Sending REST update
[Errno 61] Connection refused

I just noticed that the formatting is defined in the config.ini , closing as designed.

reopening - i set this, and it's still dropping the port: push.endpoint = http://<current_host>:8080/update/<token>

Is that the actual UUID being used? If so, it's an invalid variation 4 UUID. Might explain it, though the server shouldn't be dying because of a bad UUID.

Please include the following items copied directly from your config.ini file:

host
port
push.endpoint

as well as the response from:

curl http://localhost:8080/realstatus/

I am unable to reproduce this error using v.0.7 or v.1.0

    host = 0.0.0.0
    port = 8080
    push.endpoint = http://<current_host>/update/<token>
> bin/python smoke_test.py
smoke_test.py:130: SyntaxWarning: assertion is always true, perhaps remove parentheses?
  assert(msg.get("uaid") == uaid, "did not echo UAID")
smoke_test.py:139: SyntaxWarning: assertion is always true, perhaps remove parentheses?
  assert(msg.get("updates")[0].get("channelID") == ws.chid,
smoke_test.py:142: SyntaxWarning: assertion is always true, perhaps remove parentheses?
  assert(msg.get("updates")[0].get("version") == ws.version,
smoke_test.py:153: SyntaxWarning: assertion is always true, perhaps remove parentheses?
  assert(msg.get("pushEndpoint") is not None, "Missing pushEndpoint")
smoke_test.py:154: SyntaxWarning: assertion is always true, perhaps remove parentheses?
  assert(msg.get("channelID") is not None, "Missing channelID")
--- request header ---
GET / HTTP/1.1
Upgrade: websocket
Connection: Upgrade
Host: localhost:8080
Origin: localhost:8080
Sec-WebSocket-Key: LikankKqT561HyqFApV+4Q==
Sec-WebSocket-Version: 13


-----------------------                                                         
--- response header ---                                                         
HTTP/1.1 101 Switching Protocols                                                
Upgrade: websocket                                                              
Connection: Upgrade                                                             
Sec-WebSocket-Accept: 0jSRHAF1GaUeGVAONEy7sjCmT64=                              
-----------------------
initialize                                                                      
>>> Sending 'Hello'                                                             
send: ''
recv: '\x81R{"messageType":"hello","status":200,"uaid":"decafbad-0000-0000-0000-000000000000"}'                                                                 
<<< Recv'd:: hello>> {"messageType":"hello","status":200,"uaid":"decafbad-0000-0000-0000-000000000000"}                                                         
<<< {u'messageType': u'hello',                                                   
 u'status': 200,
 u'uaid': u'decafbad-0000-0000-0000-000000000000'}                              
send: ''
recv: '\x81~\x01\x00{"channelID":"deadbeef-0000-0000-0000-000000000000","messageType":"register","pushEndpoint":"http://localhost:8080/update/decafbad-0000-0000-0000-000000000000.deadbeef-0000-0000-0000-000000000000","status":200,"uaid":"decafbad-0000-0000-0000-000000000000"}'
<<< Recv'd:: register>> {"channelID":"deadbeef-0000-0000-0000-000000000000","messageType":"register","pushEndpoint":"http://localhost:8080/update/decafbad-0000-0000-0000-000000000000.deadbeef-0000-0000-0000-000000000000","status":200,"uaid":"decafbad-0000-0000-0000-000000000000"}
<<< {u'channelID': u'deadbeef-0000-0000-0000-000000000000',
 u'messageType': u'register',
 u'pushEndpoint': u'http://localhost:8080/update/decafbad-0000-0000-0000-000000000000.deadbeef-0000-0000-0000-000000000000',
 u'status': 200,
 u'uaid': u'decafbad-0000-0000-0000-000000000000'}
??? {"status": 200, "uaid": "decafbad-0000-0000-0000-000000000000", "channelID": "deadbeef-0000-0000-0000-000000000000", "messageType": "register", "pushEndpoint": "http://localhost:8080/update/decafbad-0000-0000-0000-000000000000.deadbeef-0000-0000-0000-000000000000"}
>>> Sending REST update
send: u'PUT /update/decafbad-0000-0000-0000-000000000000.deadbeef-0000-0000-0000-000000000000?version= HTTP/1.1\r\nHost: localhost:8080\r\nAccept-Encoding: identity\r\n\r\n'
#>>
reply: 'HTTP/1.1 200 OK\r\n'
header: Content-Type: application/json
header: Date: Fri, 27 Sep 2013 10:09:42 GMT
header: Content-Length: 2
#<< '{}'
recv: '\x81t{"messageType":"notification","updates":[{"channelID":"deadbeef-0000-0000-0000-000000000000","version":1380301782}]}'
<<< Recv'd:: update>> {"messageType":"notification","updates":[{"channelID":"deadbeef-0000-0000-0000-000000000000","version":1380301782}]}
<<< {u'messageType': u'notification',
 u'updates': [{u'channelID': u'deadbeef-0000-0000-0000-000000000000',
               u'version': 1380301782}]}
### Update pass, shutting down....
>>> Sending Unreg
send: ''
>>> send ack{"updates": [{"channelID": "deadbeef-0000-0000-0000-000000000000", "version": 1380301782}], "messageType": "ack"}
send: ''
recv: '\x81\\{"channelID":"deadbeef-0000-0000-0000-000000000000","messageType":"unregister","status":200}'
<<< Recv'd:: shutdown>> {"channelID":"deadbeef-0000-0000-0000-000000000000","messageType":"unregister","status":200}
<<< {u'channelID': u'deadbeef-0000-0000-0000-000000000000',
 u'messageType': u'unregister',
 u'status': 200}
### SUCCESS!!! Exiting...
send: ''
recv: '\x88\x02\x03\xe8'
close status: '\x03\xe8'
## Closed
leaving
==============
Smoke test was successful
==============

Note the inclusion of the host and port in the token.

Hmm, I'm still repro'ing the issue. I'm on master, for both server and test, and verified on correct head sha. My settings look almost like config.sample.ini
host = 0.0.0.0
port = 8080
push.endpoint = http://<current_host>/update/

here's my config.ini on pastebin:
http://www.pastebin.mozilla.org/3158105

Edwin@edog:~/ $ curl http://localhost:8080/realstatus
not websocket protocol

turns out I was running old code, as my build failed, but ran last built main - That's captured with #60