I'm developing an application in which I use libcurl.
I added in my c code the following curl option:
curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);
in order to follow http redirection.
when my application send a http message (first http message), it receives a http 302 redirect from the server, the libcurl detect with success the redirect information and then send another http message (second http message) to the new url but the new http message is not the same comparing to the first http message.
How I can make libcurl sending the same HTTP message?
First http message: communication between my application and the first server till the application get the http redirect message
application ----> server1
POST / HTTP/1.1
Host: 192.168.1.15
Accept: */*
User-Agent: cwmp
Content-Type: text/xml
Content-Length: 341
Expect: 100-continue
server1 ----> application
HTTP/1.1 100 Continue
application ----> server1
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<soap_env:Envelope
xmlns:soap_env="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:soap_enc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soap_env:Header>
<cwmp:ID soap_env:mustUnderstand="1" />
</soap_env:Header>
<soap_env:Body>
<any:command>any_command_value</any:command>
</soap_env:Body>
</soap_env:Envelope>
server1 ----> application (redirect message)
HTTP/1.1 302 Found
Date: Tue, 13 May 2014 11:00:48 GMT
Server: Apache/2.4.7 (Win32) PHP/5.5.8
X-Powered-By: PHP/5.5.8
Location: http://192.168.1.133:8080/openserv/serv
Content-Length: 0
Content-Type: text/html
Second http message: http message sent by my application to the second server after receiving the http redirect
application ---> server2
GET /openserv/serv HTTP/1.1
Host: 192.168.1.133:8080
Accept: */*
User-Agent: cwmp
Content-Type: text/xml