Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
python-gwebsockets
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Sugar Team
python-gwebsockets
Commits
71e1e273
Commit
71e1e273
authored
10 years ago
by
kunal arora
Committed by
James Cameron
6 years ago
Browse files
Options
Downloads
Patches
Plain Diff
2to3 changes
parent
777954a3
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
gwebsockets/protocol.py
+6
-6
6 additions, 6 deletions
gwebsockets/protocol.py
gwebsockets/server.py
+3
-3
3 additions, 3 deletions
gwebsockets/server.py
with
9 additions
and
9 deletions
gwebsockets/protocol.py
+
6
−
6
View file @
71e1e273
...
...
@@ -20,7 +20,7 @@ import base64
import
binascii
import
collections
import
hashlib
import
http
lib
import
http
.client
import
struct
OPCODE_CONTINUATION
=
0x0
...
...
@@ -37,7 +37,7 @@ WS_HDRS = ('UPGRADE', 'CONNECTION',
Message
=
collections
.
namedtuple
(
'
Message
'
,
[
'
tp
'
,
'
data
'
,
'
extra
'
])
class
BadRequestException
(
http
lib
.
HTTPException
):
class
BadRequestException
(
http
.
client
.
HTTPException
):
code
=
400
...
...
@@ -120,7 +120,7 @@ def parse_message(buf):
g
=
parse_frame
(
buf
)
while
True
:
result
=
g
.
next
()
result
=
next
(
g
)
if
result
:
break
else
:
...
...
@@ -153,9 +153,9 @@ def parse_message(buf):
g
=
parse_frame
(
buf
)
while
not
fin
:
result
=
g
.
next
()
result
=
next
(
g
)
while
result
is
None
:
result
=
g
.
next
()
result
=
next
(
g
)
yield
fin
,
opcode
,
payload
=
result
...
...
@@ -219,7 +219,7 @@ def make_handshake(request):
if
not
request_line
.
startswith
(
"
GET
"
):
raise
BadRequestException
(
"
The method should be GET
"
)
message
=
http
lib
.
HTTPMessage
(
request
)
message
=
http
.
client
.
HTTPMessage
(
request
)
headers
=
dict
(
message
)
if
'
websocket
'
!=
headers
.
get
(
'
upgrade
'
,
''
).
lower
().
strip
():
...
...
This diff is collapsed.
Click to expand it.
gwebsockets/server.py
+
3
−
3
View file @
71e1e273
...
...
@@ -14,7 +14,7 @@
# limitations under the License.
import
logging
from
StringIO
import
StringIO
from
io
import
StringIO
from
collections
import
deque
from
gi.repository
import
Gio
...
...
@@ -97,7 +97,7 @@ class Session(GObject.GObject):
if
self
.
_parse_g
is
None
:
self
.
_parse_g
=
protocol
.
parse_message
(
self
.
_message
)
parsed_message
=
self
.
_parse_g
.
next
(
)
parsed_message
=
next
(
self
.
_parse_g
)
if
parsed_message
:
self
.
_parse_g
=
None
...
...
@@ -183,7 +183,7 @@ if __name__ == "__main__":
server
.
connect
(
"
session-started
"
,
session_started_cb
)
port
=
server
.
start
()
print
"
Listening on port %d
"
%
port
print
(
"
Listening on port %d
"
%
port
)
main_loop
=
GLib
.
MainLoop
()
main_loop
.
run
()
This diff is collapsed.
Click to expand it.
Jonas Smedegaard
@js
mentioned in commit
9693f3d0
·
4 years ago
mentioned in commit
9693f3d0
mentioned in commit 9693f3d0c05c7cfc6cec9257c0fc1b08053d507b
Toggle commit list
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment