Generate alphanumerical random strings.
Prior this change curl used to create random hex strings. This was
mostly okay, but having alphanumerical random strings is better: The
strings have more entropy in the same space.
The MIME multipart boundary used to be mere 64-bits of randomness due
to being 16 hex chars. With these changes the boundary is 22
alphanumerical chars, or little over 130 bits of randomness.
Closes #11838
fclose(*fh);
*fh = NULL;
- result = Curl_rand_hex(data, randsuffix, sizeof(randsuffix));
+ result = Curl_rand_alnum(data, randsuffix, sizeof(randsuffix));
if(result)
goto fail;
mime->lastpart = NULL;
memset(mime->boundary, '-', MIME_BOUNDARY_DASHES);
- if(Curl_rand_hex(easy,
- (unsigned char *) &mime->boundary[MIME_BOUNDARY_DASHES],
- MIME_RAND_BOUNDARY_CHARS + 1)) {
+ if(Curl_rand_alnum(easy,
+ (unsigned char *) &mime->boundary[MIME_BOUNDARY_DASHES],
+ MIME_RAND_BOUNDARY_CHARS + 1)) {
/* failed to get random separator, bail out */
free(mime);
return NULL;
#include "curl_setup.h"
#define MIME_BOUNDARY_DASHES 24 /* leading boundary dashes */
-#define MIME_RAND_BOUNDARY_CHARS 16 /* Nb. of random boundary chars. */
+#define MIME_RAND_BOUNDARY_CHARS 22 /* Nb. of random boundary chars. */
#define MAX_ENCODED_LINE_LENGTH 76 /* Maximum encoded line length. */
#define ENCODING_BUFFER_SIZE 256 /* Encoding temp buffers size. */
/* set initial values for the CONNECT packet */
pos = init_connpack(packet, remain, remain_pos);
- result = Curl_rand_hex(data, (unsigned char *)&client_id[clen],
- MQTT_CLIENTID_LEN - clen + 1);
+ result = Curl_rand_alnum(data, (unsigned char *)&client_id[clen],
+ MQTT_CLIENTID_LEN - clen + 1);
/* add client id */
rc = add_client_id(client_id, strlen(client_id), packet, pos + 1);
if(rc) {
#include "curl_setup.h"
+#include <limits.h>
+
#ifdef HAVE_FCNTL_H
#include <fcntl.h>
#endif
return result;
}
+
+/*
+ * Curl_rand_alnum() fills the 'rnd' buffer with a given 'num' size with random
+ * alphanumerical chars PLUS a null-terminating byte.
+ */
+
+static const char alnum[26 + 26 + 10] =
+ "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
+
+CURLcode Curl_rand_alnum(struct Curl_easy *data, unsigned char *rnd,
+ size_t num)
+{
+ CURLcode result = CURLE_OK;
+ const int alnumspace = sizeof(alnum);
+ unsigned int r;
+ DEBUGASSERT(num > 1);
+
+ num--; /* save one for null-termination */
+
+ while(num) {
+ do {
+ result = randit(data, &r);
+ if(result)
+ return result;
+ } while(r >= (UINT_MAX - UINT_MAX % alnumspace));
+
+ *rnd++ = alnum[r % alnumspace];
+ num--;
+ }
+ *rnd = 0;
+
+ return result;
+}
CURLcode Curl_rand_hex(struct Curl_easy *data, unsigned char *rnd,
size_t num);
+/*
+ * Curl_rand_alnum() fills the 'rnd' buffer with a given 'num' size with random
+ * alphanumerical chars PLUS a null-terminating byte.
+ */
+CURLcode Curl_rand_alnum(struct Curl_easy *data, unsigned char *rnd,
+ size_t num);
+
#ifdef WIN32
/* Random generator shared between the Schannel vtls and Curl_rand*()
functions */
Host: %HOSTIP:%HTTPPORT\r
User-Agent: curl/%VERSION\r
Accept: */*\r
-Content-Length: 410\r
+Content-Length: 434\r
Content-Type: multipart/form-data; boundary=----------------------------9ef8d6205763\r
\r
------------------------------9ef8d6205763\r
Host: %HOSTIP:%HTTPPORT\r
User-Agent: curl/%VERSION\r
Accept: */*\r
-Content-Length: 410\r
+Content-Length: 434\r
Content-Type: multipart/form-data; boundary=----------------------------9ef8d6205763\r
\r
------------------------------9ef8d6205763\r
Host: %HOSTIP:%HTTPPORT\r
User-Agent: curl/%VERSION\r
Accept: */*\r
-Content-Length: 1264\r
+Content-Length: 1324\r
Content-Type: multipart/form-data; boundary=----------------------------24e78000bd32\r
\r
------------------------------24e78000bd32\r
Host: %HOSTIP:%HTTPPORT\r
User-Agent: curl/%VERSION\r
Accept: */*\r
-Content-Length: 958\r
+Content-Length: 1006\r
Content-Type: multipart/form-data; boundary=----------------------------24e78000bd32\r
\r
------------------------------24e78000bd32\r
Host: %HOSTIP:%HTTPPORT\r
User-Agent: curl/%VERSION\r
Accept: */*\r
-Content-Length: 954\r
+Content-Length: 1002\r
Content-Type: multipart/form-data; boundary=----------------------------24e78000bd32\r
\r
------------------------------24e78000bd32\r
# Verify data after the test has been "shot"
<verify>
<strippart>
-s/^--------------------------[a-z0-9]*/------------------------------/
-s/boundary=------------------------[a-z0-9]*/boundary=----------------------------/
+s/^--------------------------[A-Za-z0-9]*/------------------------------/
+s/boundary=------------------------[A-Za-z0-9]*/boundary=----------------------------/
</strippart>
<protocol>
EHLO %TESTNUMBER\r
Host: %HOSTIP:%HTTPPORT\r
User-Agent: curl/%VERSION\r
Accept: */*\r
-Content-Length: 1186\r
+Content-Length: 1240\r
Content-Type: multipart/form-data; boundary=----------------------------24e78000bd32\r
\r
------------------------------24e78000bd32\r
# Verify data after the test has been "shot"
<verify>
<strippart>
-s/^--------------------------[a-z0-9]*/------------------------------/
-s/boundary=------------------------[a-z0-9]*/boundary=----------------------------/
+s/^--------------------------[A-Za-z0-9]*/------------------------------/
+s/boundary=------------------------[A-Za-z0-9]*/boundary=----------------------------/
</strippart>
<protocol>
POST /%TESTNUMBER HTTP/1.1\r
Host: %HOSTIP:%HTTPPORT\r
User-Agent: curl/%VERSION\r
Accept: */*\r
-Content-Length: 126\r
+Content-Length: 138\r
Content-Type: multipart/form-data; boundary=----------------------------\r
\r
------------------------------\r
Host: %HOSTIP:%HTTPPORT\r
User-Agent: curl/%VERSION\r
Accept: */*\r
-Content-Length: 797\r
+Content-Length: 845\r
Content-Type: multipart/form-data; boundary=----------------------------9ef8d6205763\r
\r
------------------------------9ef8d6205763\r
Host: %HOSTIP:%HTTPPORT\r
User-Agent: curl/%VERSION\r
Accept: */*\r
-Content-Length: 882\r
+Content-Length: 930\r
Content-Type: multipart/form-data; boundary=----------------------------9ef8d6205763\r
\r
------------------------------9ef8d6205763\r
Host: %HOSTIP:%HTTPPORT\r
User-Agent: curl/%VERSION\r
Accept: */*\r
-Content-Length: 145\r
+Content-Length: 157\r
Content-Type: multipart/form-data; boundary=----------------------------4f12fcdaa3bc\r
\r
------------------------------4f12fcdaa3bc\r
Host: %HOSTIP:%HTTPPORT\r
User-Agent: curl/%VERSION\r
Accept: */*\r
-Content-Length: 304\r
+Content-Length: 322\r
Content-Type: multipart/form-data; boundary=----------------------------c2d1767eb6ac\r
\r
------------------------------c2d1767eb6ac\r
Host: %HOSTIP:%HTTPPORT\r
User-Agent: curl/%VERSION\r
Accept: */*\r
-Content-Length: 223\r
+Content-Length: 235\r
Content-Type: multipart/form-data; boundary=----------------------------b0b3d6d23991\r
\r
------------------------------b0b3d6d23991\r
Host: %HOSTIP:%HTTPPORT\r
User-Agent: curl/%VERSION\r
Accept: */*\r
-Content-Length: 360\r
+Content-Length: 378\r
Content-Type: multipart/form-data; boundary=----------------------------5dbea401cd8c\r
\r
------------------------------5dbea401cd8c\r
Host: %HOSTIP:%HTTPPORT\r
User-Agent: curl/%VERSION\r
Accept: */*\r
-Content-Length: 320\r
+Content-Length: 338\r
Content-Type: multipart/form-data; boundary=----------------------------212d9006ceb5\r
\r
------------------------------212d9006ceb5\r
Authorization: AWS4-HMAC-SHA256 Credential=xxx/19700101/us-east-1/s3/aws4_request, SignedHeaders=content-type;host;x-amz-content-sha256;x-amz-date, Signature=eaee0f1c5984ad5d81c8bc7805f28c7b83b35322de654b2ace18cb8cf6d5a9cb\r
X-Amz-Date: 19700101T000000Z\r
x-amz-content-sha256: UNSIGNED-PAYLOAD\r
-Content-Length: 142\r
+Content-Length: 154\r
\r
---------------------------3433323135333231\r
+--------------------------qrstuvwxyz0123456789AB\r
Content-Disposition: attachment; name="foo"\r
\r
bar\r
---------------------------3433323135333231--\r
+--------------------------qrstuvwxyz0123456789AB--\r
</protocol>
</verify>
</testcase>
Host: %HOSTIP:%HTTPPORT\r
User-Agent: curl/%VERSION\r
Accept: */*\r
-Content-Length: 189\r
+Content-Length: 201\r
\r
Content-Disposition: form-data; name="name"; filename="a.pdf"\r
Content-Type: application/pdf\r
Host: %HOSTIP:%HTTPPORT\r
User-Agent: curl/%VERSION\r
Accept: */*\r
-Content-Length: 184\r
+Content-Length: 196\r
\r
Content-Disposition: form-data; name="name"; filename="b.jpg"\r
Content-Type: image/jpeg\r
User-Agent: curl/%VERSION\r
Accept: */*\r
Proxy-Connection: Keep-Alive\r
-Content-Length: 409\r
+Content-Length: 433\r
Content-Type: multipart/form-data; boundary=----------------------------7c633d5c27ce\r
\r
------------------------------7c633d5c27ce\r
User-Agent: curl/%VERSION\r
Accept: */*\r
Proxy-Connection: Keep-Alive\r
-Content-Length: 409\r
+Content-Length: 433\r
Content-Type: multipart/form-data; boundary=----------------------------7c633d5c27ce\r
\r
------------------------------7c633d5c27ce\r
Accept: */*\r
Proxy-Connection: Keep-Alive\r
Expect: 100-continue\r
-Content-Length: 409\r
+Content-Length: 433\r
Content-Type: multipart/form-data; boundary=----------------------------7c633d5c27ce\r
\r
------------------------------7c633d5c27ce\r
Accept: */*\r
Proxy-Connection: Keep-Alive\r
Expect: 100-continue\r
-Content-Length: 409\r
+Content-Length: 433\r
Content-Type: multipart/form-data; boundary=----------------------------7c633d5c27ce\r
\r
------------------------------7c633d5c27ce\r
# Verify data after the test has been "shot"
<verify>
<strippart>
-s/^--------------------------[a-z0-9]*/--------------------------/
-s/boundary=------------------------[a-z0-9]*/boundary=------------------------/
+s/^--------------------------[A-Za-z0-9]*/--------------------------/
+s/boundary=------------------------[A-Za-z0-9]*/boundary=------------------------/
</strippart>
<protocol>
POST /want/%TESTNUMBER HTTP/1.1\r
Host: %HOSTIP:%HTTPPORT\r
User-Agent: curl/%VERSION\r
Accept: */*\r
-Content-Length: 146\r
+Content-Length: 158\r
Content-Type: text/info; boundary=------------------------\r
\r
--------------------------\r
Host: %HOSTIP:%HTTPSPORT\r
User-Agent: curl/%VERSION\r
Accept: */*\r
-Content-Length: 1386\r
-Content-Type: multipart/form-data; boundary=----------------------------c3b2ef7f0bb8\r
+Content-Length: 1410\r
+Content-Type: multipart/form-data; boundary=----------------------------qrstuvwxyz0123456789AB\r
\r
-------------------------------c3b2ef7f0bb8\r
+------------------------------qrstuvwxyz0123456789AB\r
Content-Disposition: form-data; name="name"\r
\r
daniel\r
-------------------------------c3b2ef7f0bb8\r
+------------------------------qrstuvwxyz0123456789AB\r
Content-Disposition: form-data; name="tool"\r
\r
curl\r
-------------------------------c3b2ef7f0bb8\r
+------------------------------qrstuvwxyz0123456789AB\r
Content-Disposition: form-data; name="file"; filename="test%TESTNUMBER.txt"\r
Content-Type: text/plain\r
\r
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
\r
-------------------------------c3b2ef7f0bb8--\r
+------------------------------qrstuvwxyz0123456789AB--\r
</protocol>
</verify>
</testcase>
Host: %HOSTIP:%HTTPPORT\r
User-Agent: curl/%VERSION\r
Accept: */*\r
-Content-Length: 1180\r
+Content-Length: 1234\r
Content-Type: multipart/form-data; boundary=----------------------------24e78000bd32\r
\r
------------------------------24e78000bd32\r
Host: %HOSTIP:%HTTPPORT\r
User-Agent: curl/%VERSION\r
Accept: */*\r
-Content-Length: 408\r
+Content-Length: 432\r
Content-Type: multipart/form-data; boundary=----------------------------7c633d5c27ce\r
\r
------------------------------7c633d5c27ce\r
# Verify data after the test has been "shot"
<verify>
<strippart>
-s/^--------------------------[a-z0-9]*/------------------------------/
-s/boundary=------------------------[a-z0-9]*/boundary=----------------------------/
+s/^--------------------------[A-Za-z0-9]*/------------------------------/
+s/boundary=------------------------[A-Za-z0-9]*/boundary=----------------------------/
</strippart>
# Note that the stripping above removes 12 bytes from every occurrence of the
# boundary string and since 5 of them are in the body contents, we see
POST /%TESTNUMBER HTTP/1.1\r
Host: %HOSTIP:%HTTPPORT\r
Accept: */*\r
-Content-Length: 744\r
+Content-Length: 780\r
Content-Type: multipart/form-data; boundary=----------------------------\r
\r
------------------------------\r
POST /%TESTNUMBER HTTP/1.1\r
Host: %HOSTIP:%HTTPPORT\r
Accept: */*\r
-Content-Length: 758\r
+Content-Length: 794\r
Content-Type: multipart/form-data; boundary=----------------------------\r
\r
------------------------------\r
# Verify data after the test has been "shot"
<verify>
<strippart>
-s/^--------------------------[a-z0-9]*/--------------------------/
-s/boundary=------------------------[a-z0-9]*/boundary=------------------------/
+s/^--------------------------[A-Za-z0-9]*/--------------------------/
+s/boundary=------------------------[A-Za-z0-9]*/boundary=------------------------/
</strippart>
<protocol>
POST /%TESTNUMBER HTTP/1.1\r
Host: %HOSTIP:%HTTPPORT\r
Accept: */*\r
-Content-Length: 144\r
+Content-Length: 156\r
Content-Type: multipart/form-data; boundary=------------------------\r
\r
--------------------------\r
# Verify data after the test has been "shot"
<verify>
<strippart>
-s/^--------------------------[a-z0-9]*/------------------------------/
-s/boundary=------------------------[a-z0-9]*/boundary=----------------------------/
+s/^--------------------------[A-Za-z0-9]*/------------------------------/
+s/boundary=------------------------[A-Za-z0-9]*/boundary=----------------------------/
</strippart>
<protocol>
POST /%TESTNUMBER HTTP/1.1\r
Host: %HOSTIP:%HTTPPORT\r
Accept: */*\r
-Content-Length: 744\r
+Content-Length: 780\r
Content-Type: multipart/form-data; boundary=----------------------------\r
\r
------------------------------\r
# Verify data after the test has been "shot"
<verify>
<strippart>
-s/^--------------------------[a-z0-9]*/------------------------------/
-s/boundary=------------------------[a-z0-9]*/boundary=----------------------------/
+s/^--------------------------[A-Za-z0-9]*/------------------------------/
+s/boundary=------------------------[A-Za-z0-9]*/boundary=----------------------------/
</strippart>
# Note that the stripping above removes 12 bytes from every occurrence of the
# boundary string and since 5 of them are in the body contents, we see
POST /%TESTNUMBER HTTP/1.1\r
Host: %HOSTIP:%HTTPPORT\r
Accept: */*\r
-Content-Length: 640\r
+Content-Length: 676\r
Content-Type: multipart/form-data; boundary=----------------------------\r
\r
------------------------------\r
POST /%TESTNUMBER HTTP/1.1\r
Host: %HOSTIP:%HTTPPORT\r
Accept: */*\r
-Content-Length: 654\r
+Content-Length: 690\r
Content-Type: multipart/form-data; boundary=----------------------------\r
\r
------------------------------\r
# Verify data after the test has been "shot"
<verify>
<strippart>
-s/^--------------------------[a-z0-9]*/------------------------------/
-s/boundary=------------------------[a-z0-9]*/boundary=----------------------------/
+s/^--------------------------[A-Za-z0-9]*/------------------------------/
+s/boundary=------------------------[A-Za-z0-9]*/boundary=----------------------------/
</strippart>
# Note that the stripping above removes 12 bytes from every occurrence of the
# boundary string and since 5 of them are in the body contents, we see
Content-Type: multipart/form-data; boundary=----------------------------\r
Expect: 100-continue\r
\r
-76\r
+%if hyper
+7C\r
+%else
+7c\r
+%endif
------------------------------\r
Content-Disposition: form-data; name="sendfile"; filename="postit2.c"\r
\r
1\r
\r
-65\r
+%if hyper
+6B\r
+%else
+6b\r
+%endif
\r
------------------------------\r
Content-Disposition: form-data; name="callbackdata"\r
\r
%if hyper
-19A\r
+1B2\r
%else
-19a\r
+1b2\r
%endif
\r
------------------------------\r
Content-Type: multipart/form-data; boundary=----------------------------\r
Expect: 100-continue\r
\r
-84\r
+%if hyper
+8A\r
+%else
+8a\r
+%endif
------------------------------\r
Content-Disposition: form-data; name="sendfile alternative"; filename="file name 2"\r
\r
1\r
\r
-65\r
+%if hyper
+6B\r
+%else
+6b\r
+%endif
\r
------------------------------\r
Content-Disposition: form-data; name="callbackdata"\r
\r
%if hyper
-19A\r
+1B2\r
%else
-19a\r
+1b2\r
%endif
\r
------------------------------\r
# Verify data after the test has been "shot"
<verify>
<strippart>
-s/^--------------------------[a-z0-9]*/------------------------------/
-s/boundary=------------------------[a-z0-9]*/boundary=----------------------------/
+s/^--------------------------[A-Za-z0-9]*/------------------------------/
+s/boundary=------------------------[A-Za-z0-9]*/boundary=----------------------------/
</strippart>
<protocol>
EHLO %TESTNUMBER\r
# Verify data after the test has been "shot"
<verify>
<strippart>
-s/^--------------------------[a-z0-9]*/------------------------------/
-s/boundary=------------------------[a-z0-9]*/boundary=----------------------------/
+s/^--------------------------[A-Za-z0-9]*/------------------------------/
+s/boundary=------------------------[A-Za-z0-9]*/boundary=----------------------------/
</strippart>
<protocol>
A001 CAPABILITY\r
A002 LOGIN user secret\r
-A003 APPEND %TESTNUMBER (\Seen) {892}\r
+A003 APPEND %TESTNUMBER (\Seen) {940}\r
A004 LOGOUT\r
</protocol>
<upload>
# Verify data after the test has been "shot"
<verify>
<strippart>
-s/^--------------------------[a-z0-9]*/------------------------------/
-s/boundary=------------------------[a-z0-9]*/boundary=----------------------------/
+s/^--------------------------[A-Za-z0-9]*/------------------------------/
+s/boundary=------------------------[A-Za-z0-9]*/boundary=----------------------------/
</strippart>
<protocol>
EHLO %TESTNUMBER\r
# Verify data after the test has been "shot"
<verify>
<strippart>
-s/^--------------------------[a-z0-9]*/------------------------------/
-s/boundary=------------------------[a-z0-9]*/boundary=----------------------------/
+s/^--------------------------[A-Za-z0-9]*/------------------------------/
+s/boundary=------------------------[A-Za-z0-9]*/boundary=----------------------------/
</strippart>
<protocol>
EHLO %TESTNUMBER\r
</client>
#
-# Verify data after the test has been "shot"
+# Verify data bbter the test has been "shot"
<verify>
<strippart>
-s/^--------------------------[a-z0-9]*/------------------------------/
-s/boundary=------------------------[a-z0-9]*/boundary=----------------------------/
+s/^--------------------------[A-Za-z0-9]*/------------------------------/
+s/boundary=------------------------[A-Za-z0-9]*/boundary=----------------------------/
</strippart>
# Note that the stripping above removes 12 bytes from every occurrence of the
# boundary string and since 5 of them are in the body contents, we see
Content-Type: multipart/form-data; boundary=----------------------------\r
Expect: 100-continue\r
\r
-361\r
+385\r
------------------------------\r
Content-Disposition: form-data; name="fieldname"\r
Content-Type: text/plain\r
\r
\r
%if hyper
-A5\r
+AB\r
%else
-a5\r
+ab\r
%endif
This is data from a file.
\r
\r
\r
%if hyper
-AF\r
+BB\r
%else
-af\r
+bb\r
%endif
This is data from a file.
\r
\r
\r
%if hyper
-10F\r
+11B\r
%else
-10f\r
+11b\r
%endif
This is data from a file.
\r
------------------------------\r
Content-Disposition: form-data; name="formlength"\r
\r
-1367\r
+1433\r
------------------------------\r
Content-Disposition: form-data; name="standardinput"\r
Content-Type: application/octet-stream\r
16\r
Some data from stdin
\r
-30\r
+36\r
\r
--------------------------------\r
\r
Content-Type: multipart/form-data; boundary=----------------------------\r
Expect: 100-continue\r
\r
-361\r
+385\r
------------------------------\r
Content-Disposition: form-data; name="fieldname"\r
Content-Type: text/plain\r
\r
\r
%if hyper
-A5\r
+AB\r
%else
-a5\r
+ab\r
%endif
This is data from a file.
\r
\r
\r
%if hyper
-AF\r
+BB\r
%else
-af\r
+bb\r
%endif
This is data from a file.
\r
\r
\r
%if hyper
-10F\r
+11B\r
%else
-10f\r
+11b\r
%endif
This is data from a file.
\r
------------------------------\r
Content-Disposition: form-data; name="formlength"\r
\r
-1367\r
+1433\r
------------------------------\r
Content-Disposition: form-data; name="standardinput"\r
Content-Type: application/octet-stream\r
16\r
Some data from stdin
\r
-30\r
+36\r
\r
--------------------------------\r
\r
# Verify data after the test has been "shot"
<verify>
<strippart>
-s/^--------------------------[a-z0-9]*/------------------------------/
-s/boundary=------------------------[a-z0-9]*/boundary=----------------------------/
+s/^--------------------------[A-Za-z0-9]*/------------------------------/
+s/boundary=------------------------[A-Za-z0-9]*/boundary=----------------------------/
</strippart>
# Note that the stripping above removes 12 bytes from every occurrence of the
# boundary string and since 5 of them are in the body contents, we see
POST /%TESTNUMBER HTTP/1.1\r
Host: %HOSTIP:%HTTPPORT\r
Accept: */*\r
-Content-Length: 17139\r
+Content-Length: 17151\r
Content-Type: multipart/form-data; boundary=----------------------------\r
\r
------------------------------\r
# Verify data after the test has been "shot"
<verify>
<strippart>
-s/^--------------------------[a-z0-9]*/------------------------------/
-s/boundary=------------------------[a-z0-9]*/boundary=----------------------------/
+s/^--------------------------[A-Za-z0-9]*/------------------------------/
+s/boundary=------------------------[A-Za-z0-9]*/boundary=----------------------------/
</strippart>
<protocol>
EHLO %TESTNUMBER\r
# Verify data after the test has been "shot"
<verify>
<strippart>
-s/^--------------------------[a-z0-9]*/------------------------------/
-s/boundary=------------------------[a-z0-9]*/boundary=----------------------------/
+s/^--------------------------[A-Za-z0-9]*/------------------------------/
+s/boundary=------------------------[A-Za-z0-9]*/boundary=----------------------------/
</strippart>
# Note that the stripping above removes 12 bytes from every occurrence of the
# boundary string and since 5 of them are in the body contents, we see
POST /%TESTNUMBER HTTP/1.1\r
Host: %HOSTIP:%HTTPPORT\r
Accept: */*\r
-Content-Length: 150\r
+Content-Length: 162\r
Content-Type: multipart/form-data; boundary=----------------------------\r
\r
------------------------------\r
POST /%TESTNUMBER HTTP/1.1\r
Host: %HOSTIP:%HTTPPORT\r
Accept: */*\r
-Content-Length: 167\r
+Content-Length: 179\r
Content-Type: multipart/form-data; boundary=----------------------------\r
\r
------------------------------\r
# Verify data after the test has been "shot"
<verify>
<strippart>
-s/^--------------------------[a-z0-9]*/------------------------------/
-s/boundary=------------------------[a-z0-9]*/boundary=----------------------------/
+s/^--------------------------[A-Za-z0-9]*/------------------------------/
+s/boundary=------------------------[A-Za-z0-9]*/boundary=----------------------------/
</strippart>
# Note that the stripping above removes 12 bytes from every occurrence of the
# boundary string and since 5 of them are in the body contents, we see
Expect: 100-continue\r
\r
%if hyper
-1AF\r
+1C1\r
%else
-1af\r
+1c1\r
%endif
------------------------------\r
Content-Disposition: form-data; name="greeting"\r
1\r
\r
-30\r
+36\r
\r
--------------------------------\r
\r
# Verify data after the test has been "shot"
<verify>
<strippart>
-s/^--------------------------[a-z0-9]*/------------------------------/
-s/boundary=------------------------[a-z0-9]*/boundary=----------------------------/
+s/^--------------------------[A-Za-z0-9]*/------------------------------/
+s/boundary=------------------------[A-Za-z0-9]*/boundary=----------------------------/
</strippart>
<protocol>
POST /%TESTNUMBER HTTP/1.1\r
Host: %HOSTIP:%HTTPPORT\r
Accept: */*\r
-Content-Length: 17225\r
+Content-Length: 17237\r
Content-Type: multipart/form-data; boundary=----------------------------\r
\r
------------------------------\r
# Verify data after the test has been "shot"
<verify>
<strippart>
-s/^--------------------------[a-z0-9]*/------------------------------/
-s/boundary=------------------------[a-z0-9]*/boundary=----------------------------/
+s/^--------------------------[A-Za-z0-9]*/------------------------------/
+s/boundary=------------------------[A-Za-z0-9]*/boundary=----------------------------/
</strippart>
# Note that the stripping above removes 12 bytes from every occurrence of the
# boundary string and since 5 of them are in the body contents, we see
Content-Type: multipart/form-data; boundary=----------------------------\r
Expect: 100-continue\r
\r
-%if hyper
-7F\r
-%else
-7f\r
-%endif
+85\r
------------------------------\r
Content-Disposition: form-data; name="field"\r
Content-Transfer-Encoding: base64\r
\r
4\r
ZHVt\r
-34\r
+%if hyper
+3A\r
+%else
+3a\r
+%endif
bXk=\r
--------------------------------\r
\r
<reply>
<data>
HTTP/1.1 200 OK\r
-Date: Tue, 09 Nov 2010 14:49:00 GMT\r
+Date: Tue, 09 Nov 2010 14:4f:00 GMT\r
Server: test-server/fake swsclose\r
Connection: close\r
Content-Type: text/html\r
</data>
<datacheck>
HTTP/1.1 200 OK\r
-Date: Tue, 09 Nov 2010 14:49:00 GMT\r
+Date: Tue, 09 Nov 2010 14:4f:00 GMT\r
Server: test-server/fake swsclose\r
Connection: close\r
Content-Type: text/html\r
# Verify data after the test has been "shot"
<verify>
<strippart>
-s/^--------------------------[a-z0-9]*/------------------------------/
-s/boundary=------------------------[a-z0-9]*/boundary=----------------------------/
+s/^--------------------------[A-Za-z0-9]*/------------------------------/
+s/boundary=------------------------[A-Za-z0-9]*/boundary=----------------------------/
</strippart>
# Note that the stripping above removes 12 bytes from every occurrence of the
# boundary string and since 5 of them are in the body contents, we see
Expect: 100-continue\r
\r
%if hyper
-C1\r
+CD\r
%else
-c1\r
+cd\r
%endif
------------------------------\r
Content-Disposition: form-data; name="field1"\r
\r
5\r
dummy\r
-91\r
+97\r
\r
------------------------------\r
Content-Disposition: form-data; name="field3"; filename="file%TESTNUMBER.txt"\r
Content-Type: text/plain\r
\r
\r
-49\r
+%if hyper
+4F\r
+%else
+4f\r
+%endif
This is data from a file
\r
--------------------------------\r
# Verify data after the test has been "shot"
<verify>
<strippart>
-s/^--------------------------[a-z0-9]*/------------------------------/
-s/boundary=------------------------[a-z0-9]*/boundary=----------------------------/
+s/^--------------------------[A-Za-z0-9]*/------------------------------/
+s/boundary=------------------------[A-Za-z0-9]*/boundary=----------------------------/
</strippart>
<protocol>
POST /we/want/%TESTNUMBER HTTP/1.1\r
Host: %HOSTIP:%HTTPPORT\r
User-Agent: curl/%VERSION\r
Accept: */*\r
-Content-Length: 242\r
+Content-Length: 260\r
Content-Type: multipart/form-data; charset=utf-8; boundary=----------------------------\r
\r
------------------------------\r
# Verify data after the test has been "shot"
<verify>
<strippart>
-s/^--------------------------[a-z0-9]*/------------------------------/
-s/boundary=------------------------[a-z0-9]*/boundary=----------------------------/
+s/^--------------------------[A-Za-z0-9]*/------------------------------/
+s/boundary=------------------------[A-Za-z0-9]*/boundary=----------------------------/
</strippart>
<protocol>
POST /%TESTNUMBER HTTP/1.1\r
Host: %HOSTIP:%HTTPPORT\r
Accept: */*\r
-Content-Length: 142\r
+Content-Length: 154\r
Content-Type: multipart/form-data; boundary=----------------------------\r
\r
------------------------------\r
# Verify data after the test has been "shot"
<verify>
<strippart>
-s/^--------------------------[a-z0-9]*/------------------------------/
-s/boundary=------------------------[a-z0-9]*/boundary=----------------------------/
+s/^--------------------------[A-Za-z0-9]*/------------------------------/
+s/boundary=------------------------[A-Za-z0-9]*/boundary=----------------------------/
</strippart>
<protocol>
POST /%TESTNUMBER HTTP/1.1\r
Host: %HOSTIP:%HTTPPORT\r
Accept: */*\r
-Content-Length: 142\r
+Content-Length: 154\r
Content-Type: multipart/form-data; boundary=----------------------------\r
\r
------------------------------\r
# Verify data after the test has been "shot"
<verify>
<strippart>
-s/^--------------------------[a-z0-9]*/------------------------------/
-s/boundary=------------------------[a-z0-9]*/boundary=----------------------------/
+s/^--------------------------[A-Za-z0-9]*/------------------------------/
+s/boundary=------------------------[A-Za-z0-9]*/boundary=----------------------------/
</strippart>
<protocol>
POST /%TESTNUMBER HTTP/1.1\r
Host: %HOSTIP:%HTTPPORT\r
Accept: */*\r
-Content-Length: 142\r
+Content-Length: 154\r
Content-Type: multipart/form-data; boundary=----------------------------\r
\r
------------------------------\r
# Verify data after the test has been "shot"
<verify>
<strippart>
-s/^--------------------------[a-z0-9]*/------------------------------/
-s/boundary=------------------------[a-z0-9]*/boundary=----------------------------/
+s/^--------------------------[A-Za-z0-9]*/------------------------------/
+s/boundary=------------------------[A-Za-z0-9]*/boundary=----------------------------/
</strippart>
<protocol>
POST /%TESTNUMBER HTTP/1.1\r
Host: %HOSTIP:%HTTPPORT\r
Accept: */*\r
-Content-Length: 142\r
+Content-Length: 154\r
Content-Type: multipart/form-data; boundary=----------------------------\r
\r
------------------------------\r
POST /we/want/%TESTNUMBER HTTP/1.1\r
Host: %HOSTIP:%HTTPPORT\r
Accept: */*\r
-Content-Length: 408\r
+Content-Length: 432\r
Content-Type: multipart/form-data; boundary=----------------------------9ef8d6205763\r
\r
------------------------------9ef8d6205763\r
Host: %HOSTIP:%HTTPPORT\r
User-Agent: curl/%VERSION\r
Accept: */*\r
-Content-Length: 407\r
+Content-Length: 431\r
Content-Type: multipart/form-data; boundary=----------------------------9ef8d6205763\r
\r
------------------------------9ef8d6205763\r
fail_unless(rc == 0, "curl_formget returned error");
- fail_unless(total_size == 488, "curl_formget got wrong size back");
+ fail_unless(total_size == 518, "curl_formget got wrong size back");
curl_formfree(post);
rc = curl_formget(post, &total_size, print_httppost_callback);
fail_unless(rc == 0, "curl_formget returned error");
- fail_unless(total_size == 851, "curl_formget got wrong size back");
+ fail_unless(total_size == 899, "curl_formget got wrong size back");
curl_formfree(post);