delphi nethttpclient操作cookie
2024-08-28 19:49:56
delphi nethttpclient操作cookie
unit Unit1; interface uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, System.Net.URLClient,
System.Net.HttpClient, System.Net.HttpClientComponent; type
TForm1 = class(TForm)
NetHTTPClient1: TNetHTTPClient;
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end; var
Form1: TForm1; implementation {$R *.dfm} procedure TForm1.FormCreate(Sender: TObject);
var
cookie: TCookie;
begin
for cookie in NetHTTPClient1.CookieManager.Cookies do
begin if (cookie.Domain = 'www.server.com') and (cookie.Name = 'test') then
begin
//
end;
end;
end; end.
TCookie:
/// <summary>Cookie record.</summary>
TCookie = record
private
class function StrExpiresToDateTime(const AStrDate: string): TDateTime; static;
public
/// <summary>Cookie Name</summary>
Name: string;
/// <summary>Cookie Value</summary>
Value: string;
/// <summary>Cookie Expires. It's the date when the cookie will expire</summary>
/// <remarks>When Expires is 0 means a session cookie.</remarks>
Expires: TDateTime;
/// <summary>Cookie Domain</summary>
Domain: string;
/// <summary>Cookie Path</summary>
Path: string;
/// <summary>Cookie Secure</summary>
/// <remarks>If True then the cookie will be sent if https scheme is used</remarks>
Secure: Boolean;
/// <summary>Cookie HttpOnly</summary>
/// <remarks>If True then the cookie will not be used in javascript, it's browser dependant.</remarks>
HttpOnly: Boolean; /// <summary>Return the cookie as string to be send to the server</summary>
function ToString: string;
/// <summary>Return a TCookie parsing ACookieData based on the URI param</summary>
class function Create(const ACookieData: string; const AURI: TURI): TCookie; static;
end;
最新文章
- 开放式管理基础结构 OMI
- PAT/进制转换习题集
- linux启动jmeter,执行./jmeter.sh报错解决方法
- [整理]android中几种常见的尺寸
- spring mvc超强的json支持,你自己根本不需要额外的配置。spring mvc都给你配置好了!!!
- robot.libdocpkg package
- 使用Cross-validation (CV) 调整Extreme learning Machine (ELM) 最优参数的实现(matlab)
- MLlib-协同过滤
- oracle 非数字型转数字型
- OpenSUSE13.2安装MongoDB
- Microsoft Visual Studio 2015 python 安装 mysql-python 出错解决
- libcrypto.so.1.0.0内容丢失导致sshd无法运行解决方案
- sqlserver 数据库关于存储xml字段里内容的查找与替换
- 用 Django 管理现有数据库
- Django Redis存储session会话
- bash脚本里su命令执行
- SQL基础--查询之一--单表查询
- discuz安装,uc_server目录下乱码问题:
- cocoapod 最新安装使用步骤
- input 隐藏边框
热门文章
- MySQL: Can’t connect to MySQL server on (111 “Connection refused”)
- Hadoop集群搭建(cluster setup),ssh免密后一直要求输入密码的原因
- php使用播放插件播放m3u8,mp4,flv格式的视频
- Codeforces 850C E. Arpa and a game with Mojtaba
- Ubuntu18.0 解决python虚拟环境中不同用户下或者python多版本环境中指定虚拟环境的使用问题
- 用python文件操作实现复制图片、视频
- 用js刷剑指offer(用两个栈实现队列)
- webpack中css文件的代码分割
- Java数组复制、遍历、反转
- Selenium(九)测试用例数据分离与从文件导入数据