Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/dequis/purple-facebook.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordequis <dx@dxzone.com.ar>2018-03-23 03:31:08 +0300
committerdequis <dx@dxzone.com.ar>2018-03-23 04:19:03 +0300
commitef6ae47b8bf971d3f2803b1552b7debc59429dc1 (patch)
tree2f86f6ce4286b8a4fad338f8eb780648a5624903
parent8f124c72b969a5b688ad54695689c5d0aed53469 (diff)
Fix "Failed to read fixed header" with TLS 1.3
Thanks to mandree for noticing it's EAGAIN See bug 410 for details
-rw-r--r--patches/13-async-sockets-are-hard.patch51
1 files changed, 51 insertions, 0 deletions
diff --git a/patches/13-async-sockets-are-hard.patch b/patches/13-async-sockets-are-hard.patch
new file mode 100644
index 0000000..6575294
--- /dev/null
+++ b/patches/13-async-sockets-are-hard.patch
@@ -0,0 +1,51 @@
+--- a/libpurple/protocols/facebook/mqtt.c
++++ b/libpurple/protocols/facebook/mqtt.c
+@@ -361,26 +361,33 @@
+ g_byte_array_set_size(priv->rbuf, 0);
+
+ res = purple_ssl_read(priv->gsc, &byte, sizeof byte);
+- g_byte_array_append(priv->rbuf, &byte, sizeof byte);
+
+- if (res != sizeof byte) {
++ if (res < 0 && errno == EAGAIN) {
++ return;
++ } else if (res != 1) {
+ fb_mqtt_error(mqtt, FB_MQTT_ERROR_GENERAL,
+ _("Failed to read fixed header"));
+ return;
+ }
+
++ g_byte_array_append(priv->rbuf, &byte, sizeof byte);
++
+ mult = 1;
+
+ do {
+ res = purple_ssl_read(priv->gsc, &byte, sizeof byte);
+- g_byte_array_append(priv->rbuf, &byte, sizeof byte);
+
+- if (res != sizeof byte) {
++ /* TODO: this case isn't handled yet */
++ if (0 && res < 0 && errno == EAGAIN) {
++ return;
++ } else if (res != 1) {
+ fb_mqtt_error(mqtt, FB_MQTT_ERROR_GENERAL,
+ _("Failed to read packet size"));
+ return;
+ }
+
++ g_byte_array_append(priv->rbuf, &byte, sizeof byte);
++
+ priv->remz += (byte & 127) * mult;
+ mult *= 128;
+ } while ((byte & 128) != 0);
+@@ -390,7 +397,9 @@
+ size = MIN(priv->remz, sizeof buf);
+ rize = purple_ssl_read(priv->gsc, buf, size);
+
+- if (rize < 1) {
++ if (rize < 0 && errno == EAGAIN) {
++ return;
++ } else if (rize < 1) {
+ fb_mqtt_error(mqtt, FB_MQTT_ERROR_GENERAL,
+ _("Failed to read packet data"));
+ return;