Something is wrong in 'userp' for the HTTP2 recv_callback().
The session is created using bogus user-data; '&conn' and not
'conn'.

I noticed this since the socket-value in Curl_read_plain() was set to a
impossible high value. A patch:

--- orig/http2.c"      2014-01-29 15:19:25 +0000
+++ http2.c     2014-01-29 16:38:07 +0000
@@ -111,12 +111,12 @@
{
  struct connectdata *conn = (struct connectdata *)userp;
  ssize_t nread;
-  CURLcode rc = Curl_read_plain(conn->sock[0], (char *)buf, length, &nread);
+  CURLcode rc = Curl_read_plain(conn->sock[FIRSTSOCKET], (char *)buf, length, 
&nread);
  (void)h2;
  (void)flags;

  if(rc) {
-    failf(conn->data, "Failed recving HTTP2 data");
+    failf(conn->data, "Failed receiving HTTP2 data");
    return NGHTTP2_ERR_CALLBACK_FAILURE;
  }
  if(!nread)
@@ -169,7 +171,7 @@
  if(!conn->proto.httpc.h2) {
    /* The nghttp2 session is not yet setup, do it */
    int rc = nghttp2_session_client_new(&conn->proto.httpc.h2,
-                                        &callbacks, &conn);
+                                        &callbacks, conn);
    if(rc) {
      failf(conn->data, "Couldn't initialize nghttp2!");
      return CURLE_OUT_OF_MEMORY; /* most likely at least */

---------------

Things work bettter now:
 < Upgrade: HTTP-draft-09/2.0
 * Received 101
 * We have switched to HTTP2
 * Failed receiving HTTP2 data

The last error seems to be due to a EWOULDBLOCK in the callback.
Should we maybe return NGHTTP2_ERR_WOULDBLOCK in this case?

--gv
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html

Reply via email to