Just wonder does libcurl able to get response from wicket ajax function in a web page? As I want to upload file into a web server but need parameter that receive when loading the web page. This is the curl command/url response from wicket ajax;
curl "https://192.168.10.167/ui/backup/upload?3-2.IBehaviorListener.0-resumableUploadPanel-storageFile-0-item~status-status~container^&_=1601452951304" -H "Connection: keep-alive" -H "Accept: application/xml, text/xml, */*; q=0.01" -H "X-Requested-With: XMLHttpRequest" -H "Wicket-Ajax-BaseURL: backup/upload?3" -H "Wicket-Ajax: true" -H "User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.70 Safari/537.36" -H "Sec-Fetch-Site: same-origin" -H "Sec-Fetch-Mode: cors" -H "Referer: https://192.168.10.167/ui/backup/upload?3" -H "Accept-Encoding: gzip, deflate, br" -H "Accept-Language: en-US,en;q=0.9" -H "Cookie: JSESSIONID=7D6307648979389393C" --compressed --insecure &
What I need is 1601452951304.
I try to just got to that page, put redirect command and retrieve the redirect url with these code:
curl_easy_setopt(curl, CURLOPT_URL,"https://192.168.10.167/ui/backup/upload");
curl_easy_setopt(curl, CURLOPT_HEADER, "Accept: application/xml, text/xml, */*; q=0.01");
curl_easy_setopt(curl, CURLOPT_ENCODING, "gzip, deflate, br");
curl_easy_setopt(curl, CURLOPT_HEADER, "Accept-Language: en-US,en;q=0.9");
curl_easy_setopt(curl, CURLOPT_HEADER, "Connection: keep-alive");
curl_easy_setopt(curl, CURLOPT_HEADER, "Host: 192.168.10.167");
curl_easy_setopt(curl, CURLOPT_HEADER, "Sec-Fetch-Mode: cors");
curl_easy_setopt(curl, CURLOPT_HEADER, "Sec-Fetch-Site: same-origin");
curl_easy_setopt(curl, CURLOPT_HEADER, "User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.70 Safari/537.36");https://192.168.10.167/ui/backup/upload?7");
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0);
curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L);
curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1);
res = curl_easy_perform(curl);
if(res == CURLE_OK) {
char *url = NULL;
curl_easy_getinfo(curl, CURLINFO_EFFECTIVE_URL, &url);
if(url)
printf("Redirect to: %s\n", url);
}
but received these error:
And this is the function that I found in webpage that generate the url:
</script>
<script type="text/javascript" >
/*<![CDATA[*/
Wicket.Event.add(window, "load", function(event) {
Wicket.Timer.set('ide', function(){Wicket.Ajax.ajax({"u":"./upload?3-3.IBehaviorListener.0-resumableUploadPanel-storageFile-0-item~status-status~container","c":"ide"});}, 1000);;
Wicket.Timer.set('id7', function(){Wicket.Ajax.ajax({"u":"./upload?3-3.IBehaviorListener.0-resumableUploadPanel-agentRegisterCheck","c":"id7"});}, 5000);;
;});
/*]]>*/
</script>
There is no Cookie for the JSESSIONID in your curl_easy_xyz snippet.
Wicket Ajax usually makes the page stateful and thus bind an http session.
1601452951304
is just a timestamp that is added by jQuery (Wicket uses it internally) to make the request non-cacheable by the browser. So you can use any random key/value pair instead of it.