cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: curl-library Digest, Vol 94, Issue 18

From: Ana Torres <cali_bettyboop_at_yahoo.com>
Date: Sat, 15 Jun 2013 23:45:18 -0700 (PDT)

STOP

--- On Thu, 6/13/13, curl-library-request_at_cool.haxx.se wrote:

&gt; From: curl-library-request_at_cool.haxx.se
&gt; Subject: curl-library Digest, Vol 94, Issue 18
&gt; To: curl-library_at_cool.haxx.se
&gt; Date: Thursday, June 13, 2013, 9:35 AM
&gt; Send curl-library mailing list
&gt; submissions to
&gt;     curl-library_at_cool.haxx.se
&gt;
&gt; To subscribe or unsubscribe via the World Wide Web, visit
&gt;     http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-library
&gt; or, via email, send a message with subject or body &#39;help&#39;
&gt; to
&gt;     curl-library-request_at_cool.haxx.se
&gt;
&gt; You can reach the person managing the list at
&gt;     curl-library-owner_at_cool.haxx.se
&gt;
&gt; When replying, please edit your Subject line so it is more
&gt; specific
&gt; than &quot;Re: Contents of curl-library digest...&quot;
&gt;
&gt;
&gt; Today&#39;s Topics:
&gt;
&gt;    1. CURLOPT_WRITEFUNCTION; Function not
&gt; writing all data to disc
&gt;       file? (Spencer Elliott)
&gt;    2. RE: cURL using axTLS non-blocking (Hu,
&gt; Eric)
&gt;
&gt;
&gt; ----------------------------------------------------------------------
&gt;
&gt; Message: 1
&gt; Date: Thu, 13 Jun 2013 16:05:47 +0100
&gt; From: Spencer Elliott
&gt; To:
&gt; Subject: CURLOPT_WRITEFUNCTION; Function not writing all
&gt; data to disc
&gt;     file?
&gt; Message-ID:
&gt; Content-Type: text/plain; charset=&quot;iso-8859-1&quot;
&gt;
&gt; Dear all,
&gt;
&gt;
&gt;
&gt;
&gt;
&gt; I am very new to LibCurl, and am struggling with the
&gt; CURLOPT_WRITEFUNCTION
&gt; function.
&gt;
&gt; I have included my source code below, but essentially my
&gt; issue is here:
&gt;
&gt;
&gt;
&gt; /*
&gt;
&gt;                
&gt;                
&gt; printf(&quot;&#92;n&quot;);
&gt;
&gt;                
&gt;                
&gt; printf(response.c_str());
&gt;
&gt;                
&gt;                
&gt; printf(&quot;&#92;n&quot;);
&gt;
&gt;                
&gt;                
&gt; LogToDisk(response);
&gt;
&gt; */
&gt;
&gt;
&gt;
&gt; The function that stores the data to a string seems to print
&gt; the entire
&gt; string out perfectly fine on the console using ?printf?.
&gt; However, when it
&gt; saves to disc file, there is a large amount of text missing.
&gt; Can anyone help
&gt; me understand what I am doing wrong?
&gt;
&gt;
&gt;
&gt; I noticed that there is an extremely long string in the html
&gt; of the page I
&gt; am going to, and this is also where is just stops working?
&gt;
&gt;
&gt;
&gt; Here is an example of the last line where the file stops
&gt; writing and gives
&gt; up (I put the last part in bold), it should continue waaaay
&gt; past this?:
&gt;
&gt;
&gt;
&gt; &gt;
&gt; (None)&nbsp;Become&nbsp;a&nbsp;member&nbsp;of&nbsp;our&nbsp;community&nbsp;t
&gt; o&nbsp;get&nbsp;inside&nbsp;information&nbsp;and&nbsp;prizes!<br>&gt;
&gt; (None)&nbsp;We&nbsp;have&nbsp;5&nbsp;other&nbsp;servers&nbsp;up&nbsp;and&nbs
&gt; p;running!<br>&gt;
&gt; (None)&nbsp;Check&nbsp;out&nbsp;the&nbsp;Doom&nbsp;24/7&nbsp;Server!<br>&gt;
&gt; (None)&nbsp;Join&nbsp;our&nbsp;Forums&nbsp;at&nbsp;RenCorner.ca!<br>&gt;
&gt; (None)&nbsp;Too&nbsp;Easy?&nbsp;Join&nbsp;the&nbsp;RenCorner&nbsp;Killing&nb
&gt; sp;Floor&nbsp;-&nbsp;Hard&nbsp;Server!<br>&gt;
&gt; (None)&nbsp;Join&nbsp;our&nbsp;Teamspeak&nbsp;3&nbsp;at&nbsp;Ts.RenCorner.ca
&gt; !<br>&gt;
&gt; (None)&nbsp;Join&nbsp;our&nbsp;IRC&nbsp;at&nbsp;irc.RenCorner.ca!&nbsp;#RC-K
&gt; F!<br>&gt;
&gt; (None)&nbsp;Become&nbsp;a&nbsp;member&nbs??K?`?T
&gt;
&gt;
&gt;
&gt;
&gt;
&gt;
&gt;
&gt; size_t write_to_string(void *ptr, size_t size, size_t count,
&gt; void *stream)
&gt;
&gt; {
&gt;
&gt;    
&gt;    ((std::string*)stream)-&gt;append((char*)ptr,
&gt; 0, size*count);
&gt;
&gt;        return size*count;
&gt;
&gt; }
&gt;
&gt;
&gt;
&gt; void LogToDisc(std::string str)
&gt;
&gt; {
&gt;
&gt;        std::ofstream FP;
&gt;
&gt;    
&gt;    FP.open(&quot;temp.txt&quot;,std::ios::trunc);
&gt;
&gt;        FP &lt;&lt;
&gt; StrFormat(&quot;%s&#92;n&quot;, str.c_str()) &lt;&lt; std::endl;
&gt;
&gt;        FP.close();
&gt;
&gt;
&gt;
&gt;        std::ifstream
&gt; file_in(&quot;temp.txt&quot;);
&gt;
&gt;        if(!file_in)
&gt;
&gt;        {
&gt;
&gt;              
&gt; printf(&quot;Unable to open the text file &#92;&quot;temp.txt&#92;&quot;.&#92;n&quot;);
&gt;
&gt;               return;
&gt;
&gt;        }
&gt;
&gt; }
&gt;
&gt;
&gt;
&gt;
&gt;
&gt; Void myFunction()
&gt;
&gt; {
&gt;
&gt;        CURL *curl;
&gt;
&gt;        CURLcode res;
&gt;
&gt;        curl = curl_easy_init();
&gt;
&gt;        if(curl)
&gt;
&gt;        {
&gt;
&gt;               std::string
&gt; response;
&gt;
&gt;              
&gt; curl_easy_setopt(curl, CURLOPT_URL,
&gt; &quot;http://208.115.205.106:8075/ServerAdmin/current_game&quot;);
&gt;
&gt;              
&gt; curl_easy_setopt(curl, CURLOPT_USERAGENT, &quot;User-Agent:
&gt; Mozilla/5.0 (Windows NT 6.1; WOW64; rv:21.0) Gecko/20100101
&gt; Firefox/21.0&quot;);
&gt;
&gt;              
&gt; curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1);
&gt;
&gt;              
&gt; curl_easy_setopt(curl, CURLOPT_POST, 1);
&gt;
&gt;               char
&gt; data[128];
&gt;
&gt;              
&gt; sprintf(data, &quot;%s:%s&quot;, WebAdminUserName, WebAdminPassword);
&gt;
&gt;              
&gt; curl_easy_setopt(curl, CURLOPT_USERPWD, data);
&gt;
&gt;              
&gt; sprintf(data, &quot;UserName=%s&Password=%s&quot;,
&gt; WebAdminUserName,
&gt; WebAdminPassword);
&gt;
&gt;              
&gt; curl_easy_setopt(curl, CURLOPT_POSTFIELDS, data);
&gt;
&gt;              
&gt; curl_easy_setopt(curl, CURLOPT_COOKIEJAR, &quot;cookie&quot;);
&gt;
&gt;              
&gt; curl_easy_setopt(curl, CURLOPT_COOKIEFILE, &quot;cookie&quot;);
&gt;
&gt;              
&gt; curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION,
&gt; write_to_string);
&gt;
&gt;              
&gt; curl_easy_setopt(curl, CURLOPT_WRITEDATA, &response);
&gt;
&gt; res = curl_easy_perform(curl);
&gt;
&gt;               if(CURLE_OK
&gt; == res)
&gt;
&gt;               {
&gt;
&gt;                
&gt;      char *ct;
&gt;
&gt;                
&gt;      res = curl_easy_getinfo(curl,
&gt; CURLINFO_CONTENT_TYPE,
&gt; &ct);
&gt;
&gt;                
&gt;      if((CURLE_OK == res) &&
&gt; ct)
&gt;
&gt;                
&gt;      {
&gt;
&gt;                
&gt;            printf(&quot;We
&gt; received Content-Type: %s&#92;n&quot;, ct);
&gt;
&gt;                
&gt;      }
&gt;
&gt;                
&gt;      curl_easy_cleanup(curl);
&gt;
&gt;               }
&gt;
&gt;              
&gt; printf(&quot;&#92;n&quot;);
&gt;
&gt;              
&gt; printf(response.c_str());
&gt;
&gt;              
&gt; printf(&quot;&#92;n&quot;);
&gt;
&gt;              
&gt; LogToDisk(response); //This is the bit that goes wrong?
&gt;
&gt;        }
&gt;
&gt; }
&gt;
&gt;
&gt;
&gt;
&gt;
&gt; -------------- next part --------------
&gt; An HTML attachment was scrubbed...
&gt; URL:
&gt;
&gt; ------------------------------
&gt;
&gt; Message: 2
&gt; Date: Thu, 13 Jun 2013 16:35:10 +0000
&gt; From: &quot;Hu, Eric&quot;
&gt; To: libcurl development
&gt; Subject: RE: cURL using axTLS non-blocking
&gt; Message-ID:
&gt;     &lt;058C0A318CE5B443BC188A5193848A50036D65_at_DMPEMPE008.LA.FRD.DIRECTV.com&gt;
&gt; Content-Type: text/plain; charset=&quot;us-ascii&quot;
&gt;
&gt; &gt; Anyway, I&#39;ve just merged Eric&#39;s non-blocking work into
&gt; master now so it&#39;d be
&gt; &gt; great if you (both) could just try that out and see
&gt; that everything looks fine
&gt; &gt; now in axtls land.
&gt; &gt;
&gt; All tests in the 300-399 range work for me (except 313,
&gt; which is expected to fail).  Some new tests are
&gt; failing, but I don&#39;t think it has anything to do with
&gt; axtls.c.  Test 31 and 62 were called out by commit
&gt; f24dc0.  Tests 1300-1309 and 1330 are failing, but
&gt; they&#39;re also failing in commit 9b8df5, immediately prior to
&gt; axTLS changes going in.
&gt;
&gt; Eric
&gt;
&gt;
&gt;
&gt;
&gt; ------------------------------
&gt;
&gt; Subject: Digest Footer
&gt;
&gt; _______________________________________________
&gt; curl-library mailing list
&gt; curl-library_at_cool.haxx.se
&gt; http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-library
&gt;
&gt;
&gt; ------------------------------
&gt;
&gt; End of curl-library Digest, Vol 94, Issue 18
&gt; ********************************************
&gt;

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2013-06-16