Thanks,
Layton
var boundary = "----MISFormBoundaryMTCcH1pthhYPYEpV";
var httpBody = [[CPString alloc] init];
httpBody = [httpBody stringByAppendingFormat:"--%@\r\n", boundary];
httpBody = [httpBody stringByAppendingFormat:"Content-Disposition: form-data; name=\"fields\"\r\n\r\n%@\r\n", fields];
httpBody = [httpBody stringByAppendingFormat:"--%@\r\n", boundary];
httpBody = [httpBody stringByAppendingFormat:"Content-Disposition: form-data; name=\"calculations\"\r\n\r\n%@\r\n", calcs];
httpBody = [httpBody stringByAppendingFormat:"--%@\r\n", boundary];
httpBody = [httpBody stringByAppendingFormat:"Content-Disposition: form-data; name=\"table\"\r\n\r\n%@\r\n", table];
httpBody = [httpBody stringByAppendingFormat:"--%@\r\n", boundary];
httpBody = [httpBody stringByAppendingFormat:"Content-Disposition: form-data; name=\"query\"\r\n\r\n%@\r\n", query];
httpBody = [httpBody stringByAppendingFormat:"--%@--\r\n", boundary];
var request = [CPURLRequest requestWithURL: "http://domain/get_records_and_calculations.php"];
[request setHTTPMethod:"POST"];
[request setValue:"multipart/form-data; boundary=----MISFormBoundaryMTCcH1pthhYPYEpV" forHTTPHeaderField:"Content-Type"];
[request setHTTPBody:httpBody];
_setValueConnection = [CPURLConnection connectionWithRequest:request delegate:delegate];
Must be something in the way i'm using it.
Layton
> --
> You received this message because you are subscribed to the Google Groups "Cappuccino & Objective-J" group.
> To post to this group, send email to objec...@googlegroups.com.
> To unsubscribe from this group, send email to objectivej+...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/objectivej?hl=en.
>
I've done some sniffing and comparing Safari 5 with 4.0.2, it seems Safari 5 is injecting "; charset=UTF-8" to the end of Content-Type header.
I've tracked it down to the "; charset=UTF-8" appended to the Content-Type which is causing the problem. Intercepting the request using a proxy and removing the "; charset=UFT-8" from the Content-Type header before it's sent to the server results in a successful response from the server.
So the question is, is this a Safari bug? Or *should* injecting the charset parameter still work, in which case it's an Apache bug?
Layton
If you add the charset in Safari 4 yourself, does it also fail?
Does it work with another server?
Affirmative
> Does it work with another server?
Bit of a mission to test that to be honest. But ironically, this is Safari 5 talking to latest OS X Server (almost) default Apache2 install. Maybe it's apache not expecting UTF-8? Although interestingly Charles proxy can't parse the form parts when the charset is set by Safari.
It's looking like this injection when the Content-Type is multipart/form-data is a bug, and should not be happening?