[vlc-commits] [Git][videolan/vlc][master] 2 commits: http: chunked: fix chunked transfer encoding end of stream

Steve Lhomme (@robUx4) gitlab at videolan.org
Wed May 28 14:39:03 UTC 2025



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
b31ef758 by Pierre Lamot at 2025-05-28T14:18:46+00:00
http: chunked: fix chunked transfer encoding end of stream

Chunked Transfer Coding is defined [1] as

```
chunked-body   = *chunk
                      last-chunk
                      trailer-part
                      CRLF
[...]
last-chunk     = 1*("0") [ chunk-ext ] CRLF
```

this means the body should end with the last-chunk (0CRLF) followed by CRLF

[1] https://datatracker.ietf.org/doc/html/rfc7230#section-4.1

- - - - -
2a8ab2b2 by Pierre Lamot at 2025-05-28T14:18:46+00:00
http: add URL option when building HTTP PUT requests

- - - - -


2 changed files:

- modules/access/http/chunked.c
- modules/access/http/outfile.c


Changes:

=====================================
modules/access/http/chunked.c
=====================================
@@ -55,7 +55,7 @@ ssize_t vlc_https_chunked_write(struct vlc_tls *tls, const void *base,
 
     if (eos)
     {
-        if (vlc_tls_Write(tls, "0\r\n", 3) < 3)
+        if (vlc_tls_Write(tls, "0\r\n\r\n", 5) < 5)
             return -1;
     }
 


=====================================
modules/access/http/outfile.c
=====================================
@@ -39,6 +39,7 @@ struct vlc_http_outfile *vlc_http_outfile_create(struct vlc_http_mgr *mgr,
     struct vlc_http_msg *resp = NULL;
     vlc_url_t url;
     bool secure;
+    char* url_path_with_options = NULL;
 
     if (vlc_UrlParse(&url, uri))
         goto error;
@@ -62,9 +63,19 @@ struct vlc_http_outfile *vlc_http_outfile_create(struct vlc_http_mgr *mgr,
     if (unlikely(authority == NULL))
         goto error;
 
+    if (url.psz_option)
+    {
+        if (asprintf(&url_path_with_options, "%s?%s", url.psz_path, url.psz_option) < 0)
+        {
+            free(authority);
+            goto error;
+        }
+    }
+
     struct vlc_http_msg *req = vlc_http_req_create("PUT", url.psz_protocol,
-                                                   authority, url.psz_path);
+                                                   authority, url_path_with_options ? url_path_with_options : url.psz_path);
     free(authority);
+    free(url_path_with_options);
     if (unlikely(req == NULL))
         goto error;
 



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/9fead5e53540a48217c9ee5105de2ea2d1568bd7...2a8ab2b23d5c979ba94d3b912eea8f674d880efd

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/9fead5e53540a48217c9ee5105de2ea2d1568bd7...2a8ab2b23d5c979ba94d3b912eea8f674d880efd
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance


More information about the vlc-commits mailing list