| 228 | } |
| 229 | |
| 230 | std::string HTTPDownloader::GetExtensionForContentType(const std::string& content_type) |
| 231 | { |
| 232 | // Based on https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Common_types |
| 233 | static constexpr const char* table[][2] = { |
| 234 | {"audio/aac", "aac"}, |
| 235 | {"application/x-abiword", "abw"}, |
| 236 | {"application/x-freearc", "arc"}, |
| 237 | {"image/avif", "avif"}, |
| 238 | {"video/x-msvideo", "avi"}, |
| 239 | {"application/vnd.amazon.ebook", "azw"}, |
| 240 | {"application/octet-stream", "bin"}, |
| 241 | {"image/bmp", "bmp"}, |
| 242 | {"application/x-bzip", "bz"}, |
| 243 | {"application/x-bzip2", "bz2"}, |
| 244 | {"application/x-cdf", "cda"}, |
| 245 | {"application/x-csh", "csh"}, |
| 246 | {"text/css", "css"}, |
| 247 | {"text/csv", "csv"}, |
| 248 | {"application/msword", "doc"}, |
| 249 | {"application/vnd.openxmlformats-officedocument.wordprocessingml.document", "docx"}, |
| 250 | {"application/vnd.ms-fontobject", "eot"}, |
| 251 | {"application/epub+zip", "epub"}, |
| 252 | {"application/gzip", "gz"}, |
| 253 | {"image/gif", "gif"}, |
| 254 | {"text/html", "htm"}, |
| 255 | {"image/vnd.microsoft.icon", "ico"}, |
| 256 | {"text/calendar", "ics"}, |
| 257 | {"application/java-archive", "jar"}, |
| 258 | {"image/jpeg", "jpg"}, |
| 259 | {"text/javascript", "js"}, |
| 260 | {"application/json", "json"}, |
| 261 | {"application/ld+json", "jsonld"}, |
| 262 | {"audio/midi audio/x-midi", "mid"}, |
| 263 | {"text/javascript", "mjs"}, |
| 264 | {"audio/mpeg", "mp3"}, |
| 265 | {"video/mp4", "mp4"}, |
| 266 | {"video/mpeg", "mpeg"}, |
| 267 | {"application/vnd.apple.installer+xml", "mpkg"}, |
| 268 | {"application/vnd.oasis.opendocument.presentation", "odp"}, |
| 269 | {"application/vnd.oasis.opendocument.spreadsheet", "ods"}, |
| 270 | {"application/vnd.oasis.opendocument.text", "odt"}, |
| 271 | {"audio/ogg", "oga"}, |
| 272 | {"video/ogg", "ogv"}, |
| 273 | {"application/ogg", "ogx"}, |
| 274 | {"audio/opus", "opus"}, |
| 275 | {"font/otf", "otf"}, |
| 276 | {"image/png", "png"}, |
| 277 | {"application/pdf", "pdf"}, |
| 278 | {"application/x-httpd-php", "php"}, |
| 279 | {"application/vnd.ms-powerpoint", "ppt"}, |
| 280 | {"application/vnd.openxmlformats-officedocument.presentationml.presentation", "pptx"}, |
| 281 | {"application/vnd.rar", "rar"}, |
| 282 | {"application/rtf", "rtf"}, |
| 283 | {"application/x-sh", "sh"}, |
| 284 | {"image/svg+xml", "svg"}, |
| 285 | {"application/x-tar", "tar"}, |
| 286 | {"image/tiff", "tif"}, |
| 287 | {"video/mp2t", "ts"}, |
nothing calls this directly
no test coverage detected