* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2015, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
- * are also available at http://curl.haxx.se/docs/copyright.html.
+ * are also available at https://curl.haxx.se/docs/copyright.html.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
#include "curlx.h"
#include "tool_cfgable.h"
+#include "tool_doswin.h"
#include "tool_msgs.h"
#include "tool_cb_hdr.h"
#ifdef DEBUGBUILD
if(size * nmemb > (size_t)CURL_MAX_HTTP_HEADER) {
- warnf(heads->config, "Header data exceeds single call write limit!\n");
+ warnf(heads->config->global, "Header data exceeds single call write "
+ "limit!\n");
return failure;
}
#endif
size_t rc = fwrite(ptr, size, nmemb, heads->stream);
if(rc != cb)
return rc;
+ /* flush the stream to send off what we got earlier */
+ (void)fflush(heads->stream);
}
/*
}
/* scan for the end letter and stop there */
- q = p;
- while(*q) {
- if(q[1] && (q[0] == '\\'))
- q++;
- else if(q[0] == stop)
+ for(q = p; *q; ++q) {
+ if(*q == stop) {
+ *q = '\0';
break;
- q++;
+ }
}
- *q = '\0';
/* make sure the file name doesn't end in \r or \n */
q = strchr(p, '\r');
if(copy != p)
memmove(copy, p, strlen(p) + 1);
+#if defined(MSDOS) || defined(WIN32)
+ {
+ char *sanitized;
+ SANITIZEcode sc = sanitize_file_name(&sanitized, copy, 0);
+ Curl_safefree(copy);
+ if(sc)
+ return NULL;
+ copy = sanitized;
+ }
+#endif /* MSDOS || WIN32 */
+
/* in case we built debug enabled, we allow an evironment variable
* named CURL_TESTDIR to prefix the given file name to put it into a
* specific directory