Libcurl behavior with third party library

Running on a Linux platform, my code calls a third party library method to load a file from disk. In a standalone test executable (not unreal) the application loads the file without error, but from within Unreal it get the error

Error retrieving file [file:///absolute/path/to/file.txt]: Protocol "file" not supported or disabled in libcurl

I’ve added PrivateDependencyModuleNames.AddRange(new string[] {"libcurl"}); to the project build.cs file but it didn’t make any difference. I’d expect the file protocol to be one of those always-on default protocols. Not sure what else to try, so any recommendations would be appreciated.

Looks like Unreal compiled their version of libcurl with --disable-file. Unsure as to why, as this should be a pretty standard protocol.

I’ve encountered the same problem, so I’ll ask the question again :slight_smile: Why disable the “file” protocol in libcurl for non windows platforms?

I believe it’s not Linux specific, should be disabled everywhere. One reason for that is that the engine uses libcurl as strictly a http(s) library, so unnecessary functionality is excluded, which also reduces the surface area for exploits. Inside the engine, the library is interfaced via issuing IHttpRequests anyway, for file operations you’d use IPlatformFile which isn’t connected to the library in any way.

Oh ok. I assumed it was only for non Windows platforms when I took a look at the Engine/Source/ThirdParty/libcurl/ script. If I understand correctly line 635 is case for systems having “_NT-” in their name and line 671 is for the other systems. In that case there’s a call to ./configure with, among other things, a --disable-file setting. But then, I don’t fully comprehend if and when that is called in the UnrealEngine build process…