cURL command line and send multiple request through the same connection? - web-services

I've to send too many request to a webservice. I can't send all the data in a big single request because of server limitations. I used to use cURL to do a POST request, but in this case cURL will set up and close a different connection for each sending.
Is there any way that cURL reuse a connection for multiple requests? Is there any alternative, e.g. wget, that could achieve this purpose?
I'd rather be able to avoid use a Perl homemade solution with XML::Compile::WSDL11.

Enable HTTP/1.1 Keep-Alive. See lwptut and LWP::ConnCache.

Related

How to capture HTTP and URL data, using a C++ application, from a client request

I have a CGI exe application running on IIS. A client (localhost:8080 for testing) can make a request to the server with any application name (e.g. home, store, account, etc...) and any additional queries (e.g. ?test=1&magic=2). Currently, the exe will load and run the code in it but is unable to receive client input via POST or GET.
I have been recommended to try using WT and similar libraries to capture the HTTP and URL information I need, but I'd like to learn to do it without a separate library.
Using C++, how do I capture HTTP request data from the client, URL parameters, cookie data, etc.. via client GET and POST then store that data in variables and constants for later use?
A CGI app runs as a separate process. It receives client data on stdin, and sends data to the client on stdout. When the webserver receives a client connection, it spawns the CGI process hooking up the connected socket to the stdin and stdout handles.
So, for example, if a client requests http://localhost:8080/home?test=1&magic=2, the CGI's stdin should receive data similar to this:
GET /home?test=1&magic=2 HTTP/1.1
Host: localhost:8080
Cookie: ...
And then it can write to stdout, something like this:
HTTP/1.1 200 OK
Content-Type: desired media type
Content-Length: XXXXX
Set-Cookie: ...
data here
Heres a https server u can compile from src https://bitbucket.org/ptroen/crossplatformnetwork/src/master/OSI/Application/Stub/HTTPSServer/httpsserver.cc
I wrote this and performance is pretty good. See http server if u dont care about encryption. You will need to define two flyweight classes in order to initialize with your specific cgi biz logic.
It supports post put get delete. Havent tested with cookies but wont be hard to implement.

Tandem - Is there an equivalent to cURL in HP NonStop?

I need to execute a simple HTTP POST to a URL from the NonStop computer to make sure a service functions correctly. Is there a way to do this?
Use the built-in TACL commands to make an HTTP POST request. The TACL command POST allows you to send an HTTP POST request to a specified URL. For example:
POST url headers=content-type:text/plain
data=This is the request body

Get Secured cookie from curl after authentication (c++)

How to get secured cookie from curl after authentication?
curl_easy_getinfo(curl_handler, CURLINFO_COOKIELIST, &cookies);
fetched only one cookie, the other secured cookie wasnt fetched.
Same with
curl_easy_setopt(curl_handler, CURLOPT_COOKIEJAR, "cookie.txt");
However in java we could use cookie manager for login and after all the operations if we iterated the cookie manager there were two of them "Cookie" and "_WL_AUTHCOOKIE_JSESSIONID".
In curl i am not able to fetch "_WL_AUTHCOOKIE_JSESSIONID" .
Any help would be appreciated.
First, curl should get the same set of cookies that any other HTTP client gets.
Unfortunately, that is a should as servers sometimes act different depending on which client it thinks it speaks to and thus it may respond differently. Also, since you're comparing with another client it is possible that the java version you see did some more HTTP requests that made it get the second cookie your curl request doesn't.
To minimize the risk for all this, make sure the requests are as similar as possible so that the server cannot spot a difference between your clients and then it should repond identically and you will get the same set of cookies in both cases.
When the curl based client gets both cookies, you can extract them fine with CURLINFO_COOKIELIST just as you want.

How to receive and post with the same connection in curl?

What I need to do is download a page, find a number in the page and multiply it by 4; then send that new number back to the page using POST but with the same connection.
I was doing this completely fine with curl and C++ but two connections. Is there a way to do this with only one connection in curl?
I tried reading the curl --help but I didn't know what to look for and didn't see how to do it.

Is there a debugging tool that echos back your HTTP request?

I swear I saw this once:
A website that just echoes back the request info (headers, url, method, params, etc) of all requests that come in.
Sort of like the opposite of hurl.it
Found it: httpbin is a webservice for testing http clients.
the response just tells you the request it received.
You could also try Fiddler if you want a desktop application for doing this!