curl-library
HTTP Post seems to send headers and content separately - slow
Date: Tue, 20 Apr 2004 17:01:15 +0100
On HPUX 11.00
libCurl 7.10.5
When I post to my http server from C++, there seems to be two separate sends
done
over the socket with a big delay between them (around 70mS). Note in the
output below
no mention of the content (although maybe this is normal)
------- output from client libCurl with verbose option ------------
* About to connect() to localhost:35000
* Connected to localhost (127.0.0.1) port 35000
> POST / HTTP/1.1
Host: localhost:35000
Pragma: no-cache
Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, */*
Content-Type: text/xml
Content-Length: 439
< HTTP/1.1 200 OK
< Server: webserv
< Keep-Alive: timeout=60, max=100
< Connection: Keep-Alive
< Date: Fri, 17 Jul 1998 19:55:08 GMT
< Content-Type: text/xml
< Content-Length: 421
* Connection #0 left intact
----------- end of output -------------
I have made the same post request with my own java program using the Apache
XMLRPC
java package and with a sample Java test application that I downloaded
(paste the http
request into a window) and both work fine, ie: all data either sent in one
shot or else sent
in two but with no delay between them
------- code snippet --------------
char *url = argv[1];
char *request = (char *)"<?xml
version=\"1.0\"?><methodCall><methodName>ScriptsHandler.getCreditBalance</me
thodName></methodCall>";
CURL *curl = curl_easy_init();
curl_slist *headers = NULL;
headers = curl_slist_append(headers, "Content-Type: text/xml");
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, request);
curl_easy_setopt(curl, CURLOPT_POSTFIELDSIZE, strlen(request));
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(curl, CURLOPT_VERBOSE, true);
curl_easy_setopt(curl, CURLOPT_URL, url);
curl_easy_perform(curl);
------- End of code snippet --------------
Any help would be appreciated,
Fergus McCann
Received on 2004-04-20