* Returns some valid contenttype for filename.
*
***************************************************************************/
-static const char * ContentTypeForFilename (const char *filename,
- const char *prevtype)
+static const char *ContentTypeForFilename(const char *filename,
+ const char *prevtype)
{
const char *contenttype = NULL;
unsigned int i;
* extensions and pick the first we match!
*/
struct ContentType {
- char extension[6];
+ const char *extension;
const char *type;
};
static const struct ContentType ctts[]={
if(((form->flags & HTTPPOST_FILENAME) ||
(form->flags & HTTPPOST_BUFFER)) &&
!form->contenttype ) {
+ char *f = form->flags & HTTPPOST_BUFFER?
+ form->showfilename : form->value;
+
/* our contenttype is missing */
- form->contenttype
- = strdup(ContentTypeForFilename(form->value, prevtype));
+ form->contenttype = strdup(ContentTypeForFilename(f, prevtype));
if(!form->contenttype) {
return_value = CURL_FORMADD_MEMORY;
break;
POST /554 HTTP/1.1\r
Host: %HOSTIP:%HTTPPORT\r
Accept: */*\r
-Content-Length: 732\r
+Content-Length: 718\r
Expect: 100-continue\r
Content-Type: multipart/form-data; boundary=----------------------------\r
\r
send\r
------------------------------\r
Content-Disposition: form-data; name="somename"; filename="somefile.txt"\r
-Content-Type: application/octet-stream\r
+Content-Type: text/plain\r
\r
blah blah\r
--------------------------------\r