| 5 |
uses |
uses |
| 6 |
Windows, Classes, SysUtils, Menus, |
Windows, Classes, SysUtils, Menus, |
| 7 |
IdHTTP, IdComponent, IdGlobal, IdException, |
IdHTTP, IdComponent, IdGlobal, IdException, |
| 8 |
AbonUnit; |
AbonUnit, IdAntiFreezeBase; |
| 9 |
|
|
| 10 |
type |
type |
| 11 |
|
|
| 82 |
|
|
| 83 |
implementation |
implementation |
| 84 |
|
|
| 85 |
uses ExternalBoardManager, ExternalThreadItem, GikoSystem, BoardGroup, Giko; |
uses ExternalBoardManager, ExternalThreadItem, GikoSystem, BoardGroup, Giko, |
| 86 |
|
ReplaceDataModule; |
| 87 |
|
|
| 88 |
// ************************************************************************* |
// ************************************************************************* |
| 89 |
// 戻り値が PChar である API のメモリを確保する |
// 戻り値が PChar である API のメモリを確保する |
| 243 |
LIVEDOOR_URL = 'http://jbbs.livedoor.jp/'; |
LIVEDOOR_URL = 'http://jbbs.livedoor.jp/'; |
| 244 |
begin |
begin |
| 245 |
|
|
| 246 |
|
|
| 247 |
{$IFDEF DEBUG} |
{$IFDEF DEBUG} |
| 248 |
Writeln('ExternalBoardManager.InternalDownload'); |
Writeln('ExternalBoardManager.InternalDownload'); |
| 249 |
{$ENDIF} |
{$ENDIF} |
| 269 |
{$IFDEF DEBUG} |
{$IFDEF DEBUG} |
| 270 |
Writeln('URL: ' + inURL); |
Writeln('URL: ' + inURL); |
| 271 |
{$ENDIF} |
{$ENDIF} |
| 272 |
|
//AntiFreezeをDL時のみ有効にすることで、ココでのチェック不要 |
| 273 |
socket.Get( inURL, resStream ); |
socket.Get( inURL, resStream ); |
| 274 |
{$IFDEF DEBUG} |
{$IFDEF DEBUG} |
| 275 |
Writeln('取得で例外なし'); |
Writeln('取得で例外なし'); |
| 276 |
{$ENDIF} |
{$ENDIF} |
|
|
|
| 277 |
content := GikoSys.GzipDecompress( resStream, socket.Response.ContentEncoding ); |
content := GikoSys.GzipDecompress( resStream, socket.Response.ContentEncoding ); |
| 278 |
|
// 置換する |
| 279 |
|
if GikoSys.Setting.ReplaceDat then begin |
| 280 |
|
content := ReplaceDM.Replace(content); |
| 281 |
|
end; |
| 282 |
|
|
| 283 |
ioModified := socket.Response.LastModified; |
ioModified := socket.Response.LastModified; |
| 284 |
|
|
| 285 |
Result := socket.ResponseCode; |
Result := socket.ResponseCode; |
| 286 |
if (Length( content ) = 0) and (Result = 206) then |
if (Length( content ) = 0) and (Result = 206) then |
| 287 |
Result := 304; |
Result := 304; |
| 288 |
//したらばJBBSはヘッダにエラー情報が載るらしいので、ここでチェック |
//したらばJBBSはヘッダにエラー情報が載るらしいので、ここでチェック |
| 289 |
if ( AnsiPos(LIVEDOOR_URL, inURL) > 0 ) and (Result = 200) then begin |
if ( AnsiPos(LIVEDOOR_URL, inURL) > 0 ) and (Result = 200) then begin |
| 290 |
if( AnsiPos('STORAGE IN', socket.Response.RawHeaders.Text) > 0 ) then begin |
if( AnsiPos('STORAGE IN', socket.Response.RawHeaders.Text) > 0 ) then begin |
| 291 |
Result := 302; |
Result := 302; |