Ivan Evtuhovich
2008-Dec-03 14:40 UTC
Problem with read_multipart when use from iPhone CFNetwork library
Hello. iPhone use NSURLRequest, NSURLConnection to POST data to rails site. Request is the next: POST / HTTP/1.1 User-Agent: CFNetwork/330 Content-Type: multipart/form-data; boundary=------580a9a040b19fc6621c596d9c40097f7 Accept: */* Accept-Language: ru Accept-Encoding: gzip, deflate Content-Length: 295 Connection: keep-alive Host: 192.168.0.20:8888 --------580a9a040b19fc6621c596d9c40097f7 Content-Disposition: form-data; name="authenticity_token" 86a4347fae09e23cf592eed6eb324cd61f3b9e5f --------580a9a040b19fc6621c596d9c40097f7 Content-Disposition: form-data; name="picures[pic]" 111 --------580a9a040b19fc6621c596d9c40097f7-- There too mane \r\n after Host:192.168.0.20:8888, therefore rails return "Bad content body". Could somebody fix this? --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com To unsubscribe from this group, send email to rubyonrails-core+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en -~----------~----~----~----~------~----~------~--~---
Mislav Marohnić
2008-Dec-03 14:47 UTC
Re: Problem with read_multipart when use from iPhone CFNetwork library
On Wed, Dec 3, 2008 at 15:40, Ivan Evtuhovich <evtuhovich@gmail.com> wrote:> > There too mane \r\n after Host:192.168.0.20:8888, therefore rails > return "Bad content body".And it should. The separator of headers and body is "\r\n\r\n". Anything else is wrong. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com To unsubscribe from this group, send email to rubyonrails-core+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en -~----------~----~----~----~------~----~------~--~---
Ivan Evtuhovich
2008-Dec-03 14:59 UTC
Re: Problem with read_multipart when use from iPhone CFNetwork library
I understand, but it is imposible to fix Apple library. Could you tell me, how to fix this inside the application, i do not want to ''monkey patching'' rails code. On Dec 3, 5:47 pm, "Mislav Marohnić" <mislav.maroh...@gmail.com> wrote:> On Wed, Dec 3, 2008 at 15:40, Ivan Evtuhovich <evtuhov...@gmail.com> wrote: > > > There too mane \r\n after Host:192.168.0.20:8888, therefore rails > > return "Bad content body". > > And it should. The separator of headers and body is "\r\n\r\n". Anything > else is wrong.--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com To unsubscribe from this group, send email to rubyonrails-core+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en -~----------~----~----~----~------~----~------~--~---
Mislav Marohnić
2008-Dec-03 15:13 UTC
Re: Problem with read_multipart when use from iPhone CFNetwork library
2008/12/3 Ivan Evtuhovich <evtuhovich@gmail.com>> > I understand, but it is imposible to fix Apple library.Well, you can contribute a failing test and a patch to Rails yourself. This wouldn''t be the first time Rails fixed a badly implemented HTTP spec by Apple. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com To unsubscribe from this group, send email to rubyonrails-core+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en -~----------~----~----~----~------~----~------~--~---
Ivan Evtuhovich
2008-Dec-03 15:15 UTC
Re: Problem with read_multipart when use from iPhone CFNetwork library
Sorry, this was problem in our programmers in other department, we solve this problem. Thanx you for help. On Dec 3, 6:13 pm, "Mislav Marohnić" <mislav.maroh...@gmail.com> wrote:> 2008/12/3 Ivan Evtuhovich <evtuhov...@gmail.com> > > > > > I understand, but it is imposible to fix Apple library. > > Well, you can contribute a failing test and a patch to Rails yourself. This > wouldn''t be the first time Rails fixed a badly implemented HTTP spec by > Apple.--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com To unsubscribe from this group, send email to rubyonrails-core+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en -~----------~----~----~----~------~----~------~--~---
Kelly Sutton
2009-Jan-31 22:49 UTC
Re: Problem with read_multipart when use from iPhone CFNetwork library
Can you please explain what the problem was and your solution? I''m having the same one. On Dec 3 2008, 7:15 am, Ivan Evtuhovich <evtuhov...@gmail.com> wrote:> Sorry, this was problem in our programmers in other department, we > solve this problem. > > Thanx you for help. > > On Dec 3, 6:13 pm, "Mislav Marohnić" <mislav.maroh...@gmail.com> > wrote: > > > 2008/12/3 Ivan Evtuhovich <evtuhov...@gmail.com> > > > > I understand, but it is imposible to fix Apple library. > > > Well, you can contribute a failing test and a patch to Rails yourself. This > > wouldn''t be the first time Rails fixed a badly implemented HTTP spec by > > Apple.--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com To unsubscribe from this group, send email to rubyonrails-core+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en -~----------~----~----~----~------~----~------~--~---
David H Dennis
2009-Feb-13 00:02 UTC
Re: Problem with read_multipart when use from iPhone CFNetwork library
I ran into the same problem because I probably found the same example you did, which was built for use with Perl, not Rails. Perl is apparently more tolerent of simple formatting errors, which is not surprising considering Larry Wall''s philosophy.The example contains a line similar to this: [ body appendData:[[NSString stringWithFormat:@"\r\n--%@\r \n",boundary] dataUsingEncoding:NSUTF8StringEncoding]]; It turns out that is wrong. The initial \r\n should not be there, so you should have: [ body appendData:[[NSString stringWithFormat:@"--%@\r\n",boundary] dataUsingEncoding:NSUTF8StringEncoding]]; Once I made that change, everything worked perfectly. Hope that helps someone. D On Jan 31, 5:49 pm, Kelly Sutton <michael.k.sut...@gmail.com> wrote:> Can you please explain what the problem was and your solution? > > I''m having the same one. > > On Dec 3 2008, 7:15 am, Ivan Evtuhovich <evtuhov...@gmail.com> wrote: > > > Sorry, this was problem in our programmers in other department, we > > solve this problem. > > > Thanx you for help. > > > On Dec 3, 6:13 pm, "Mislav Marohnić" <mislav.maroh...@gmail.com> > > wrote: > > > > 2008/12/3 Ivan Evtuhovich <evtuhov...@gmail.com> > > > > > I understand, but it is imposible to fix Apple library. > > > > Well, you can contribute a failing test and a patch to Rails yourself. This > > > wouldn''t be the first time Rails fixed a badly implemented HTTP spec by > > > Apple.--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com To unsubscribe from this group, send email to rubyonrails-core+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en -~----------~----~----~----~------~----~------~--~---