1
0
mirror of https://github.com/moparisthebest/curl synced 2025-03-11 15:50:48 -04:00

Added test 553. This test case and code is based on the bug recipe Joe Malicki

provided for bug report #1871269, fixed on Jan 14 2008 before the 7.18.0
release.
This commit is contained in:
Daniel Stenberg 2008-01-16 22:54:54 +00:00
parent 6893fcaa9b
commit c522f349fe
4 changed files with 146 additions and 3 deletions

View File

@ -47,7 +47,7 @@ EXTRA_DIST = test1 test108 test117 test127 test20 test27 test34 test46 \
test1010 test1011 test1012 test542 test543 test536 test1008 test1009 \
test2000 test2001 test2002 test2003 test35 test544 test545 test2004 \
test546 test1013 test1014 test1015 test547 test548 test549 test550 \
test551 test552 test1016 test1017 test1018 test1019 test1020
test551 test552 test1016 test1017 test1018 test1019 test1020 test553
filecheck:
@mkdir test-place; \

67
tests/data/test553 Normal file

File diff suppressed because one or more lines are too long

View File

@ -5,7 +5,7 @@
# | (__| |_| | _ <| |___
# \___|\___/|_| \_\_____|
#
# Copyright (C) 1998 - 2007, Daniel Stenberg, <daniel@haxx.se>, et al.
# Copyright (C) 1998 - 2008, Daniel Stenberg, <daniel@haxx.se>, et al.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution. The terms
@ -48,7 +48,7 @@ noinst_PROGRAMS = lib500 lib501 lib502 lib503 lib504 lib505 lib506 \
lib507 lib508 lib509 lib510 lib511 lib512 lib513 lib514 lib515 lib516 \
lib517 lib518 lib519 lib520 lib521 lib523 lib524 lib525 lib526 lib527 \
lib529 lib530 lib532 lib533 lib536 lib537 lib540 lib541 lib542 lib543 \
lib544 lib545 lib547 lib548 lib549 lib552
lib544 lib545 lib547 lib548 lib549 lib552 lib553
# Dependencies (may need to be overriden)
LDADD = $(LIBDIR)/libcurl.la
@ -147,3 +147,5 @@ lib548_CFLAGS = -DLIB548
lib549_SOURCES = lib549.c $(SUPPORTFILES)
lib552_SOURCES = lib552.c $(SUPPORTFILES)
lib553_SOURCES = lib553.c $(SUPPORTFILES)

74
tests/libtest/lib553.c Normal file
View File

@ -0,0 +1,74 @@
/*****************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
* / __| | | | |_) | |
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* $Id$
*
* This test case and code is based on the bug recipe Joe Malicki provided for
* bug report #1871269, fixed on Jan 14 2008 before the 7.18.0 release.
*/
#include "test.h"
#define POSTLEN 40960
static size_t myreadfunc(void *ptr, size_t size, size_t nmemb, void *stream)
{
static size_t total=POSTLEN;
static char buf[1024];
(void)stream;
memset(buf, 'A', sizeof(buf));
size *= nmemb;
if (size > total)
size = total;
if(size > sizeof(buf))
size = sizeof(buf);
memcpy(ptr, buf, size);
total -= size;
return size;
}
#define NUM_HEADERS 8
#define SIZE_HEADERS 5000
static char buf[SIZE_HEADERS + 100];
int test(char *URL)
{
CURL *curl;
CURLcode res;
int i;
struct curl_slist *headerlist=NULL;
curl_global_init(CURL_GLOBAL_ALL);
curl = curl_easy_init();
for (i = 0; i < NUM_HEADERS; i++) {
int len;
len = sprintf(buf, "Header%d: ", i);
memset(&buf[len], 'A', SIZE_HEADERS);
buf[len + SIZE_HEADERS]=0; /* zero terminate */
headerlist = curl_slist_append(headerlist, buf);
}
headerlist = curl_slist_append(headerlist, "Expect: ");
curl_easy_setopt(curl, CURLOPT_URL, URL);
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headerlist);
curl_easy_setopt(curl, CURLOPT_POST, 1);
curl_easy_setopt(curl, CURLOPT_POSTFIELDSIZE, POSTLEN);
curl_easy_setopt(curl, CURLOPT_VERBOSE, 1);
curl_easy_setopt(curl, CURLOPT_HEADER, 1);
curl_easy_setopt(curl, CURLOPT_READFUNCTION, myreadfunc);
res = curl_easy_perform(curl);
curl_easy_cleanup(curl);
curl_slist_free_all(headerlist);
return (int)res;
}