这篇教程C++ Curl_debug函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中Curl_debug函数的典型用法代码示例。如果您正苦于以下问题:C++ Curl_debug函数的具体用法?C++ Curl_debug怎么用?C++ Curl_debug使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了Curl_debug函数的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: Curl_infofvoid Curl_infof(struct SessionHandle *data, const char *fmt, ...){ if(data && data->set.verbose) { va_list ap; size_t len; char print_buffer[2048 + 1]; va_start(ap, fmt); vsnprintf(print_buffer, sizeof(print_buffer), fmt, ap); va_end(ap); len = strlen(print_buffer); Curl_debug(data, CURLINFO_TEXT, print_buffer, len, NULL); }}
开发者ID:1833183060,项目名称:wke,代码行数:13,
示例2: Curl_sec_read_msgint Curl_sec_read_msg(struct connectdata *conn, char *buffer, enum protection_level level){ /* decoded_len should be size_t or ssize_t but conn->mech->decode returns an int */ int decoded_len; char *buf; int ret_code; size_t decoded_sz = 0; CURLcode error; DEBUGASSERT(level > PROT_NONE && level < PROT_LAST); error = Curl_base64_decode(buffer + 4, (unsigned char **)&buf, &decoded_sz); if(error || decoded_sz == 0) return -1; if(decoded_sz > (size_t)INT_MAX) { free(buf); return -1; } decoded_len = curlx_uztosi(decoded_sz); decoded_len = conn->mech->decode(conn->app_data, buf, decoded_len, level, conn); if(decoded_len <= 0) { free(buf); return -1; } if(conn->data->set.verbose) { buf[decoded_len] = '/n'; Curl_debug(conn->data, CURLINFO_HEADER_IN, buf, decoded_len + 1, conn); } buf[decoded_len] = '/0'; DEBUGASSERT(decoded_len > 3); if(buf[3] == '-') ret_code = 0; else { /* Check for error? */ (void)sscanf(buf, "%d", &ret_code); } if(buf[decoded_len - 1] == '/n') buf[decoded_len - 1] = '/0'; /* FIXME: Is |buffer| length always greater than |decoded_len|? */ strcpy(buffer, buf); free(buf); return ret_code;}
开发者ID:goxigo,项目名称:curl,代码行数:51,
示例3: ssl_tls_trace/* * Our callback from the SSL/TLS layers. */static void ssl_tls_trace(int direction, int ssl_ver, int content_type, const void *buf, size_t len, const SSL *ssl, struct connectdata *conn){ struct SessionHandle *data = conn->data; const char *msg_name, *tls_rt_name; char ssl_buf[1024]; int ver, msg_type, txt_len; if (!conn || !conn->data || !conn->data->set.fdebug || (direction != 0 && direction != 1)) return; data = conn->data; ssl_ver >>= 8; ver = (ssl_ver == SSL2_VERSION_MAJOR ? '2' : ssl_ver == SSL3_VERSION_MAJOR ? '3' : '?'); /* SSLv2 doesn't seem to have TLS record-type headers, so OpenSSL * always pass-up content-type as 0. But the interesting message-type * is at 'buf[0]'. */ if (ssl_ver == SSL3_VERSION_MAJOR && content_type != 0) tls_rt_name = tls_rt_type(content_type); else tls_rt_name = ""; msg_type = *(char*)buf; msg_name = ssl_msg_type(ssl_ver, msg_type); txt_len = 1 + snprintf(ssl_buf, sizeof(ssl_buf), "SSLv%c, %s%s (%d):/n", ver, tls_rt_name, msg_name, msg_type); Curl_debug(data, CURLINFO_TEXT, ssl_buf, txt_len, NULL); Curl_debug(data, (direction == 1) ? CURLINFO_SSL_DATA_OUT : CURLINFO_SSL_DATA_IN, (char *)buf, len, NULL); (void) ssl;}
开发者ID:yyyyyao,项目名称:Slicer3-lib-mirrors,代码行数:41,
示例4: Curl_sendf/* Curl_sendf() sends formated data to the server */CURLcode Curl_sendf(curl_socket_t sockfd, struct connectdata *conn, const char *fmt, ...){ struct SessionHandle *data = conn->data; ssize_t bytes_written; size_t write_len; CURLcode res; char *s; char *sptr; va_list ap; va_start(ap, fmt); s = vaprintf(fmt, ap); /* returns an allocated string */ va_end(ap); if(!s) return CURLE_OUT_OF_MEMORY; /* failure */ bytes_written=0; write_len = strlen(s); sptr = s; while (1) { /* Write the buffer to the socket */ res = Curl_write(conn, sockfd, sptr, write_len, &bytes_written); if(CURLE_OK != res) break; if(data->set.verbose) Curl_debug(data, CURLINFO_DATA_OUT, sptr, bytes_written); if((size_t)bytes_written != write_len) { /* if not all was written at once, we must advance the pointer, decrease the size left and try again! */ write_len -= bytes_written; sptr += bytes_written; } else break; } free(s); /* free the output string */ return res;}
开发者ID:revelator,项目名称:Revelator-Doom3,代码行数:47,
示例5: Curl_failfvoid Curl_failf(struct Curl_easy *data, const char *fmt, ...){ if(data->set.verbose || data->set.errorbuffer) { va_list ap; size_t len; char error[CURL_ERROR_SIZE + 2]; va_start(ap, fmt); vsnprintf(error, CURL_ERROR_SIZE, fmt, ap); len = strlen(error); if(data->set.errorbuffer && !data->state.errorbuf) { strcpy(data->set.errorbuffer, error); data->state.errorbuf = TRUE; /* wrote error string */ } if(data->set.verbose) { error[len] = '/n'; error[++len] = '/0'; Curl_debug(data, CURLINFO_TEXT, error, len, NULL); } va_end(ap); }}
开发者ID:vszakats,项目名称:curl,代码行数:22,
示例6: Curl_failfvoid Curl_failf(struct SessionHandle *data, const char *fmt, ...){ va_list ap; size_t len; va_start(ap, fmt); vsnprintf(data->state.buffer, BUFSIZE, fmt, ap); if(data->set.errorbuffer && !data->state.errorbuf) { snprintf(data->set.errorbuffer, CURL_ERROR_SIZE, "%s", data->state.buffer); data->state.errorbuf = TRUE; /* wrote error string */ } if(data->set.verbose) { len = strlen(data->state.buffer); if(len < BUFSIZE - 1) { data->state.buffer[len] = '/n'; data->state.buffer[++len] = '/0'; } Curl_debug(data, CURLINFO_TEXT, data->state.buffer, len, NULL); } va_end(ap);}
开发者ID:ahqmhjk,项目名称:curl,代码行数:23,
示例7: Curl_failfvoid Curl_failf(struct SessionHandle *data, const char *fmt, ...){ va_list ap; va_start(ap, fmt); if(data->set.errorbuffer && !data->state.errorbuf) { vsnprintf(data->set.errorbuffer, CURL_ERROR_SIZE, fmt, ap); data->state.errorbuf = TRUE; /* wrote error string */ if(data->set.verbose) { size_t len = strlen(data->set.errorbuffer); bool doneit=FALSE; if(len < CURL_ERROR_SIZE - 1) { doneit = TRUE; data->set.errorbuffer[len] = '/n'; data->set.errorbuffer[++len] = '/0'; } Curl_debug(data, CURLINFO_TEXT, data->set.errorbuffer, len, NULL); if(doneit) /* cut off the newline again */ data->set.errorbuffer[--len]=0; } } va_end(ap);}
开发者ID:yyyyyao,项目名称:Slicer3-lib-mirrors,代码行数:24,
示例8: Curl_infofvoid Curl_infof(struct Curl_easy *data, const char *fmt, ...){ if(data && data->set.verbose) { va_list ap; size_t len; char print_buffer[2048 + 1]; va_start(ap, fmt); len = mvsnprintf(print_buffer, sizeof(print_buffer), fmt, ap); /* * Indicate truncation of the input by replacing the last 3 characters * with "...", and transfer the newline over in case the format had one. */ if(len >= sizeof(print_buffer)) { len = strlen(fmt); if(fmt[--len] == '/n') msnprintf(print_buffer + (sizeof(print_buffer) - 5), 5, ".../n"); else msnprintf(print_buffer + (sizeof(print_buffer) - 4), 4, "..."); } va_end(ap); len = strlen(print_buffer); Curl_debug(data, CURLINFO_TEXT, print_buffer, len); }}
开发者ID:webmaster128,项目名称:curl,代码行数:24,
示例9: Curl_proxyCONNECT//.........这里部分代码省略......... ssize_t tookcareof=0; /* now parse the chunked piece of data so that we can properly tell when the stream ends */ r = Curl_httpchunk_read(conn, ptr, gotbytes, &tookcareof); if(r == CHUNKE_STOP) { /* we're done reading chunks! */ infof(data, "chunk reading DONE/n"); keepon = FALSE; /* we did the full CONNECT treatment, go COMPLETE */ conn->tunnel_state[sockindex] = TUNNEL_COMPLETE; } else infof(data, "Read %zd bytes of chunk, continue/n", tookcareof); } } else for(i = 0; i < gotbytes; ptr++, i++) { perline++; /* amount of bytes in this line so far */ if(*ptr == 0x0a) { char letter; int writetype; /* convert from the network encoding */ result = Curl_convert_from_network(data, line_start, perline); /* Curl_convert_from_network calls failf if unsuccessful */ if(result) return result; /* output debug if that is requested */ if(data->set.verbose) Curl_debug(data, CURLINFO_HEADER_IN, line_start, (size_t)perline, conn); /* send the header to the callback */ writetype = CLIENTWRITE_HEADER; if(data->set.include_header) writetype |= CLIENTWRITE_BODY; result = Curl_client_write(conn, writetype, line_start, perline); data->info.header_size += (long)perline; data->req.headerbytecount += (long)perline; if(result) return result; /* Newlines are CRLF, so the CR is ignored as the line isn't really terminated until the LF comes. Treat a following CR as end-of-headers as well.*/ if(('/r' == line_start[0]) || ('/n' == line_start[0])) { /* end of response-headers from the proxy */ nread = 0; /* make next read start over in the read buffer */ ptr=data->state.buffer; if((407 == k->httpcode) && !data->state.authproblem) { /* If we get a 407 response code with content length when we have no auth problem, we must ignore the whole response-body */ keepon = 2;
开发者ID:celesius,项目名称:et-engine,代码行数:66,
示例10: Curl_pp_readresp//.........这里部分代码省略......... keepon = FALSE; } } if(!keepon) ; else if(gotbytes <= 0) { keepon = FALSE; result = CURLE_RECV_ERROR; failf(data, "FTP response reading failed"); } else { /* we got a whole chunk of data, which can be anything from one * byte to a set of lines and possible just a piece of the last * line */ ssize_t i; ssize_t clipamount = 0; bool restart = FALSE; data->req.headerbytecount += (long)gotbytes; pp->nread_resp += gotbytes; for(i = 0; i < gotbytes; ptr++, i++) { perline++; if(*ptr=='/n') { /* a newline is CRLF in ftp-talk, so the CR is ignored as the line isn't really terminated until the LF comes */ /* output debug output if that is requested */#if defined(HAVE_KRB4) || defined(HAVE_GSSAPI) if(!conn->sec_complete)#endif if(data->set.verbose) Curl_debug(data, CURLINFO_HEADER_IN, pp->linestart_resp, (size_t)perline, conn); /* * We pass all response-lines to the callback function registered * for "headers". The response lines can be seen as a kind of * headers. */ result = Curl_client_write(conn, CLIENTWRITE_HEADER, pp->linestart_resp, perline); if(result) return result; if(pp->endofresp(pp, code)) { /* This is the end of the last line, copy the last line to the start of the buffer and zero terminate, for old times sake (and krb4)! */ char *meow; int n; for(meow=pp->linestart_resp, n=0; meow<ptr; meow++, n++) buf[n] = *meow; *meow=0; /* zero terminate */ keepon=FALSE; pp->linestart_resp = ptr+1; /* advance pointer */ i++; /* skip this before getting out */ *size = pp->nread_resp; /* size of the response */ pp->nread_resp = 0; /* restart */ break; } perline=0; /* line starts over here */ pp->linestart_resp = ptr+1; }
开发者ID:bagobor,项目名称:vs-curl-test,代码行数:67,
示例11: Curl_pp_vsendf/*********************************************************************** * * Curl_pp_sendfv() * * Send the formated string as a command to a pingpong server. Note that * the string should not have any CRLF appended, as this function will * append the necessary things itself. * * NOTE: we build the command in a fixed-length buffer, which sets length * restrictions on the command! * * made to never block */CURLcode Curl_pp_vsendf(struct pingpong *pp, const char *fmt, va_list args){ ssize_t bytes_written;/* may still not be big enough for some krb5 tokens */#define SBUF_SIZE 1024 char s[SBUF_SIZE]; size_t write_len; char *sptr=s; CURLcode res = CURLE_OK; struct connectdata *conn = pp->conn; struct SessionHandle *data = conn->data;#if defined(HAVE_KRB4) || defined(HAVE_GSSAPI) enum protection_level data_sec = conn->data_prot;#endif vsnprintf(s, SBUF_SIZE-3, fmt, args); strcat(s, "/r/n"); /* append a trailing CRLF */ bytes_written=0; write_len = strlen(s); Curl_pp_init(pp);#ifdef CURL_DOES_CONVERSIONS res = Curl_convert_to_network(data, s, write_len); /* Curl_convert_to_network calls failf if unsuccessful */ if(res != CURLE_OK) { return res; }#endif /* CURL_DOES_CONVERSIONS */#if defined(HAVE_KRB4) || defined(HAVE_GSSAPI) conn->data_prot = prot_cmd;#endif res = Curl_write(conn, conn->sock[FIRSTSOCKET], sptr, write_len, &bytes_written);#if defined(HAVE_KRB4) || defined(HAVE_GSSAPI) conn->data_prot = data_sec;#endif if(CURLE_OK != res) return res; if(conn->data->set.verbose) Curl_debug(conn->data, CURLINFO_HEADER_OUT, sptr, (size_t)bytes_written, conn); if(bytes_written != (ssize_t)write_len) { /* the whole chunk was not sent, store the rest of the data */ write_len -= bytes_written; sptr += bytes_written; pp->sendthis = malloc(write_len); if(pp->sendthis) { memcpy(pp->sendthis, sptr, write_len); pp->sendsize = pp->sendleft = write_len; } else { failf(data, "out of memory"); res = CURLE_OUT_OF_MEMORY; } } else pp->response = Curl_tvnow(); return res;}
开发者ID:bagobor,项目名称:vs-curl-test,代码行数:83,
示例12: CONNECT//.........这里部分代码省略......... ssize_t tookcareof = 0; /* now parse the chunked piece of data so that we can properly tell when the stream ends */ r = Curl_httpchunk_read(conn, s->ptr, 1, &tookcareof); if(r == CHUNKE_STOP) { /* we're done reading chunks! */ infof(data, "chunk reading DONE/n"); s->keepon = FALSE; /* we did the full CONNECT treatment, go COMPLETE */ s->tunnel_state = TUNNEL_COMPLETE; } } continue; } s->perline++; /* amount of bytes in this line so far */ /* if this is not the end of a header line then continue */ if(*s->ptr != 0x0a) { s->ptr++; continue; } /* convert from the network encoding */ result = Curl_convert_from_network(data, s->line_start, (size_t)s->perline); /* Curl_convert_from_network calls failf if unsuccessful */ if(result) return result; /* output debug if that is requested */ if(data->set.verbose) Curl_debug(data, CURLINFO_HEADER_IN, s->line_start, (size_t)s->perline); if(!data->set.suppress_connect_headers) { /* send the header to the callback */ int writetype = CLIENTWRITE_HEADER; if(data->set.include_header) writetype |= CLIENTWRITE_BODY; result = Curl_client_write(conn, writetype, s->line_start, s->perline); if(result) return result; } data->info.header_size += (long)s->perline; data->req.headerbytecount += (long)s->perline; /* Newlines are CRLF, so the CR is ignored as the line isn't really terminated until the LF comes. Treat a following CR as end-of-headers as well.*/ if(('/r' == s->line_start[0]) || ('/n' == s->line_start[0])) { /* end of response-headers from the proxy */ s->ptr = s->connect_buffer; if((407 == k->httpcode) && !data->state.authproblem) { /* If we get a 407 response code with content length when we have no auth problem, we must ignore the whole response-body */ s->keepon = 2; if(s->cl) {
开发者ID:Audifire,项目名称:mtasa-blue,代码行数:67,
示例13: Curl_pp_vsendf/*********************************************************************** * * Curl_pp_vsendf() * * Send the formatted string as a command to a pingpong server. Note that * the string should not have any CRLF appended, as this function will * append the necessary things itself. * * made to never block */CURLcode Curl_pp_vsendf(struct pingpong *pp, const char *fmt, va_list args){ ssize_t bytes_written; size_t write_len; char *fmt_crlf; char *s; CURLcode result; struct connectdata *conn = pp->conn; struct Curl_easy *data;#ifdef HAVE_GSSAPI enum protection_level data_sec;#endif DEBUGASSERT(pp->sendleft == 0); DEBUGASSERT(pp->sendsize == 0); DEBUGASSERT(pp->sendthis == NULL); if(!conn) /* can't send without a connection! */ return CURLE_SEND_ERROR; data = conn->data; fmt_crlf = aprintf("%s/r/n", fmt); /* append a trailing CRLF */ if(!fmt_crlf) return CURLE_OUT_OF_MEMORY; s = vaprintf(fmt_crlf, args); /* trailing CRLF appended */ free(fmt_crlf); if(!s) return CURLE_OUT_OF_MEMORY; bytes_written = 0; write_len = strlen(s); Curl_pp_init(pp); result = Curl_convert_to_network(data, s, write_len); /* Curl_convert_to_network calls failf if unsuccessful */ if(result) { free(s); return result; }#ifdef HAVE_GSSAPI conn->data_prot = PROT_CMD;#endif result = Curl_write(conn, conn->sock[FIRSTSOCKET], s, write_len, &bytes_written);#ifdef HAVE_GSSAPI data_sec = conn->data_prot; DEBUGASSERT(data_sec > PROT_NONE && data_sec < PROT_LAST); conn->data_prot = data_sec;#endif if(result) { free(s); return result; } if(conn->data->set.verbose) Curl_debug(conn->data, CURLINFO_HEADER_OUT, s, (size_t)bytes_written, conn); if(bytes_written != (ssize_t)write_len) { /* the whole chunk was not sent, keep it around and adjust sizes */ pp->sendthis = s; pp->sendsize = write_len; pp->sendleft = write_len - bytes_written; } else { free(s); pp->sendthis = NULL; pp->sendleft = pp->sendsize = 0; pp->response = Curl_now(); } return CURLE_OK;}
开发者ID:ETrun,项目名称:curl,代码行数:92,
注:本文中的Curl_debug函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ Curl_pgrsSetDownloadCounter函数代码示例 C++ Curl_convert_from_network函数代码示例 |