- Home /
417 - Expectation Failed
hi, i am trying to do a POST request to the server using WWW class. i havent got any success because my server is lighttpd and it chocked a "417 - Expectation Failed" message. I googled it and i found that i need to disable expect:100continue on the headers of the POST request.
on MSDN site there is a line that turn it by using
System.Net.ServicePointManager.Expect100Continue = false;
and i couldnt find anything using unitys WWW class. i found documentation on unity for putting extra headers on POST. but it didnt work. and the sample for csharp was actually wrong syntax.
so I improvisised and putting like form.header["Expect"]=""; but it still sending the expect 100continue. even i tried the sample on the unitys site, and the headers didnt change at all. maybe it s a bug.
btw i m using 2.6 unity. planning to deploy it on Web Player.
so i solved it by using this..
WebClient client = new WebClient();
NameValueCollection postData = new NameValueCollection();
System.Net.ServicePointManager.Expect100Continue = false; ///the line that msdn recommends
postData.Add("levelName", "defaultLevel");
postData.Add("jsonData", jsonMess);
byte[] response = client.UploadValues(CConfig.urlExport, postData);
_log.write(new System.Text.ASCIIEncoding().GetString(response));
and it worked.
BUT i havent tried it on web player deploy. i only tried it on the editor. because i only need it once after editing a level.
The Question is : how do i do it with WWW class to solve Expect100Continue problem?
You say you solved it and it worked. Is there a question in all this?
ups. havent put any question. i have edited it. my question is at the bottom of the post
Your answer
Follow this Question
Related Questions
Date request header is missing from http request(UnityWebrequest) 1 Answer
How do I add a header and a file at the web request at the same time? 0 Answers
HTTP Response Headers? 3 Answers
WWW Form upload with header not working 2 Answers
https -- works in IDE & Standalone, does not work in web browser 1 Answer