MCPcopy Create free account
hub / github.com/OSGeo/gdal / HTTPFetchContentDispositionFilename

Function HTTPFetchContentDispositionFilename

frmts/http/httpdriver.cpp:40–69  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

38/************************************************************************/
39
40static std::string HTTPFetchContentDispositionFilename(char **papszHeaders)
41{
42 char **papszIter = papszHeaders;
43 while (papszIter && *papszIter)
44 {
45 /* For multipart, we have in raw format, but without end-of-line
46 * characters */
47 if (STARTS_WITH(*papszIter,
48 "Content-Disposition: attachment; filename="))
49 {
50 return SanitizeDispositionFilename(*papszIter + 42);
51 }
52 /* For single part, the headers are in KEY=VAL format, but with e-o-l
53 * ... */
54 else if (STARTS_WITH(*papszIter,
55 "Content-Disposition=attachment; filename="))
56 {
57 char *pszVal = (*papszIter + 41);
58 char *pszEOL = strchr(pszVal, '\r');
59 if (pszEOL)
60 *pszEOL = 0;
61 pszEOL = strchr(pszVal, '\n');
62 if (pszEOL)
63 *pszEOL = 0;
64 return SanitizeDispositionFilename(pszVal);
65 }
66 papszIter++;
67 }
68 return std::string();
69}
70
71/************************************************************************/
72/* HTTPOpen() */

Callers 1

HTTPOpenFunction · 0.85

Calls 1

Tested by

no test coverage detected