亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? httpsrv.pas

?? 包含常用Internet協議TCP,UDP、HTTP、FTP、Telnet等
?? PAS
?? 第 1 頁 / 共 3 頁
字號:
{*_* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

Author:       Fran鏾is PIETTE
Description:  THttpServer implement the HTTP server protocol, that is a
              web server kernel.
Creation:     Oct 10, 1999
Version:      1.00 BETA
EMail:        http://users.swing.be/francois.piette  francois.piette@swing.be
              http://www.rtfm.be/fpiette             francois.piette@rtfm.be
              francois.piette@pophost.eunet.be
Support:      Use the mailing list twsocket@rtfm.be See website for details.
Legal issues: Copyright (C) 1996-2000 by Fran鏾is PIETTE
              Rue de Grady 24, 4053 Embourg, Belgium. Fax: +32-4-365.74.56
              <francois.piette@pophost.eunet.be><francois.piette@swing.be>

              This software is provided 'as-is', without any express or
              implied warranty.  In no event will the author be held liable
              for any  damages arising from the use of this software.

              Permission is granted to anyone to use this software for any
              purpose, including commercial applications, and to alter it
              and redistribute it freely, subject to the following
              restrictions:

              1. The origin of this software must not be misrepresented,
                 you must not claim that you wrote the original software.
                 If you use this software in a product, an acknowledgment
                 in the product documentation would be appreciated but is
                 not required.

              2. Altered source versions must be plainly marked as such, and
                 must not be misrepresented as being the original software.

              3. This notice may not be removed or altered from any source
                 distribution.

              4. You must register this software by sending a picture postcard
                 to the author. Use a nice stamp and mention your name, street
                 address, EMail address and any comment you like to say.

History:
Nov 12, 1999 Beta 3 Added Linger properties
Apr 23, 2000 Beta 4 Added Delphi 1 compatibility
             Made everything public in THttpConnection because BCB has problems
             when deriving a component from Delphi and protected functions.

{* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *}
unit HttpSrv;

interface

uses
  WinTypes, WinProcs, Messages, SysUtils, Classes, Graphics, Controls, Forms,
  Dialogs, WSocket, WSocketS;

const
    THttpServerVersion = 100;
    CopyRight : String = ' THttpServer (c) 1999-2000 F. Piette V1.00 BETA 4 ';
    WM_HTTP_DONE       = WM_USER + 40;

type
    THttpConnection      = class;
    THttpConnectionClass = class of THttpConnection;
    THttpGetFlag         = (hgSendDoc, hgSendStream, hgWillSendMySelf, hg404, hgAcceptData);
    THttpSendType        = (httpSendHead, httpSendDoc);
    THttpGetEvent        = procedure (Sender    : TObject;
                                      Client    : TObject;
                                      var Flags : THttpGetFlag) of object;
    THttpGetConnEvent    = procedure (Sender    : TObject;
                                      var Flags : THttpGetFlag) of object;
    THttpConnectEvent    = procedure (Sender    : TObject;
                                      Client    : TObject;
                                      Error     : Word) of object;
    THttpPostedDataEvent = procedure (Sender    : TObject;
                                      Client    : TObject;
                                      Error     : Word) of object;
    THttpConnectionState = (hcRequest, hcHeader, hcPostedData);

    { THttpConnection is used to handle client connections }
    THttpConnection = class(TWSocketClient)
    public
        FRcvdLine              : String;
        FMethod                : String;
        FVersion               : String;
        FPath                  : String;
        FParams                : String;
        FRequestHeader         : TStringList;
        FState                 : THttpConnectionState;
        FDocDir                : String;
        FDefaultDoc            : String;
        FDocument              : String;
        FDocStream             : TStream;
        FDocBuf                : PChar;
        FAnswerContentType     : String;
        FRequestContentLength  : Integer;
        FRequestContentType    : String;
        FRequestAccept         : String;
        FRequestReferer        : String;
        FRequestAcceptLanguage : String;
        FRequestAcceptEncoding : String;
        FRequestUserAgent      : String;
        FRequestHost           : String;
        FRequestConnection     : String;
        FAcceptPostedData      : Boolean;
        FOnGetDocument         : THttpGetConnEvent;
        FOnHeadDocument        : THttpGetConnEvent;
        FOnPostDocument        : THttpGetConnEvent;
        FOnPostedData          : TDataAvailable;
        procedure ConnectionDataAvailable(Sender: TObject; Error : Word);
        procedure ConnectionDataSent(Sender : TObject; Error : WORD);
        procedure ParseRequest;
        procedure ProcessRequest;
        procedure ProcessGet;
        procedure ProcessHead;
        procedure ProcessPost;
        procedure SendDocument(SendType : THttpSendType);
        procedure SendStream;
        procedure Answer404;
        procedure WndProc(var MsgRec: TMessage); override;
        procedure WMHttpDone(var msg: TMessage); message WM_HTTP_DONE;
        procedure TriggerGetDocument(var Flags : THttpGetFlag); virtual;
        procedure TriggerHeadDocument(var Flags : THttpGetFlag); virtual;
        procedure TriggerPostDocument(var Flags : THttpGetFlag); virtual;
    public
        constructor Create(AOwner: TComponent); override;
        destructor  Destroy; override;
        { Method contains GET/POST/HEAD as requested by client }
        property Method                    : String read  FMethod;
        { Version contains HTTP version from client request }
        property Version                   : String read  FVersion;
        { The whole header as received from client }
        property RequestHeader             : TStringList
                                                    read  FRequestHeader;
        { Stream used to send reply to client }
        property DocStream                 : TStream
                                                    read  FDocStream
                                                    write FDocStream;
        { All RequestXXX are header fields from request header }
        property RequestContentLength      : Integer
                                                    read  FRequestContentLength;
        property RequestContentType        : String read  FRequestContentType;
        property RequestAccept             : String read  FRequestAccept;
        property RequestReferer            : String read  FRequestReferer;
        property RequestAcceptLanguage     : String read  FRequestAcceptLanguage;
        property RequestAcceptEncoding     : String read  FRequestAcceptEncoding;
        property RequestUserAgent          : String read  FRequestUserAgent;
        property RequestHost               : String read  FRequestHost;
        property RequestConnection         : String read  FRequestConnection;
    published
        { Where all documents are stored. Default to c:\wwwroot }
        property DocDir         : String            read  FDocDir
                                                    write FDocDir;
        { Default document name. Default to index.html }
        property DefaultDoc     : String            read  FDefaultDoc
                                                    write FDefaultDoc;
        { Complete document path and file name on local file system }
        property Document       : String            read  FDocument
                                                    write FDocument;
        { Document path as requested by client }
        property Path           : String            read  FPath
                                                    write FPath;
        { Parameters in request (Question mark is separator) }
        property Params         : String            read  FParams
                                                    write FParams;
        { Triggered when client sent GET request }
        property OnGetDocument  : THttpGetConnEvent read  FOnGetDocument
                                                    write FOnGetDocument;
        { Triggered when client sent HEAD request }
        property OnHeadDocument : THttpGetConnEvent read  FOnHeadDocument
                                                    write FOnHeadDocument;
        { Triggered when client sent POST request }
        property OnPostDocument : THttpGetConnEvent read  FOnPostDocument
                                                    write FOnPostDocument;
        { Triggered when client sent POST request and data is available }
        property OnPostedData   : TDataAvailable    read  FOnPostedData
                                                    write FOnPostedData;
    end;

    { This is the HTTP server component handling all HTTP connection }
    { service. Most of the work is delegated to a TWSocketServer     }
    THttpServer = class(TComponent)
    protected
        { FWSocketServer will handle all client management work }
        FWSocketServer      : TWSocketServer;
        FPort               : String;
        FAddr               : String;
        FClientClass        : THttpConnectionClass;
        FDocDir             : String;
        FDefaultDoc         : String;
        FLingerOnOff        : TSocketLingerOnOff;
        FLingerTimeout      : Integer;              { In seconds, 0 = disabled }
        FOnServerStarted    : TNotifyEvent;
        FOnServerStopped    : TNotifyEvent;
        FOnClientConnect    : THttpConnectEvent;
        FOnClientDisconnect : THttpConnectEvent;
        FOnGetDocument      : THttpGetEvent;
        FOnHeadDocument     : THttpGetEvent;
        FOnPostDocument     : THttpGetEvent;
        FOnPostedData       : THttpPostedDataEvent;
        procedure Notification(AComponent: TComponent; operation: TOperation); override;
        procedure WSocketServerClientConnect(Sender : TObject;
                                             Client : TWSocketClient;
                                             Error  : Word);
        procedure WSocketServerClientCreate(Sender : TObject;
                                            Client : TWSocketClient);
        procedure WSocketServerClientDisconnect(Sender : TObject;
                                                Client : TWSocketClient;
                                                Error  : Word);
        procedure WSocketServerSessionClosed(Sender : TObject;
                                             Error  : Word);
        procedure WSocketServerChangeState(Sender : TObject;
                                           OldState, NewState : TSocketState);
        procedure TriggerServerStarted; virtual;
        procedure TriggerServerStopped; virtual;
        procedure TriggerClientConnect(Client : TObject; Error  : Word);
        procedure TriggerClientDisconnect(Client : TObject; Error : Word);
        procedure TriggerGetDocument(Sender     : TObject;
                                     var Flags  : THttpGetFlag);
        procedure TriggerHeadDocument(Sender     : TObject;
                                      var Flags  : THttpGetFlag);
        procedure TriggerPostDocument(Sender     : TObject;
                                      var Flags  : THttpGetFlag); virtual;
        procedure TriggerPostedData(Sender     : TObject;
                                    Error      : WORD); virtual;
        procedure SetPort(newValue : String);
        procedure SetAddr(newValue : String);
        function  GetClientCount : Integer;
    public
        constructor Create(AOwner: TComponent); override;
        destructor  Destroy; override;
        procedure   Start; virtual;
        procedure   Stop; virtual;
        { Runtime readonly property which gives number of connected clients }
        property    ClientCount : Integer        read GetClientCount;
        { Runtim property which tell the component class which has to be  }
        { instanciated to handle client connection                        }
        property    ClientClass : THttpConnectionClass
                                                 read  FClientClass
                                                 write FClientClass;
    published
        { We will listen to that port. Default to 80 for http service }
        property Port          : String          read  FPort
                                                 write SetPort;
        { We will use that interface to listen. 0.0.0.0 means all     }
        { available interfaces                                        }
        property Addr          : String          read  FAddr
                                                 write SetAddr;
        { Where all documents are stored. Default to c:\wwwroot }
        property DocDir        : String          read  FDocDir
                                                 write FDocDir;
        { Default document name. Default to index.html }
        property DefaultDoc    : String          read  FDefaultDoc
                                                 write FDefaultDoc;
        property LingerOnOff   : TSocketLingerOnOff
                                                 read  FLingerOnOff
                                                 write FLingerOnOff;
        property LingerTimeout : Integer         read  FLingerTimeout
                                                 write FLingerTimeout;
        { OnServerStrated is triggered when server has started listening }
        property OnServerStarted    : TNotifyEvent
                                                 read  FOnServerStarted
                                                 write FOnServerStarted;
        { OnServerStopped is triggered when server has stopped listening }
        property OnServerStopped    : TNotifyEvent
                                                 read  FOnServerStopped
                                                 write FOnServerStopped;
        { OnClientConnect is triggered when a client has connected }
        property OnClientConnect    : THttpConnectEvent
                                                 read  FOnClientConnect
                                                 write FOnClientConnect;
        { OnClientDisconnect is triggered when a client is about to }
        { disconnect.                                               }
        property OnClientDisconnect : THttpConnectEvent
                                                 read  FOnClientDisconnect
                                                 write FOnClientDisconnect;
        { OnGetDocument is triggered when a client sent GET request    }
        { You can either do nothing and let server handle all work, or }
        { you can build a document on the fly or refuse access.        }
        property OnGetDocument      : THttpGetEvent
                                                 read  FOnGetDocument
                                                 write FOnGetDocument;
        { OnGetDocument is triggered when a client sent HEAD request   }
        { You can either do nothing and let server handle all work, or }
        { you can build a document header on the fly or refuse access. }
        property OnHeadDocument     : THttpGetEvent
                                                 read  FOnHeadDocument
                                                 write FOnHeadDocument;
        { OnGetDocument is triggered when a client sent POST request   }
        { You have to tell if you accept data or not. If you accept,   }
        { you'll get OnPostedData event with incomming data.           }
        property OnPostDocument     : THttpGetEvent
                                                 read  FOnPostDocument
                                                 write FOnPostDocument;
        { On PostedData is triggered when client post data and you     }
        { accepted it from OnPostDocument event.                       }
        { When you've got all data, you have to build a reply to be    }
        { sent to client.                                              }
        property OnPostedData       : THttpPostedDataEvent
                                                 read  FOnPostedData
                                                 write FOnPostedData;
    end;

{ Retrieve a single value by name out of an URL encoded data stream.        }
function ExtractURLEncodedValue(
    Msg       : PChar;             { URL Encoded stream                     }
    Name      : String;            { Variable name to look for              }
    var Value : String): Boolean;  { Where to put variable value            }
procedure Register;

implementation


{* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *}
procedure Register;
begin
    RegisterComponents('FPiette', [THttpServer]);
end;


{* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *}
{$IFDEF VER80}
procedure SetLength(var S: string; NewLength: Integer);
begin
    S[0] := chr(NewLength);
end;
{$ENDIF}


{* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *}
{$IFDEF VER80}
function TrimRight(Str : String) : String;
var
    i : Integer;
begin
    i := Length(Str);
    while (i > 0) and (Str[i] = ' ') do
        i := i - 1;
    Result := Copy(Str, 1, i);
end;


{* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *}
function TrimLeft(Str : String) : String;
var
    i : Integer;
begin
    if Str[1] <> ' ' then
        Result := Str
    else begin
        i := 1;
        while (i <= Length(Str)) and (Str[i] = ' ') do
            i := i + 1;
        Result := Copy(Str, i, Length(Str) - i + 1);
    end;
end;


{* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *}
function Trim(Str : String) : String;
begin
    Result := TrimLeft(TrimRight(Str));
end;
{$ENDIF}


{* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *}
constructor THttpServer.Create(AOwner: TComponent);
begin
    inherited Create(AOwner);
    FWSocketServer := TWSocketServer.Create(Self);
    FClientClass   := THttpConnection;
    FAddr          := '0.0.0.0';
    FPort          := '80';
    FDefaultDoc    := 'index.html';
    FDocDir        := 'c:\wwwroot';
    FLingerOnOff   := wsLingerNoSet;
    FLingerTimeout := 0;
end;


{* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *}
destructor THttpServer.Destroy;
begin
    if Assigned(FWSocketServer) then begin
        FWSocketServer.Destroy;
        FWSocketServer := nil;
    end;
    inherited Destroy;
end;

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
99这里只有精品| 久久综合丝袜日本网| a在线播放不卡| 久久99精品国产麻豆婷婷洗澡| 亚洲黄色av一区| 亚洲国产精品国自产拍av| 日韩欧美国产一区在线观看| 欧美综合一区二区| 91在线视频官网| 国产成人精品一区二区三区网站观看| 麻豆91在线观看| 亚欧色一区w666天堂| 亚洲永久精品国产| 一区二区三区在线免费| 中文字幕亚洲电影| 久久亚洲欧美国产精品乐播| 日韩午夜小视频| 欧美一区二区三区在| 91麻豆精品国产91久久久更新时间| 欧亚洲嫩模精品一区三区| 色婷婷综合久久久久中文一区二区| 国产综合久久久久久鬼色| 久久国产精品露脸对白| 久久精品国产在热久久| 蜜桃在线一区二区三区| 制服丝袜中文字幕一区| 99国内精品久久| 欧美中文字幕一区二区三区亚洲| 亚洲第一激情av| 亚洲精品va在线观看| 亚洲老司机在线| 亚洲精品福利视频网站| 国产精品成人午夜| 中文字幕人成不卡一区| 亚洲人成精品久久久久久| 亚洲人一二三区| 一区二区三区在线视频播放| 亚洲高清在线精品| 免费看日韩精品| 国产一区二区三区四区在线观看| 国产呦精品一区二区三区网站| 久久福利视频一区二区| 黄页网站大全一区二区| 国产**成人网毛片九色| 91视视频在线直接观看在线看网页在线看 | 国产成人av影院| 懂色中文一区二区在线播放| www.欧美精品一二区| 亚洲午夜在线观看视频在线| 婷婷国产v国产偷v亚洲高清| 在线观看日韩电影| 国产欧美一区二区在线观看| 日韩一区二区在线观看视频播放| 国产在线视视频有精品| 日韩成人免费电影| 国模少妇一区二区三区| 国产在线精品国自产拍免费| 国产成人在线视频免费播放| 99久久综合狠狠综合久久| 欧美性猛交xxxxxx富婆| 精品日韩一区二区三区免费视频| 欧美国产亚洲另类动漫| 国产亚洲精品aa午夜观看| 亚洲狼人国产精品| 精品一区二区精品| 99国产精品国产精品毛片| 欧美理论片在线| 久久精品在这里| 国产精品二三区| 日本亚洲一区二区| 成人午夜激情影院| 欧美日韩精品一区二区天天拍小说 | 国产精品一级二级三级| 不卡的av在线播放| 久久夜色精品一区| 亚洲女女做受ⅹxx高潮| 亚洲高清在线精品| 国产成人自拍高清视频在线免费播放| 91老司机福利 在线| 精品久久久久久久久久久院品网| 2023国产精品自拍| 午夜精品久久久久久久| 成人高清视频在线观看| 欧美一区二区三区在线观看| **网站欧美大片在线观看| 日韩国产在线一| heyzo一本久久综合| 精品日韩欧美一区二区| 亚洲综合视频在线| 精品亚洲欧美一区| 欧美三区在线观看| 国产精品的网站| 精品一区二区三区在线视频| 色94色欧美sute亚洲13| 日韩女优av电影| 亚洲福利一区二区三区| av激情成人网| 国产日韩在线不卡| 免费视频最近日韩| 精品婷婷伊人一区三区三| 国产精品美女久久久久高潮| 激情综合亚洲精品| 91精品国产高清一区二区三区| 自拍偷自拍亚洲精品播放| 美女视频网站久久| 9191久久久久久久久久久| 一区二区在线观看av| 国产精品一二三四五| 日韩午夜电影在线观看| 午夜精品视频在线观看| 综合久久国产九一剧情麻豆| 成人教育av在线| 午夜精品福利视频网站| 国产午夜三级一区二区三| 国产成人无遮挡在线视频| 国产欧美日韩在线观看| 粉嫩在线一区二区三区视频| 中文字幕欧美区| av欧美精品.com| 一区二区三区.www| 777色狠狠一区二区三区| 欧美a级理论片| 精品剧情v国产在线观看在线| 国产精品99久久久久久有的能看 | 在线视频欧美精品| 五月婷婷久久综合| 精品国产乱码久久久久久久久| 韩国一区二区视频| 国产精品色婷婷久久58| 91丨porny丨最新| 亚洲国产成人av| 日韩精品中文字幕在线不卡尤物 | 麻豆精品精品国产自在97香蕉| 欧美一区午夜精品| 91丨porny丨蝌蚪视频| 国内精品国产三级国产a久久| 国产精品免费观看视频| 日本欧美一区二区三区| 久久一留热品黄| 94-欧美-setu| 三级亚洲高清视频| 欧美刺激午夜性久久久久久久| 国产精品一卡二卡| 一区二区三区成人在线视频| 欧美一区二区三区影视| 国产.精品.日韩.另类.中文.在线.播放| 成人免费一区二区三区视频 | 在线视频你懂得一区二区三区| 日日摸夜夜添夜夜添亚洲女人| 欧美精品一区二| 97国产精品videossex| 免费观看久久久4p| 中文字幕亚洲一区二区av在线| 91精品国产色综合久久不卡电影 | 国产精品久久三区| 欧美日韩日日骚| 国产成人在线视频播放| 亚洲国产精品一区二区久久| 久久久久久久久免费| 欧美网站大全在线观看| 国产精品亚洲视频| 亚洲成人av一区| 国产精品无圣光一区二区| 91麻豆精品国产综合久久久久久| 波多野结衣中文一区| 蜜桃传媒麻豆第一区在线观看| 中文在线资源观看网站视频免费不卡| 欧美日韩久久一区| 99视频精品免费视频| 韩国精品主播一区二区在线观看| 一区二区三区产品免费精品久久75| 久久久国产午夜精品| 欧美日韩dvd在线观看| 99久久婷婷国产| 激情小说亚洲一区| 亚洲第一福利一区| 国产精品久久久久影院| 亚洲精品在线观看网站| 欧美日本一区二区在线观看| fc2成人免费人成在线观看播放| 卡一卡二国产精品| 偷拍一区二区三区| 亚洲精品中文字幕乱码三区| 中文字幕欧美区| 久久久久久免费毛片精品| 日韩欧美国产一区二区三区 | 国产亚洲午夜高清国产拍精品 | 日韩一区二区在线看片| 欧美专区日韩专区| 成人av在线播放网址| 韩国在线一区二区| 蜜桃视频在线观看一区| 日韩电影在线一区| 亚洲国产美女搞黄色| 中文字幕日本不卡| 中文字幕在线一区| 国产精品欧美精品| 国产精品女主播在线观看| 久久久久久**毛片大全| 精品国产伦一区二区三区免费|