OSDN Git Service

・書き込み時の新しい「書きこみ&クッキー」メッセージに対応
[gikonavigoeson/gikonavi.git] / Dolib.pas
index b773ec6..a4ac2f3 100644 (file)
--- a/Dolib.pas
+++ b/Dolib.pas
@@ -33,7 +33,7 @@ unit Dolib;
 interface
 
 uses
-       Windows, SysUtils, WinInet;
+       Windows, SysUtils, WinInet, YofUtils;
 
 type
        TDolibSession = class(TObject)
@@ -65,12 +65,12 @@ type
                function GetErrorMsg: string;
                procedure MakeError(Session: TDolibSession; Error: DWORD);
                procedure DOLIB_LOGIN(Proxy: string; Port: Integer; ID: string; Pass: string);
-        procedure ForcedDOLIB_LOGIN(Proxy: string; Port: Integer; ID: string; Pass: string);
+               procedure ForcedDOLIB_LOGIN(Proxy: string; Port: Integer; ID: string; Pass: string);
        public
                constructor Create;
                destructor  Destroy; override;
                function  Connect: boolean;
-        function  ForcedConnect: boolean;   //SSL\8fá\8aQ\97p\8b­\90§\83\8d\83O\83C\83\93
+               function  ForcedConnect: boolean;   //SSL\8fá\8aQ\97p\8b­\90§\83\8d\83O\83C\83\93
                function  Disconnect: boolean;
                property  ProxyAddress: string  read  FProxyAddress write FProxyAddress;
                property  ProxyPort: integer  read  FProxyPort  write FProxyPort;
@@ -89,12 +89,13 @@ implementation
 const
        DOLIB_VERSION       = $10000;
        DOLIB_LOGIN_UA      = 'DOLIB/1.00';
-       DOLIB_LOGIN_HOST    = 'tiger2.he.net';
-       DOLIB_LOGIN_URL     = '/~tora3n2c/futen.cgi';
+       DOLIB_LOGIN_HOST    = '2chv.tora3.net';
+       DOLIB_LOGIN_URL     = '/futen.cgi';
        DOLIB_2CH_UA        = 'X-2ch-UA:';
 //     DOLIB_2CH_UA        = 'X-2ch-UA: gikoNavi/1.00'#13#10;
        DOLIB_ENOMEM_STRING = '\83\81\83\82\83\8a\82ª\91«\82è\82Ü\82¹\82ñ\81B';
        DOLIB_LOGIN_ERROR   = 'ERROR:';
+// https://2chv.tora3.net/futen.cgi
 
 { TDolib }
 
@@ -226,6 +227,7 @@ var
        Buf: array[0..4096] of Char;
        UserInfo: string;
        UserAgent: string;
+    Header: string;
        cb: DWORD;
        Delim: Integer;
 begin
@@ -254,9 +256,11 @@ begin
                        if not Assigned(hRequest) then
                                MakeError(FSession, GetLastError())
                        else begin
-                               UserInfo := Format('ID=%s&PW=%s', [ID, Pass]);
+                               UserInfo := Format('ID=%s&PW=%s', [HttpEncode(ID), HttpEncode(Pass)]);
+                Header := 'Content-Type: application/x-www-form-urlencoded'#13#10;
                                UserAgent := Format('%s %s', [DOLIB_2CH_UA, ClientUA]) + #13#10;
-                               if not HttpSendRequest(hRequest, PChar(UserAgent), DWORD(-1), PChar(UserInfo), Length(UserInfo)) then
+                Header := Header + UserAgent;
+                               if not HttpSendRequest(hRequest, PChar(Header), DWORD(-1), PChar(UserInfo), Length(UserInfo)) then
                                        MakeError(FSession, GetLastError())
                                else begin
                                        if not InternetReadFile(hRequest, @Buf, SizeOf(Buf), cb) then