cURL / Mailing Lists / curl-library / Single Mail

curl-library

HTTP POST: Determining whether a file could be found

From: Holger Rauch <Holger.Rauch_at_heitec.de>
Date: Sun, 8 Sep 2002 16:57:58 +0200 (CEST)

Hi!

I'm using libcurl version 7.9.8 on Solaris 8 (64bit). The code fragment
shown below (similar to what has been suggested in the libcurl guide) is
used to post an XML file to the server
(curl_easy_init() omitted). However, I'm getting a message from the server
telling me that it didn't receive anything. Thus, my questions are:

1. How can I determine whether the XML file has actually been read on the
client side and output its contents on the screen? (Even though
CURLOPT_VERBOSE it set to TRUE, I can only see the header fields.)

2. Presently, the XML file is transferred "as is" (i.e. without any
special URL encoding taking place, "<" signs are NOT substituted by &gt;,
etc.). Is this wrong? Does the file have to be URL encoded to be "seen" by
the server?

headers = curl_slist_append( headers,
"Content-Type: multipart/form-data" );
    headers = curl_slist_append( headers, "Accept: text/xml" );
    curl_formadd( &post, &last,
                  CURLFORM_COPYNAME, "xml-file-upload",
                  CURLFORM_FILECONTENT, "./testdoc.xml",
                  CURLFORM_CONTENTHEADER, headers,
                  CURLFORM_END );
    curl_easy_setopt( curl,
                      CURLOPT_HTTP_VERSION,
                      CURL_HTTP_VERSION_1_0 );
    curl_easy_setopt( curl, CURLOPT_HEADER, TRUE );
    curl_easy_setopt( curl, CURLOPT_VERBOSE, TRUE );
    curl_easy_setopt( curl, CURLOPT_HTTPPOST, post );
    curl_easy_perform( curl );
    curl_formfree( post );
    curl_slist_free_all( headers );
    curl_easy_cleanup( curl );

Thanks in advance for any advice!

Kind regards,

        Holger

-------------------------------------------------------
This sf.net email is sponsored by: OSDN - Tired of that same old
cell phone? Get a new here for FREE!
https://www.inphonic.com/r.asp?r=sourceforge1&refcode1=vs3390
Received on 2002-09-08