~ubuntu-branches/ubuntu/vivid/curl/vivid

« back to all changes in this revision

Viewing changes to lib/ftp.c

  • Committer: Package Import Robot
  • Author(s): Alessandro Ghedini
  • Date: 2012-03-23 16:24:51 UTC
  • mto: (3.6.1 experimental) (1.3.1)
  • mto: This revision was merged to the branch mainline in revision 59.
  • Revision ID: package-import@ubuntu.com-20120323162451-z4gstlabjkgnrh7h
Tags: upstream-7.25.0
ImportĀ upstreamĀ versionĀ 7.25.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
3197
3197
  pp->endofresp = ftp_endofresp;
3198
3198
  pp->conn = conn;
3199
3199
 
3200
 
  if(conn->bits.tunnel_proxy && conn->bits.httpproxy) {
3201
 
    /* for FTP over HTTP proxy */
3202
 
    struct HTTP http_proxy;
3203
 
    struct FTP *ftp_save;
3204
 
 
3205
 
    /* BLOCKING */
3206
 
    /* We want "seamless" FTP operations through HTTP proxy tunnel */
3207
 
 
3208
 
    /* Curl_proxyCONNECT is based on a pointer to a struct HTTP at the member
3209
 
     * conn->proto.http; we want FTP through HTTP and we have to change the
3210
 
     * member temporarily for connecting to the HTTP proxy. After
3211
 
     * Curl_proxyCONNECT we have to set back the member to the original struct
3212
 
     * FTP pointer
3213
 
     */
3214
 
    ftp_save = data->state.proto.ftp;
3215
 
    memset(&http_proxy, 0, sizeof(http_proxy));
3216
 
    data->state.proto.http = &http_proxy;
3217
 
 
3218
 
    result = Curl_proxyCONNECT(conn, FIRSTSOCKET,
3219
 
                               conn->host.name, conn->remote_port);
3220
 
 
3221
 
    data->state.proto.ftp = ftp_save;
3222
 
 
3223
 
    if(CURLE_OK != result)
3224
 
      return result;
3225
 
  }
3226
 
 
3227
3200
  if(conn->handler->flags & PROTOPT_SSL) {
3228
3201
    /* BLOCKING */
3229
3202
    result = Curl_ssl_connect(conn, FIRSTSOCKET);
4271
4244
        return CURLE_OUT_OF_MEMORY;
4272
4245
 
4273
4246
      ftpc->dirs[0] = curl_easy_unescape(conn->data, slash_pos ? cur_pos : "/",
4274
 
                                         slash_pos?(int)(slash_pos-cur_pos):1,
 
4247
                                         slash_pos ?
 
4248
                                         curlx_sztosi(slash_pos-cur_pos) : 1,
4275
4249
                                         NULL);
4276
4250
      if(!ftpc->dirs[0]) {
4277
4251
        freedirs(ftpc);
4310
4284
          /* we skip empty path components, like "x//y" since the FTP command
4311
4285
             CWD requires a parameter and a non-existent parameter a) doesn't
4312
4286
             work on many servers and b) has no effect on the others. */
4313
 
          int len = (int)(slash_pos - cur_pos + absolute_dir);
 
4287
          int len = curlx_sztosi(slash_pos - cur_pos + absolute_dir);
4314
4288
          ftpc->dirs[ftpc->dirdepth] =
4315
4289
            curl_easy_unescape(conn->data, cur_pos - absolute_dir, len, NULL);
4316
4290
          if(!ftpc->dirs[ftpc->dirdepth]) { /* run out of memory ... */
4381
4355
      return CURLE_OUT_OF_MEMORY;
4382
4356
    }
4383
4357
 
4384
 
    dlen -= ftpc->file?(int)strlen(ftpc->file):0;
4385
 
    if((dlen == (int)strlen(ftpc->prevpath)) &&
 
4358
    dlen -= ftpc->file?curlx_uztosi(strlen(ftpc->file)):0;
 
4359
    if((dlen == curlx_uztosi(strlen(ftpc->prevpath))) &&
4386
4360
       strnequal(path, ftpc->prevpath, dlen)) {
4387
4361
      infof(data, "Request has same path as previous transfer\n");
4388
4362
      ftpc->cwddone = TRUE;