After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 669306 - Gio async networking request doesn't work
Gio async networking request doesn't work
Status: RESOLVED FIXED
Product: pygobject
Classification: Bindings
Component: gio
unspecified
Other Linux
: Normal normal
: ---
Assigned To: Nobody's working on this now (help wanted and appreciated)
Python bindings maintainers
Depends on: 671139
Blocks:
 
 
Reported: 2012-02-03 12:53 UTC by Cesar Garcia Tapia
Modified: 2013-02-27 10:53 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Test code (async) (1.70 KB, text/x-python)
2012-02-03 12:53 UTC, Cesar Garcia Tapia
Details
Test code (sync) (1.53 KB, text/x-python)
2012-02-03 12:54 UTC, Cesar Garcia Tapia
Details

Description Cesar Garcia Tapia 2012-02-03 12:53:47 UTC
Created attachment 206681 [details]
Test code (async)

I'm trying to use Gio for a WebSocket client library, and I've found that the Gio.OutputStream.write_async() doesn't work properly.

If I send this header:

GET / HTTP/1.1\r\nHost: www.google.com\r\n\r\n

It only sends the following (checked with wireshark):

TP/1.1\r\nHost: www.google.com\r\n\r\n

And, obviously, I get a 400 Bad Request error.

Writing the same example with the synchronous methods, works perfectly. I attach some test code, doing the same request sync and asynchronously.
Comment 1 Cesar Garcia Tapia 2012-02-03 12:54:54 UTC
Created attachment 206682 [details]
Test code (sync)
Comment 2 Dan Winship 2012-03-01 15:22:55 UTC
The problem is that python is GC'ing the string after passing it to g_output_stream_write_async().

Hm... I don't think there's currently any way to correctly annotate g_output_stream_write_async(). I'm going to file a g-i bug and make this depend on it.
Comment 3 Simon Feltman 2013-02-27 10:53:30 UTC
Verified the async test code now works.