Commit 9586faa3 authored by Benito van der Zander's avatar Benito van der Zander

more work on cookies

parent 5c8507fc
......@@ -856,6 +856,7 @@ TProcessingContext = class(TDataProcessing)
proxy: string;
printReceivedHeaders: boolean;
errorHandling: string;
loadCookies, saveCookies: string;
silent, printPostData: boolean;
......@@ -1238,6 +1239,10 @@ var
if not allowInternetAccess then raise EXidelException.Create('Internet access not permitted');
if assigned(onPrepareInternet) then internet := onPrepareInternet(parent.userAgent, parent.proxy, @parent.httpReact);
if (parent.loadCookies <> '') then begin
parent.loadCookies := ''; //only need to load them once?
escapedURL := url;
if not rawURL then escapedURL := urlHexEncode(url, [#32..#126]); // fn:escape-html-uri
parent.printStatus('**** Retrieving ('+method+'): '+escapedURL+' ****');
......@@ -1816,6 +1821,8 @@ begin
//'method', method); moved to'print-received-headers', printReceivedHeaders);'error-handling', errorHandling);'load-cookies', loadCookies);'save-cookies', saveCookies);
if'output-encoding', tempstr) then setOutputEncoding(tempstr); //allows object returned by extract to change the output-encoding
......@@ -2154,6 +2161,9 @@ begin
else result.merge(res);
if (saveCookies <> '') and (internet <> nil) then internet.cookies.saveToFile(saveCookies);;
......@@ -3536,6 +3546,8 @@ begin
mycmdLine.declareString('method', 'HTTP method to use (e.g. GET, POST, PUT)', 'GET');
mycmdLine.declareString('header', 'Additional header to include (e.g. "Set-Cookie: a=b"). Can be used multiple times like --post.'); mycmdline.addAbbreviation('H');
mycmdLine.declareString('load-cookies', 'Load cookies from file');
mycmdLine.declareString('save-cookies', 'Save cookies to file');
mycmdLine.declareFlag('print-received-headers', 'Print the received headers');
mycmdLine.declareString('error-handling', 'How to handle http errors, e.g. 1xx=retry,200=accept,3xx=redirect,4xx=abort,5xx=skip');
mycmdLine.declareFlag('raw-url', 'Do not escape the url (preliminary)');
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment