Mercurial > hg > orthanc
comparison Core/Toolbox.cpp @ 2905:ae20fccdd867
refactoring mime types
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Tue, 30 Oct 2018 11:55:23 +0100 |
parents | 668d5ad73c74 |
children | 2a504fef4ed7 |
comparison
equal
deleted
inserted
replaced
2904:0dd54ee073db | 2905:ae20fccdd867 |
---|---|
326 const char* extension = &path[lastDot + 1]; | 326 const char* extension = &path[lastDot + 1]; |
327 | 327 |
328 // http://en.wikipedia.org/wiki/Mime_types | 328 // http://en.wikipedia.org/wiki/Mime_types |
329 // Text types | 329 // Text types |
330 if (!strcmp(extension, "txt")) | 330 if (!strcmp(extension, "txt")) |
331 contentType = "text/plain"; | 331 contentType = MIME_PLAIN_TEXT; |
332 else if (!strcmp(extension, "html")) | 332 else if (!strcmp(extension, "html")) |
333 contentType = "text/html"; | 333 contentType = "text/html"; |
334 else if (!strcmp(extension, "xml")) | 334 else if (!strcmp(extension, "xml")) |
335 contentType = "text/xml"; | 335 contentType = MIME_XML; |
336 else if (!strcmp(extension, "css")) | 336 else if (!strcmp(extension, "css")) |
337 contentType = "text/css"; | 337 contentType = "text/css"; |
338 | 338 |
339 // Application types | 339 // Application types |
340 else if (!strcmp(extension, "js")) | 340 else if (!strcmp(extension, "js")) |
341 contentType = "application/javascript"; | 341 contentType = "application/javascript"; |
342 else if (!strcmp(extension, "json")) | 342 else if (!strcmp(extension, "json")) |
343 contentType = "application/json"; | 343 contentType = MIME_JSON; |
344 else if (!strcmp(extension, "pdf")) | 344 else if (!strcmp(extension, "pdf")) |
345 contentType = "application/pdf"; | 345 contentType = MIME_PDF; |
346 else if (!strcmp(extension, "wasm")) | 346 else if (!strcmp(extension, "wasm")) |
347 contentType = "application/wasm"; | 347 contentType = "application/wasm"; |
348 | 348 |
349 // Images types | 349 // Images types |
350 else if (!strcmp(extension, "jpg") || !strcmp(extension, "jpeg")) | 350 else if (!strcmp(extension, "jpg") || !strcmp(extension, "jpeg")) |
351 contentType = "image/jpeg"; | 351 contentType = MIME_JPEG; |
352 else if (!strcmp(extension, "gif")) | 352 else if (!strcmp(extension, "gif")) |
353 contentType = "image/gif"; | 353 contentType = "image/gif"; |
354 else if (!strcmp(extension, "png")) | 354 else if (!strcmp(extension, "png")) |
355 contentType = "image/png"; | 355 contentType = MIME_PNG; |
356 else if (!strcmp(extension, "pam")) | |
357 contentType = MIME_PAM; | |
356 } | 358 } |
357 | 359 |
358 return contentType; | 360 return contentType; |
359 } | 361 } |
360 | 362 |