cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: bad post strings?

From: John Baxter <jbaxter_at_mmcable.com>
Date: Fri, 08 Jun 2001 20:23:53 -0500

Per Ryan's suggestion I verified that the form is indeed a
multipart/form data post.

Per Daniel's suggestions I changed my code, but I continued to get the
same results. So, I began to sluth in curl code looking for clues and
learned about the boundry. I placed printf's in the lib at the write to
socket call.
curl is indeed sending only what should be sent. So it appears that the
server is either:
  1) not getting the "/r/n--" part of the boundry
  2) the server is somehow messing with the post string
  3) the write to socket function is screwing up (i will investigate
this tonight).

since there does not seem to be anyone else having this problem I lean
towards the server messing up.

this is very weird.

John Baxter

Ryan Earl wrote:
>
> At 04:40 PM 6/4/2001 -0500, you wrote:
> >please disreguard the part of my reply concerning the warnings during
> >the make, I have resolved those.I was not coping the libs to my system
> >lib directory. I do not receive the warnings but the problem still
> >exists.
> >The rate of bad post strings is approximately 50% and random in nature.
>
> Sounds like you just need a Content-Type of application/x-www-form-urlencoded instead of multipart/form-data like Curl uses. You can just URL encode your post data, set the Content-Type HTTP header to what you want, and raw send the encoded information. Some CGI things don't understand the newer multipart/form-data Content-Type.
>
> "curlcnc9d89refkrehfy" is the separator for form information. For instance, when I use curl to do a post, I get the header:
>
> Content-Type: multipart/form-data; boundary=curlns9dzEEZRwrna6gRCWXK80PklWY
>
> I'm not sure if there is a simpler way to make Curl do a URL encoded POST, but it's fairly easy to do by hand.
>
> >jb
> >
> >Daniel Stenberg wrote:
> >>
> >> On Sun, 3 Jun 2001, John Baxter wrote:
> >>
> >> > while using libcurl 7.7.3-1 on linux 2.4.2-2 (rh7.1) i loop performing
> >> > multiple rfc-1867 posts to return the results of a query. i create and
> >> > destroy a list with formparse(). some of the posts result in an error
> >> > from the server saying my post is invalid. the server responds with my
> >> > post value with junk appended to my intented post value. the bad values
> >> > have my post string followed by "curl" which is followed by junk. ex:
> >> > "99-10013curlcnc9d89refkrehfy" where "99-10013" is the value I intended
> >> > to post. I perform a printf(post->contents) prior to curl_easy_perform()
> >> > and is is always correct at that point. any ideas?
> >>
> >> (I also just replied to the bug report in this subject.)
> >>
> >> Is the 'post' and 'last' pointers really set to NULL before you use
> >> curl_formparse() the first time? If they're not, this might very well be an
> >> explanation to why junk ends up in the list.
> >>
> >> If that is not the problem, I suggest that you compile lib/formdata.c with
> >> _FORM_DEBUG defined and have a go at fixing a test that passes the exact same
> >> set of form data as you do in your program. Then you can run that test
> >> program and see what kind of output you get. If it looks ok, the problem is
> >> in your code, if it still looks weirdo, then libcurl is to blame and I'd
> >> appriciate you telling me exactly how to repeat it!
> >>
> >> --
> >> Daniel Stenberg -- curl dude -- http://curl.haxx.se/
> >>
> >> _______________________________________________
> >> Curl-library mailing list
> >> Curl-library_at_lists.sourceforge.net
> >> http://lists.sourceforge.net/lists/listinfo/curl-library
> >
> >_______________________________________________
> >Curl-library mailing list
> >Curl-library_at_lists.sourceforge.net
> >http://lists.sourceforge.net/lists/listinfo/curl-library
>
> _______________________________________________
> Curl-library mailing list
> Curl-library_at_lists.sourceforge.net
> http://lists.sourceforge.net/lists/listinfo/curl-library

_______________________________________________
Curl-library mailing list
Curl-library_at_lists.sourceforge.net
http://lists.sourceforge.net/lists/listinfo/curl-library
Received on 2001-06-09