[noPoll] Issue with using "protocols" field from the client

Kale, Rahul Rahul.Kale en barco.com
Jue Mayo 28 19:40:43 CEST 2015


Thanks for the quick update!

Since we foresee use of the Windows version of the library too,
I will await the next stable release that includes these changes.
When do you plan on spinning the next release?
Should I try to compile the Windows version myself from the
current SVN repository?

Thanks again,

Rahul

From: Francis Brosnan Blázquez [mailto:francis en aspl.es]
Sent: Thursday, May 28, 2015 7:10 AM
To: Kale, Rahul
Cc: nopoll en lists.aspl.es
Subject: Re: [noPoll] Issue with using "protocols" field from the client

Hello there Rahul,

Thanks for reporting. Now the issue is fixed in a consistent way at the SVN 217 and
will be delivered on next stable release:

https://dolphin.aspl.es/svn/publico/nopoll/

Now, it will work for your case without any additional effort. Now I'm on it, I've updated
the API to allow handling these configurations and to allow the listener to select which
protocol is supported or take any other actions, including closing the connection, when
the protocol requested by the client isn't supported:

- nopoll_conn_get_accepted_protocol  (listener and client)
- nopoll_conn_get_requested_protocol (listener)
- nopoll_conn_set_accepted_protocol (listener)

Added regression test (test_27) to reproduce bug reported, check fix introduced and test
new API symbols added.

Again, thanks for reporting ...and any twitter, web, etc, reference to our noPoll site
http://www.aspl.es/nopoll<http://www.aspl.es/nopollis> is more than welcome,

Best Regards,



Hello,



After struggling with libwebsocket library for some days I switched to using the noPoll

library. So far things are going really well except I faced one issue very early on:



I am using the library to make a client connection to a websocket server.

After connecting to a websocket server, the connection is rejected. I see the following error

after enabling debug log.



(proc 23267): (critical) nopoll_conn.c:1858 (nopoll_conn_check_mime_header_repeated)

Provided header Sec-WebSocket-Protocol twice, closing connection



The code is using the API somewhat like this:



noPollConn * connection  = nopoll_conn_new(m_pContext, "127.0.0.1", "8080", NULL,

                "/", "some-protocol", "some-origin");



Note that we are setting the "protocols" parameter. It seems the server responds with the

same protocol string set in the header for Sec-WebSocket-Protocol

but the library rejects this for some reason and closes the connection.



I am not sure if I am doing something wrong in how the library is used

or there is some other problem. Please advise.

According to the specification the client can send a list of supported protocols

and the server can respond with a subset. In our case we only need to use one protocol.



Anyway, after modifying the library (see below) I was able to make progress

with our implementation and have not seen any other issue yet.



To 'fix' the above issue I had to comment out two lines at line 2192 in nopoll_conn.c:



#if 0

        if (nopoll_conn_check_mime_header_repeated (conn, header, value, "Sec-WebSocket-Protocol", conn->protocols))

                return 0;

#endif



Also I had to later fix an associated memory leak:



else if (strcasecmp (header, "Sec-Websocket-Protocol") == 0) {

        nopoll_free (conn->protocols);

        conn->protocols = value;

}



This may not be the correct fix but allowed me to proceed with the rest of

the implementation.



Thanks,



Rahul



Rahul Kale



IP Video Systems

Barco, Inc

1287 Anvilwood Ave

Sunnyvale, CA  94089



Tel  +1 408 400 4238



This message is subject to the following terms and conditions: MAIL DISCLAIMER<http://www.barco.com/en/maildisclaimer>



_______________________________________________

noPoll mailing list

noPoll en lists.aspl.es<mailto:noPoll en lists.aspl.es>

http://lists.aspl.es/cgi-bin/mailman/listinfo/nopoll




--

Francis Brosnan Blázquez <francis en aspl.es<mailto:francis en aspl.es>>

ASPL

91 134 14 22 - 91 134 14 45 - 91 116 07 57



AVISO LEGAL



En virtud de lo dispuesto en la Ley Orgánica 15/1999, de 13 de

diciembre, de Protección de Datos de Carácter Personal, le informamos de

que sus datos de carácter personal, recogidos de fuentes accesibles al

público o datos que usted nos ha facilitado previamente, proceden de

bases de datos propiedad de Advanced Software Production Line, S.L.

(ASPL).



ASPL garantiza que los datos serán tratados con la finalidad de mantener

las oportunas relaciones comerciales o promocionales con usted o la

entidad que usted representa. No obstante, usted puede ejercitar sus

derechos de acceso, rectificación, cancelación y oposición dispuestos en

la mencionada Ley Orgánica, notificándolo por escrito a ASPL -

Protección Datos, C/Antonio Suárez 10 A-102, 28802, Alcalá de Henares

(Madrid).






This message is subject to the following terms and conditions: MAIL DISCLAIMER<http://www.barco.com/en/maildisclaimer>
------------ próxima parte ------------
Se ha borrado un adjunto en formato HTML...
URL: <http://lists.aspl.es/pipermail/nopoll/attachments/20150528/3b81f6f6/attachment-0001.html>


Más información sobre la lista de distribución noPoll