[Libwebsockets] Posting large files with SSL and HTTP2 fails

Avigail Wilk awilk at kramerav.com
Tue Jul 20 10:05:37 CEST 2021


Hi,

I'm using libwebsockets v4.2.0
In my application I handle the callbacks manually, and I use HTTPS .
When I compile libwebsockets with the flag -DLWS_WITH_HTTP2=1, to use HTTP2 - uploading a large file via multipart post fails.
If I use HTTP1.1 (using the flag -DLWS_WITH_HTTP2=0) there is no problem posting large files.

I changed minimal-http-server-form-post-file to be as closest to my application and was able to reproduce the problem:

120c120
< //                        if (!strcmp((const char *)in, "/form1"))
---
>                             if (!strcmp((const char *)in, "/form1"))
197,217d196
<
< static const struct lws_http_mount mount2 = {
<     /* .mount_next */          NULL,        /* linked-list "next" */
<     /* .mountpoint */       "/form1",        /* mountpoint URL */
<     /* .origin */       "http",//"./mount-origin",   /* serve from dir */
<     /* .def */          NULL,   /* default filename */
<     /* .protocol */         NULL,
<     /* .cgienv */           NULL,
<     /* .extra_mimetypes */      NULL,
<     /* .interpret */        NULL,
<     /* .cgi_timeout */      0,
<     /* .cache_max_age */        0,
<     /* .auth_mask */        0,
<     /* .cache_reusable */       0,
<     /* .cache_revalidate */     0,
<     /* .cache_intermediaries */ 0,
<     /* .origin_protocol */      LWSMPRO_CALLBACK,    /* files in a dir */
<     /* .mountpoint_len */       6,      /* char count */
<     /* .basic_auth_login_file */    NULL,
< };
<
219c198
<             /* .mount_next */                 &mount2,                    /* linked-list "next" */
---
>             /* .mount_next */                 NULL,                            /* linked-list "next" */
271,292c250,254
<     info.ssl_cert_filepath = "cert.pem";
<     info.ssl_private_key_filepath = "private.pem";
<     info.ssl_private_key_password = "pass";
<     info.ssl_cipher_list = "ECDHE-ECDSA-AES256-GCM-SHA384:"
<                    "ECDHE-RSA-AES256-GCM-SHA384:"
<                    "DHE-RSA-AES256-GCM-SHA384:"
<                    "ECDHE-RSA-AES256-SHA384:"
<                    "HIGH:!aNULL:!eNULL:!EXPORT:"
<                    "!DES:!MD5:!PSK:!RC4:!HMAC_SHA1:"
<                    "!SHA1:!DHE-RSA-AES128-GCM-SHA256:"
<                    "!DHE-RSA-AES128-SHA256:"
<                    "!AES128-GCM-SHA256:"
<                    "!AES128-SHA256:"
<                    "!DHE-RSA-AES256-SHA256:"
<                    "!AES256-GCM-SHA384:"
<                    "!AES256-SHA256";
<
<     context = lws_create_context(&info);
<     if (!context) {
<         lwsl_err("lws init failed\n");
<         return 1;
<     }
---
>             context = lws_create_context(&info);
>             if (!context) {
>                             lwsl_err("lws init failed\n");
>                             return 1;
>             }
294,295c256,257
<     while (n >= 0 && !interrupted)
<         n = lws_service(context, 0);
---
>             while (n >= 0 && !interrupted)
>                             n = lws_service(context, 0);
297c259
<     lws_context_destroy(context);
---
>             lws_context_destroy(context);
299c261
<     return 0;
---
>             return 0;

I'm attaching the code I changed.

Is there anything I need to add if I use HTTP2 in order for this to work?

Thanks a lot!!



This message has been scanned for malware by Websense. www.websense.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://libwebsockets.org/pipermail/libwebsockets/attachments/20210720/8e7b9cae/attachment-0001.htm>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: minimal-post-file-with-ssl-http2-fail.c
URL: <https://libwebsockets.org/pipermail/libwebsockets/attachments/20210720/8e7b9cae/attachment-0001.c>


More information about the Libwebsockets mailing list