Changeset 100620 in vbox
- Timestamp:
- Jul 18, 2023 9:20:07 AM (20 months ago)
- svn:sync-xref-src-repo-rev:
- 158451
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/GuestHost/SharedClipboard/clipboard-transfers-http.cpp
r100367 r100620 53 53 #include <iprt/string.h> 54 54 #include <iprt/thread.h> 55 #include <iprt/uri.h> 55 56 #include <iprt/uuid.h> 56 57 #include <iprt/vfs.h> … … 881 882 /* Create the virtual HTTP path for the transfer. 882 883 * Every transfer has a dedicated HTTP path (but live in the same URL namespace). */ 884 char *pszPath; 883 885 #ifdef VBOX_SHCL_DEBUG_HTTPSERVER 884 886 # ifdef DEBUG_andy /** Too lazy to specify a different transfer ID for debugging. */ 885 ssize_t cch = RTStr Printf2(pSrvTx->szPathVirtual, sizeof(pSrvTx->szPathVirtual), "/transfer");887 ssize_t cch = RTStrAPrintf(&pszPath, "//transfer"); 886 888 # else 887 ssize_t cch = RTStrPrintf2(pSrvTx->szPathVirtual, sizeof(pSrvTx->szPathVirtual), "/transfer%RU16", 888 pTransfer->State.uID); 889 ssize_t cch = RTStrPrintf2(&pszPath, "//transfer%RU16", pTransfer->State.uID); 889 890 # endif 890 #else 891 ssize_t cch = RTStrPrintf2(pSrvTx->szPathVirtual, sizeof(pSrvTx->szPathVirtual), "/%s/%s/%s", 892 SHCL_HTTPT_URL_NAMESPACE, szUuid, pEntry->pszName); 891 #else /* Release mode */ 892 ssize_t cch = RTStrPrintf2(&pszPath, "//%s/%s/%s", SHCL_HTTPT_URL_NAMESPACE, szUuid, pEntry->pszName); 893 893 #endif 894 AssertReturn(cch, VERR_BUFFER_OVERFLOW); 894 AssertReturn(cch, VERR_NO_MEMORY); 895 896 const char szScheme[] = "http"; /** @todo For now we only support HTTP. */ 897 const size_t cchScheme = strlen(szScheme) + 3 /* "://" */; 898 899 char *pszURI = RTUriCreate(szScheme, NULL /* pszAuthority */, pszPath, NULL /* pszQuery */, NULL /* pszFragment */); 900 if (pszURI) 901 { 902 if (strlen(pszURI) >= cchScheme) 903 { 904 /* For the virtual path we only keep everything after the full scheme (e.g. "http://"). 905 * The virtual path always has to start with a "/". */ 906 if (RTStrPrintf2(pSrvTx->szPathVirtual, sizeof(pSrvTx->szPathVirtual), "/%s", pszURI + cchScheme) <= 0) 907 rc = VERR_BUFFER_OVERFLOW; 908 } 909 else 910 rc = VERR_INVALID_PARAMETER; 911 912 RTStrFree(pszURI); 913 pszURI = NULL; 914 } 915 else 916 rc = VERR_NO_MEMORY; 917 918 RTStrFree(pszPath); 919 pszPath = NULL; 920 921 AssertRCReturn(rc, rc); 895 922 896 923 pSrvTx->pTransfer = pTransfer;
Note:
See TracChangeset
for help on using the changeset viewer.