From dcba568ff912d89509344c0b4d264cb857c881a7 Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Fri, 24 Aug 2012 23:34:48 +0900 Subject: [PATCH] python: make assoc_stream_id and stream_user_data in submit_syn_stream optional --- doc/python.rst | 2 +- python/spdylay.pyx | 4 ++-- python/spdylay_tests.py | 20 ++++++++++---------- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/doc/python.rst b/doc/python.rst index e66bc497..a92fc0bb 100644 --- a/doc/python.rst +++ b/doc/python.rst @@ -408,7 +408,7 @@ Session Objects The :py:class:`InvalidArgumentError` will be raised if the *nv* includes empty name or ``None`` value. -.. py:method:: Session.submit_syn_stream(flags, assoc_stream_id, pri, nv, stream_user_data) +.. py:method:: Session.submit_syn_stream(flags, pri, nv, assoc_stream_id=0, stream_user_data=None) Submits SYN_STREAM frame. The *flags* is bitwise OR of the following values: diff --git a/python/spdylay.pyx b/python/spdylay.pyx index 1e46a4e1..c00a7ac1 100644 --- a/python/spdylay.pyx +++ b/python/spdylay.pyx @@ -855,8 +855,8 @@ cdef class Session: elif rv == cspdylay.SPDYLAY_ERR_NOMEM: raise MemoryError() - cpdef submit_syn_stream(self, flags, assoc_stream_id, pri, nv, - stream_user_data): + cpdef submit_syn_stream(self, flags, pri, nv, assoc_stream_id=0, + stream_user_data=None): cdef int rv cdef char **cnv nv = pynv_encode(nv) diff --git a/python/spdylay_tests.py b/python/spdylay_tests.py index cce51e3b..53a52c87 100644 --- a/python/spdylay_tests.py +++ b/python/spdylay_tests.py @@ -123,8 +123,8 @@ class SpdylayTests(unittest.TestCase): self.client_streams.recv_data.getvalue()) def test_submit_syn_stream_and_syn_stream(self): - self.client_session.submit_syn_stream(spdylay.CTRL_FLAG_FIN, 0, 2, - [(u':path', u'/')], None) + self.client_session.submit_syn_stream(spdylay.CTRL_FLAG_FIN, 2, + [(u':path', u'/')]) self.client_session.send() self.server_session.recv() @@ -148,8 +148,8 @@ class SpdylayTests(unittest.TestCase): self.assertEqual((u':version', u'HTTP/1.1'), frame.nv[0]) def test_submit_rst_stream(self): - self.client_session.submit_syn_stream(spdylay.CTRL_FLAG_FIN, 0, 2, - [(u':path', u'/')], None) + self.client_session.submit_syn_stream(spdylay.CTRL_FLAG_FIN, 2, + [(u':path', u'/')]) self.client_session.send() self.server_session.recv() @@ -267,8 +267,8 @@ class SpdylayTests(unittest.TestCase): self.client_session.send() def test_submit_data(self): - self.client_session.submit_syn_stream(spdylay.CTRL_FLAG_NONE, 0, 2, - [(u':path', u'/')], None) + self.client_session.submit_syn_stream(spdylay.CTRL_FLAG_NONE, 2, + [(u':path', u'/')]) self.client_session.send() self.server_session.recv() @@ -286,8 +286,8 @@ class SpdylayTests(unittest.TestCase): self.server_streams.recv_data.getvalue()) def test_submit_headers(self): - self.client_session.submit_syn_stream(spdylay.CTRL_FLAG_NONE, 0, 2, - [(u':path', u'/')], None) + self.client_session.submit_syn_stream(spdylay.CTRL_FLAG_NONE, 2, + [(u':path', u'/')]) self.client_session.send() self.server_session.recv() @@ -318,8 +318,8 @@ class SpdylayTests(unittest.TestCase): self.assertEqual(1, frame.unique_id) def test_submit_window_update(self): - self.client_session.submit_syn_stream(spdylay.CTRL_FLAG_NONE, 0, 2, - [(u':path', u'/')], None) + self.client_session.submit_syn_stream(spdylay.CTRL_FLAG_NONE, 2, + [(u':path', u'/')]) self.client_session.send() self.server_session.recv()