您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ Curl_pgrsSetUploadSize函数代码示例

51自学网 2021-06-01 20:16:05
  C++
这篇教程C++ Curl_pgrsSetUploadSize函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中Curl_pgrsSetUploadSize函数的典型用法代码示例。如果您正苦于以下问题:C++ Curl_pgrsSetUploadSize函数的具体用法?C++ Curl_pgrsSetUploadSize怎么用?C++ Curl_pgrsSetUploadSize使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了Curl_pgrsSetUploadSize函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: smtp_state_data_resp

/* For DATA response */static CURLcode smtp_state_data_resp(struct connectdata *conn, int smtpcode,                                     smtpstate instate){  CURLcode result = CURLE_OK;  struct Curl_easy *data = conn->data;  (void)instate; /* no use for this yet */  if(smtpcode != 354) {    failf(data, "DATA failed: %d", smtpcode);    result = CURLE_SEND_ERROR;  }  else {    /* Set the progress upload size */    Curl_pgrsSetUploadSize(data, data->state.infilesize);    /* SMTP upload */    Curl_setup_transfer(conn, -1, -1, FALSE, NULL, FIRSTSOCKET, NULL);    /* End of DO phase */    state(conn, SMTP_STOP);  }  return result;}
开发者ID:vszakats,项目名称:curl,代码行数:26,


示例2: pop3_regular_transfer

/*********************************************************************** * * pop3_regular_transfer() * * The input argument is already checked for validity. * * Performs all commands done before a regular transfer between a local and a * remote host. * */staticCURLcode pop3_regular_transfer(struct connectdata *conn,                              bool *dophase_done){  CURLcode result=CURLE_OK;  bool connected=FALSE;  struct SessionHandle *data = conn->data;  data->req.size = -1; /* make sure this is unknown at this point */  Curl_pgrsSetUploadCounter(data, 0);  Curl_pgrsSetDownloadCounter(data, 0);  Curl_pgrsSetUploadSize(data, 0);  Curl_pgrsSetDownloadSize(data, 0);  result = pop3_perform(conn,                        &connected, /* have we connected after PASV/PORT */                        dophase_done); /* all commands in the DO-phase done? */  if(CURLE_OK == result) {    if(!*dophase_done)      /* the DO phase has not completed yet */      return CURLE_OK;    result = pop3_dophase_done(conn, connected);    if(result)      return result;  }  return result;}
开发者ID:dinny,项目名称:curl,代码行数:41,


示例3: smtp_regular_transfer

/*********************************************************************** * * smtp_regular_transfer() * * The input argument is already checked for validity. * * Performs all commands done before a regular transfer between a local and a * remote host. */static CURLcode smtp_regular_transfer(struct connectdata *conn,                                      bool *dophase_done){  CURLcode result = CURLE_OK;  bool connected = FALSE;  struct SessionHandle *data = conn->data;  /* Make sure size is unknown at this point */  data->req.size = -1;  Curl_pgrsSetUploadCounter(data, 0);  Curl_pgrsSetDownloadCounter(data, 0);  Curl_pgrsSetUploadSize(data, 0);  Curl_pgrsSetDownloadSize(data, 0);  result = smtp_perform(conn, &connected, dophase_done);  if(CURLE_OK == result) {    if(!*dophase_done)      /* The DO phase has not completed yet */      return CURLE_OK;    result = smtp_dophase_done(conn, connected);    if(result)      return result;  }  return result;}
开发者ID:sohailsomani,项目名称:curl,代码行数:38,


示例4: smtp_regular_transfer

/*********************************************************************** * * smtp_regular_transfer() * * The input argument is already checked for validity. * * Performs all commands done before a regular transfer between a local and a * remote host. */static CURLcode smtp_regular_transfer(struct connectdata *conn,                                      bool *dophase_done){  CURLcode result = CURLE_OK;  bool connected = FALSE;  struct Curl_easy *data = conn->data;  /* Make sure size is unknown at this point */  data->req.size = -1;  /* Set the progress data */  Curl_pgrsSetUploadCounter(data, 0);  Curl_pgrsSetDownloadCounter(data, 0);  Curl_pgrsSetUploadSize(data, -1);  Curl_pgrsSetDownloadSize(data, -1);  /* Carry out the perform */  result = smtp_perform(conn, &connected, dophase_done);  /* Perform post DO phase operations if necessary */  if(!result && *dophase_done)    result = smtp_dophase_done(conn, connected);  return result;}
开发者ID:vszakats,项目名称:curl,代码行数:34,


示例5: rtmp_do

static CURLcode rtmp_do(struct connectdata *conn, bool *done){    RTMP *r = conn->proto.generic;    if(!RTMP_ConnectStream(r, 0))        return CURLE_FAILED_INIT;    if(conn->data->set.upload) {        Curl_pgrsSetUploadSize(conn->data, conn->data->state.infilesize);        Curl_setup_transfer(conn, -1, -1, FALSE, NULL, FIRSTSOCKET, NULL);    }    else        Curl_setup_transfer(conn, FIRSTSOCKET, -1, FALSE, NULL, -1, NULL);    *done = TRUE;    return CURLE_OK;}
开发者ID:robocoder,项目名称:curl,代码行数:16,


示例6: file_upload

static CURLcode file_upload(struct connectdata *conn){  struct FILEPROTO *file = conn->data->state.proto.file;  const char *dir = strchr(file->path, DIRSEP);  FILE *fp;  CURLcode res=CURLE_OK;  struct SessionHandle *data = conn->data;  char *buf = data->state.buffer;  size_t nread;  size_t nwrite;  curl_off_t bytecount = 0;  struct timeval now = Curl_tvnow();  struct_stat file_stat;  const char* buf2;  /*   * Since FILE: doesn't do the full init, we need to provide some extra   * assignments here.   */  conn->fread_func = data->set.fread_func;  conn->fread_in = data->set.in;  conn->data->req.upload_fromhere = buf;  if(!dir)    return CURLE_FILE_COULDNT_READ_FILE; /* fix: better error code */  if(!dir[1])     return CURLE_FILE_COULDNT_READ_FILE; /* fix: better error code */  if(data->state.resume_from)    fp = fopen( file->path, "ab" );  else {    int fd;#ifdef DOS_FILESYSTEM    fd = open(file->path, O_WRONLY|O_CREAT|O_TRUNC|O_BINARY,              conn->data->set.new_file_perms);#else    fd = open(file->path, O_WRONLY|O_CREAT|O_TRUNC,              conn->data->set.new_file_perms);#endif    if(fd < 0) {      failf(data, "Can't open %s for writing", file->path);      return CURLE_WRITE_ERROR;    }    close(fd);    fp = fopen(file->path, "wb");  }  if(!fp) {    failf(data, "Can't open %s for writing", file->path);    return CURLE_WRITE_ERROR;  }  if(-1 != data->set.infilesize)    /* known size of data to "upload" */    Curl_pgrsSetUploadSize(data, data->set.infilesize);  /* treat the negative resume offset value as the case of "-" */  if(data->state.resume_from < 0) {    if(fstat(fileno(fp), &file_stat)) {      fclose(fp);      failf(data, "Can't get the size of %s", file->path);      return CURLE_WRITE_ERROR;    }    else      data->state.resume_from = (curl_off_t)file_stat.st_size;  }  while(res == CURLE_OK) {    int readcount;    res = Curl_fillreadbuffer(conn, BUFSIZE, &readcount);    if(res)      break;    if(readcount <= 0)  /* fix questionable compare error. curlvms */      break;    nread = (size_t)readcount;    /*skip bytes before resume point*/    if(data->state.resume_from) {      if( (curl_off_t)nread <= data->state.resume_from ) {        data->state.resume_from -= nread;        nread = 0;        buf2 = buf;      }      else {        buf2 = buf + data->state.resume_from;        nread -= (size_t)data->state.resume_from;        data->state.resume_from = 0;      }    }    else      buf2 = buf;    /* write the data to the target */    nwrite = fwrite(buf2, 1, nread, fp);    if(nwrite != nread) {      res = CURLE_SEND_ERROR;//.........这里部分代码省略.........
开发者ID:0w,项目名称:moai-dev,代码行数:101,


示例7: file_upload

static CURLcode file_upload(struct connectdata *conn){  struct FILEPROTO *file = conn->data->req.protop;  const char *dir = strchr(file->path, DIRSEP);  int fd;  int mode;  CURLcode result = CURLE_OK;  struct Curl_easy *data = conn->data;  char *buf = data->state.buffer;  size_t nread;  size_t nwrite;  curl_off_t bytecount = 0;  struct timeval now = Curl_tvnow();  struct_stat file_stat;  const char* buf2;  /*   * Since FILE: doesn't do the full init, we need to provide some extra   * assignments here.   */  conn->data->req.upload_fromhere = buf;  if(!dir)    return CURLE_FILE_COULDNT_READ_FILE; /* fix: better error code */  if(!dir[1])    return CURLE_FILE_COULDNT_READ_FILE; /* fix: better error code */#ifdef O_BINARY#define MODE_DEFAULT O_WRONLY|O_CREAT|O_BINARY#else#define MODE_DEFAULT O_WRONLY|O_CREAT#endif  if(data->state.resume_from)    mode = MODE_DEFAULT|O_APPEND;  else    mode = MODE_DEFAULT|O_TRUNC;  fd = open(file->path, mode, conn->data->set.new_file_perms);  if(fd < 0) {    failf(data, "Can't open %s for writing", file->path);    return CURLE_WRITE_ERROR;  }  if(-1 != data->state.infilesize)    /* known size of data to "upload" */    Curl_pgrsSetUploadSize(data, data->state.infilesize);  /* treat the negative resume offset value as the case of "-" */  if(data->state.resume_from < 0) {    if(fstat(fd, &file_stat)) {      close(fd);      failf(data, "Can't get the size of %s", file->path);      return CURLE_WRITE_ERROR;    }    else      data->state.resume_from = (curl_off_t)file_stat.st_size;  }  while(!result) {    int readcount;    result = Curl_fillreadbuffer(conn, BUFSIZE, &readcount);    if(result)      break;    if(readcount <= 0)  /* fix questionable compare error. curlvms */      break;    nread = (size_t)readcount;    /*skip bytes before resume point*/    if(data->state.resume_from) {      if((curl_off_t)nread <= data->state.resume_from) {        data->state.resume_from -= nread;        nread = 0;        buf2 = buf;      }      else {        buf2 = buf + data->state.resume_from;        nread -= (size_t)data->state.resume_from;        data->state.resume_from = 0;      }    }    else      buf2 = buf;    /* write the data to the target */    nwrite = write(fd, buf2, nread);    if(nwrite != nread) {      result = CURLE_SEND_ERROR;      break;    }    bytecount += nread;    Curl_pgrsSetUploadCounter(data, bytecount);    if(Curl_pgrsUpdate(conn))      result = CURLE_ABORTED_BY_CALLBACK;//.........这里部分代码省略.........
开发者ID:2px,项目名称:curl,代码行数:101,


示例8: file_upload

static CURLcode file_upload(struct connectdata *conn){  struct FILEPROTO *file = conn->proto.file;  char *dir = strchr(file->path, DIRSEP);  FILE *fp;  CURLcode res=CURLE_OK;  struct SessionHandle *data = conn->data;  char *buf = data->state.buffer;  size_t nread;  size_t nwrite;  curl_off_t bytecount = 0;  struct timeval now = Curl_tvnow();  /*   * Since FILE: doesn't do the full init, we need to provide some extra   * assignments here.   */  conn->fread = data->set.fread;  conn->fread_in = data->set.in;  conn->upload_fromhere = buf;  if(!dir)    return CURLE_FILE_COULDNT_READ_FILE; /* fix: better error code */  if(!dir[1])     return CURLE_FILE_COULDNT_READ_FILE; /* fix: better error code */  fp = fopen(file->path, "wb");  if(!fp) {    failf(data, "Can't open %s for writing", file->path);    return CURLE_WRITE_ERROR;  }  if(-1 != data->set.infilesize)    /* known size of data to "upload" */    Curl_pgrsSetUploadSize(data, data->set.infilesize);  while (res == CURLE_OK) {    int readcount;    res = Curl_fillreadbuffer(conn, BUFSIZE, &readcount);    if(res)      break;    nread = (size_t)readcount;    if (nread <= 0)      break;    /* write the data to the target */    nwrite = fwrite(buf, 1, nread, fp);    if(nwrite != nread) {      res = CURLE_SEND_ERROR;      break;    }    bytecount += nread;    Curl_pgrsSetUploadCounter(data, bytecount);    if(Curl_pgrsUpdate(conn))      res = CURLE_ABORTED_BY_CALLBACK;    else      res = Curl_speedcheck(data, now);  }  if(!res && Curl_pgrsUpdate(conn))    res = CURLE_ABORTED_BY_CALLBACK;  fclose(fp);  return res;}
开发者ID:BackupTheBerlios,项目名称:wl530g-svn,代码行数:71,


示例9: Curl_http

//.........这里部分代码省略.........           to the headers which actually speeds up post operations (as           there is one packet coming back from the web server) */        add_bufferf(req_buffer,                    "Expect: 100-continue/r/n");        data->set.expect100header = TRUE;      }      if(!checkheaders(data, "Content-Type:")) {        /* Get Content-Type: line from Curl_FormReadOneLine, which happens           to always be the first line. We can know this for sure since           we always build the formpost linked list the same way!           The Content-Type header line also contains the MIME boundary           string etc why disabling this header is likely to not make things           work, but we support it anyway.        */        char contentType[256];        int linelength=0;        linelength = Curl_FormReadOneLine (contentType,                                           sizeof(contentType),                                           1,                                           (FILE *)&http->form);        if(linelength == -1) {          failf(data, "Could not get Content-Type header line!");          return CURLE_HTTP_POST_ERROR;        }        add_buffer(req_buffer, contentType, linelength);      }      /* make the request end in a true CRLF */      add_buffer(req_buffer, "/r/n", 2);      /* set upload size to the progress meter */      Curl_pgrsSetUploadSize(data, http->postsize);      /* fire away the whole request to the server */      result = add_buffer_send(conn->firstsocket, conn, req_buffer,                               &data->info.request_size);      if(result)        failf(data, "Failed sending POST request");      else        /* setup variables for the upcoming transfer */        result = Curl_Transfer(conn, conn->firstsocket, -1, TRUE,                               &http->readbytecount,                               conn->firstsocket,                               &http->writebytecount);      if(result) {        Curl_formclean(http->sendit); /* free that whole lot */        return result;      }    }    else if(HTTPREQ_PUT == data->set.httpreq) {      /* Let's PUT the data to the server! */      if(data->set.infilesize>0) {        add_bufferf(req_buffer,                    "Content-Length: %d/r/n/r/n", /* file size */                    data->set.infilesize );      }      else        add_bufferf(req_buffer, "/015/012");      /* set the upload size to the progress meter */      Curl_pgrsSetUploadSize(data, data->set.infilesize);      /* this sends the buffer and frees all the buffer resources */
开发者ID:BackupTheBerlios,项目名称:texlive,代码行数:67,



注:本文中的Curl_pgrsSetUploadSize函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


C++ Curl_pgrsTime函数代码示例
C++ Curl_pgrsSetUploadCounter函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。