[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] [gnurl] 68/254: sendf: remove use of BUFSIZE from debug dat
From: |
gnunet |
Subject: |
[GNUnet-SVN] [gnurl] 68/254: sendf: remove use of BUFSIZE from debug data conversions |
Date: |
Sat, 17 Jun 2017 16:51:40 +0200 |
This is an automated email from the git hooks/post-receive script.
ng0 pushed a commit to annotated tag gnurl-7.54.1
in repository gnurl.
commit 7ee52c25f35816968b86d32eaef70ab743a457d4
Author: Daniel Stenberg <address@hidden>
AuthorDate: Tue Apr 25 15:19:19 2017 +0200
sendf: remove use of BUFSIZE from debug data conversions
The buffer can have other sizes.
---
lib/sendf.c | 51 ++++++++++++++++++++++++++-------------------------
1 file changed, 26 insertions(+), 25 deletions(-)
diff --git a/lib/sendf.c b/lib/sendf.c
index 075b297b8..0c44224bb 100644
--- a/lib/sendf.c
+++ b/lib/sendf.c
@@ -751,21 +751,19 @@ static int showit(struct Curl_easy *data, curl_infotype
type,
{
static const char s_infotype[CURLINFO_END][3] = {
"* ", "< ", "> ", "{ ", "} ", "{ ", "} " };
+ int rc = 0;
#ifdef CURL_DOES_CONVERSIONS
- char buf[BUFSIZE+1];
+ char *buf = NULL;
size_t conv_size = 0;
switch(type) {
case CURLINFO_HEADER_OUT:
- /* assume output headers are ASCII */
- /* copy the data into my buffer so the original is unchanged */
- if(size > BUFSIZE) {
- size = BUFSIZE; /* truncate if necessary */
- buf[BUFSIZE] = '\0';
- }
+ buf = Curl_memdup(ptr, size);
+ if(!buf)
+ return 1;
conv_size = size;
- memcpy(buf, ptr, size);
+
/* Special processing is needed for this block if it
* contains both headers and data (separated by CRLFCRLF).
* We want to convert just the headers, leaving the data as-is.
@@ -793,26 +791,29 @@ static int showit(struct Curl_easy *data, curl_infotype
type,
#endif /* CURL_DOES_CONVERSIONS */
if(data->set.fdebug)
- return (*data->set.fdebug)(data, type, ptr, size,
- data->set.debugdata);
-
- switch(type) {
- case CURLINFO_TEXT:
- case CURLINFO_HEADER_OUT:
- case CURLINFO_HEADER_IN:
- fwrite(s_infotype[type], 2, 1, data->set.err);
- fwrite(ptr, size, 1, data->set.err);
+ rc = (*data->set.fdebug)(data, type, ptr, size, data->set.debugdata);
+ else {
+ switch(type) {
+ case CURLINFO_TEXT:
+ case CURLINFO_HEADER_OUT:
+ case CURLINFO_HEADER_IN:
+ fwrite(s_infotype[type], 2, 1, data->set.err);
+ fwrite(ptr, size, 1, data->set.err);
#ifdef CURL_DOES_CONVERSIONS
- if(size != conv_size) {
- /* we had untranslated data so we need an explicit newline */
- fwrite("\n", 1, 1, data->set.err);
- }
+ if(size != conv_size) {
+ /* we had untranslated data so we need an explicit newline */
+ fwrite("\n", 1, 1, data->set.err);
+ }
#endif
- break;
- default: /* nada */
- break;
+ break;
+ default: /* nada */
+ break;
+ }
}
- return 0;
+#ifdef CURL_DOES_CONVERSIONS
+ free(buf);
+#endif
+ return rc;
}
int Curl_debug(struct Curl_easy *data, curl_infotype type,
--
To stop receiving notification emails like this one, please contact
address@hidden
- [GNUnet-SVN] [gnurl] 124/254: tests: remove superfluous test 1399, (continued)
- [GNUnet-SVN] [gnurl] 124/254: tests: remove superfluous test 1399, gnunet, 2017/06/17
- [GNUnet-SVN] [gnurl] 131/254: multi: remove leftover debug infof() calls from e9fd794a6, gnunet, 2017/06/17
- [GNUnet-SVN] [gnurl] 51/254: tool: Fix missing prototype warnings for CURL_DOES_CONVERSIONS, gnunet, 2017/06/17
- [GNUnet-SVN] [gnurl] 43/254: unit1604: fixed indentation, gnunet, 2017/06/17
- [GNUnet-SVN] [gnurl] 220/254: CONTRIBUTE.md: mention tests done on pull requests, gnunet, 2017/06/17
- [GNUnet-SVN] [gnurl] 141/254: man pages: fix example syntax errors, gnunet, 2017/06/17
- [GNUnet-SVN] [gnurl] 137/254: url.c: add a compile-time check that CURL_MAX_WRITE_SIZE is large enough, gnunet, 2017/06/17
- [GNUnet-SVN] [gnurl] 133/254: tests: made a couple of prechecks consistent with others, gnunet, 2017/06/17
- [GNUnet-SVN] [gnurl] 210/254: mbedtls: make TU-local variable static, gnunet, 2017/06/17
- [GNUnet-SVN] [gnurl] 243/254: gitignore: ignore all vim swap files, gnunet, 2017/06/17
- [GNUnet-SVN] [gnurl] 68/254: sendf: remove use of BUFSIZE from debug data conversions,
gnunet <=
- [GNUnet-SVN] [gnurl] 197/254: examples/externalsocket.c: s/closesocket/closecb, gnunet, 2017/06/17
- [GNUnet-SVN] [gnurl] 201/254: typecheck-gcc.h: check CURLINFO_TLS_SSL_PTR and CURLINFO_TLS_SESSION, gnunet, 2017/06/17
- [GNUnet-SVN] [gnurl] 253/254: release: 7.54.1, gnunet, 2017/06/17
- [GNUnet-SVN] [gnurl] 97/254: docs/opts: 24 more man pages now have examples, gnunet, 2017/06/17
- [GNUnet-SVN] [gnurl] 74/254: testpart: remove _MPRINTF_REPLACE, gnunet, 2017/06/17
- [GNUnet-SVN] [gnurl] 193/254: CURLOPT_FNMATCH_FUNCTION.3: also modified example to avoid fcpp issues, gnunet, 2017/06/17
- [GNUnet-SVN] [gnurl] 222/254: curl_ntlm_core: pass unsigned char to toupper, gnunet, 2017/06/17
- [GNUnet-SVN] [gnurl] 163/254: cmake: fix build on Ubuntu 14.04, gnunet, 2017/06/17
- [GNUnet-SVN] [gnurl] 185/254: build-wolfssl: Sync config with wolfSSL 3.11, gnunet, 2017/06/17
- [GNUnet-SVN] [gnurl] 208/254: test1538: fix typo, gnunet, 2017/06/17