~ubuntu-branches/ubuntu/natty/curl/natty-security

« back to all changes in this revision

Viewing changes to tests/libtest/lib533.c

  • Committer: Bazaar Package Importer
  • Author(s): Bhavani Shankar
  • Date: 2010-06-20 13:56:28 UTC
  • mfrom: (3.4.7 sid)
  • Revision ID: james.westby@ubuntu.com-20100620135628-e30tp9jldq6hq985
Tags: 7.21.0-1ubuntu1
* Merge from debian unstable.  Remaining changes: LP: #596334
  - Keep build deps in main:
    - Drop build dependencies: stunnel, libssh2-1-dev
    - Add build-dependency on openssh-server
    - Drop libssh2-1-dev from libcurl4-openssl-dev's Depends.

Show diffs side-by-side

added added

removed removed

Lines of Context:
5
5
 *                            | (__| |_| |  _ <| |___
6
6
 *                             \___|\___/|_| \_\_____|
7
7
 *
8
 
 * $Id: lib533.c,v 1.16 2008-09-20 04:26:57 yangtse Exp $
9
8
 */
10
9
 
11
10
/* used for test case 533, 534 and 535 */
28
27
  CURL *curl;
29
28
  int running;
30
29
  char done=FALSE;
31
 
  CURLM *m;
 
30
  CURLM *m = NULL;
32
31
  int current=0;
33
32
  struct timeval ml_start;
34
33
  struct timeval mp_start;
46
45
    return TEST_ERR_MAJOR_BAD;
47
46
  }
48
47
 
49
 
  curl_easy_setopt(curl, CURLOPT_URL, URL);
50
 
  curl_easy_setopt(curl, CURLOPT_VERBOSE, 1);
51
 
  curl_easy_setopt(curl, CURLOPT_FAILONERROR, 1);
 
48
  test_setopt(curl, CURLOPT_URL, URL);
 
49
  test_setopt(curl, CURLOPT_VERBOSE, 1);
 
50
  test_setopt(curl, CURLOPT_FAILONERROR, 1);
52
51
 
53
52
  if ((m = curl_multi_init()) == NULL) {
54
53
    fprintf(stderr, "curl_multi_init() failed\n");
79
78
    interval.tv_sec = 1;
80
79
    interval.tv_usec = 0;
81
80
 
82
 
    if (tutil_tvdiff(tutil_tvnow(), ml_start) > 
 
81
    if (tutil_tvdiff(tutil_tvnow(), ml_start) >
83
82
        MAIN_LOOP_HANG_TIMEOUT) {
84
83
      ml_timedout = TRUE;
85
84
      break;
89
88
 
90
89
    while (res == CURLM_CALL_MULTI_PERFORM) {
91
90
      res = (int)curl_multi_perform(m, &running);
92
 
      if (tutil_tvdiff(tutil_tvnow(), mp_start) > 
 
91
      if (tutil_tvdiff(tutil_tvnow(), mp_start) >
93
92
          MULTI_PERFORM_HANG_TIMEOUT) {
94
93
        mp_timedout = TRUE;
95
94
        break;
103
102
          /* make us re-use the same handle all the time, and try resetting
104
103
             the handle first too */
105
104
          curl_easy_reset(curl);
106
 
          curl_easy_setopt(curl, CURLOPT_URL, libtest_arg2);
107
 
          curl_easy_setopt(curl, CURLOPT_VERBOSE, 1);
108
 
          curl_easy_setopt(curl, CURLOPT_FAILONERROR, 1);
 
105
          test_setopt(curl, CURLOPT_URL, libtest_arg2);
 
106
          test_setopt(curl, CURLOPT_VERBOSE, 1);
 
107
          test_setopt(curl, CURLOPT_FAILONERROR, 1);
109
108
 
110
109
          /* re-add it */
111
110
          res = (int)curl_multi_add_handle(m, curl);
156
155
    res = TEST_ERR_RUNS_FOREVER;
157
156
  }
158
157
 
 
158
test_cleanup:
 
159
 
159
160
  curl_easy_cleanup(curl);
160
 
  curl_multi_cleanup(m);
 
161
  if(m)
 
162
    curl_multi_cleanup(m);
161
163
  curl_global_cleanup();
162
164
 
163
165
  return res;