cURL cURL > Mailing List > Monthly Index > Single Mail

curl-tracker Archives

[curl:bugs] #1415 Missing Content-type in form file upload

From: Daniel Stenberg <bagder_at_users.sf.net>
Date: Mon, 01 Sep 2014 07:20:05 +0000

- **status**: pending-needsinfo --> closed-invalid
- **Comment**:

No response, closing without action.

---
** [bugs:#1415] Missing Content-type in form file upload**
**Status:** closed-invalid
**Created:** Mon Aug 25, 2014 07:42 PM UTC by Martín Perazzo
**Last Updated:** Mon Aug 25, 2014 08:26 PM UTC
**Owner:** Daniel Stenberg
Bug is present at least from 7.32.0 to present, cannot reproduce on 7.26.0

On version 7.32.0-7.37.1 Content-Type header is missing. Trying to force the header with curl_slist_append does not work.
On version 7.26.0  is properly set to multipart/form-data; boundary=----------------------------0cea4077810c\r\n

Sample code:

~~~~~~
                curl_easy_setopt(curl, CURLOPT_POST, 1L);
		basename=strrchr(file_to_upload,'/');
		if(basename)
			basename++;
		else
			basename=file_to_upload;
#if DEBUG
		printf("File to upload: %s\n",basename);
#endif
		curl_formadd(&formpost,
                        &lastptr,
                        CURLFORM_COPYNAME, "fileToUpload",
                        CURLFORM_STREAM, data,
                        CURLFORM_CONTENTSLENGTH, (curl_off_t)st.st_size,
                        CURLFORM_FILENAME, basename,
                        CURLFORM_CONTENTTYPE, "application/octet-stream", 
                        CURLFORM_END);
                        
                
		
		//chunk = curl_slist_append(chunk, "Content-Type: multipart/form-data");		
		
		//chunk = curl_slist_append(chunk, "Content-Type: application/octet-stream");
		chunk = curl_slist_append(chunk, "UForgeScan-Rev: 1.0");
		chunk = curl_slist_append(chunk, "Expect:");
	
		
		if(fpoutput){
			chunk = curl_slist_append(chunk, accept);
			curl_easy_setopt(curl, CURLOPT_WRITEDATA ,(void*) fpoutput);
		}else
			curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, curl_devnull); 
		curl_easy_setopt(curl, CURLOPT_HTTPHEADER,chunk);
		curl_easy_setopt(curl, CURLOPT_HTTPPOST, formpost);
~~~~~~
---
Sent from sourceforge.net because curl-tracker@cool.haxx.se is subscribed to https://sourceforge.net/p/curl/bugs/
To unsubscribe from further messages, a project admin can change settings at https://sourceforge.net/p/curl/admin/bugs/options.  Or, if this is a mailing list, you can unsubscribe from the mailing list.
Received on 2014-09-01

These mail archives are generated by hypermail.