mirror of
				https://gitlab.com/freepascal.org/fpc/source.git
				synced 2025-10-31 09:11:53 +01:00 
			
		
		
		
	Read out KeepAlive only if enabled
This commit is contained in:
		
							parent
							
								
									1d18f2fdbf
								
							
						
					
					
						commit
						eaffd1deca
					
				| @ -65,11 +65,7 @@ Type | |||||||
|     FSocket: TSocketStream; |     FSocket: TSocketStream; | ||||||
|     FSetupSocket : Boolean; |     FSetupSocket : Boolean; | ||||||
|     FBuffer : Ansistring; |     FBuffer : Ansistring; | ||||||
| <<<<<<< HEAD |  | ||||||
|     FEnableKeepAlive : Boolean; |     FEnableKeepAlive : Boolean; | ||||||
| ======= |  | ||||||
|     FKeepAliveSupport : Boolean; |  | ||||||
| >>>>>>> TFPCustomHttpServer KeepAlive* properties |  | ||||||
|     FKeepAlive : Boolean; |     FKeepAlive : Boolean; | ||||||
|     FKeepAliveTimeout : Integer; |     FKeepAliveTimeout : Integer; | ||||||
|     procedure InterPretHeader(ARequest: TFPHTTPConnectionRequest; const AHeader: String); |     procedure InterPretHeader(ARequest: TFPHTTPConnectionRequest; const AHeader: String); | ||||||
| @ -89,16 +85,11 @@ Type | |||||||
|     Property Server : TFPCustomHTTPServer Read FServer; |     Property Server : TFPCustomHTTPServer Read FServer; | ||||||
|     Property OnRequestError : TRequestErrorHandler Read FOnError Write FOnError; |     Property OnRequestError : TRequestErrorHandler Read FOnError Write FOnError; | ||||||
|     Property LookupHostNames : Boolean Read GetLookupHostNames; |     Property LookupHostNames : Boolean Read GetLookupHostNames; | ||||||
| <<<<<<< HEAD |  | ||||||
|     // Set to true if you want to support HTTP 1.1 connection: keep-alive - only available for threaded server |     // Set to true if you want to support HTTP 1.1 connection: keep-alive - only available for threaded server | ||||||
|     Property EnableKeepAlive: Boolean read FEnableKeepAlive write FEnableKeepAlive; |     Property EnableKeepAlive: Boolean read FEnableKeepAlive write FEnableKeepAlive; | ||||||
|     // time-out for keep-alive: how many ms should the server keep the connection alive after a request has been handled |     // time-out for keep-alive: how many ms should the server keep the connection alive after a request has been handled | ||||||
|     Property KeepAliveTimeout: Integer read FKeepAliveTimeout write FKeepAliveTimeout; |     Property KeepAliveTimeout: Integer read FKeepAliveTimeout write FKeepAliveTimeout; | ||||||
|     // is the current connection set up for KeepAlive? |     // is the current connection set up for KeepAlive? | ||||||
| ======= |  | ||||||
|     Property KeepAliveSupport: Boolean read FKeepAliveSupport write FKeepAliveSupport; |  | ||||||
|     Property KeepAliveTimeout: Integer read FKeepAliveTimeout write FKeepAliveTimeout; |  | ||||||
| >>>>>>> TFPCustomHttpServer KeepAlive* properties |  | ||||||
|     Property KeepAlive: Boolean read FKeepAlive; |     Property KeepAlive: Boolean read FKeepAlive; | ||||||
|   end; |   end; | ||||||
| 
 | 
 | ||||||
| @ -240,14 +231,10 @@ Type | |||||||
|     Property OnGetSocketHandler : TGetSocketHandlerEvent Read FOnGetSocketHandler Write FOnGetSocketHandler; |     Property OnGetSocketHandler : TGetSocketHandlerEvent Read FOnGetSocketHandler Write FOnGetSocketHandler; | ||||||
|     // Called after create socket handler was created, with the created socket handler. |     // Called after create socket handler was created, with the created socket handler. | ||||||
|     Property AfterSocketHandlerCreate : TSocketHandlerCreatedEvent Read FAfterSocketHandlerCreated Write FAfterSocketHandlerCreated; |     Property AfterSocketHandlerCreate : TSocketHandlerCreatedEvent Read FAfterSocketHandlerCreated Write FAfterSocketHandlerCreated; | ||||||
| <<<<<<< HEAD |  | ||||||
| ======= |  | ||||||
| 
 |  | ||||||
|     // Set to true if you want to support HTTP 1.1 connection: keep-alive - only available for threaded server |     // Set to true if you want to support HTTP 1.1 connection: keep-alive - only available for threaded server | ||||||
|     Property KeepAliveSupport: Boolean read FKeepAliveSupport write FKeepAliveSupport; |     Property KeepAliveSupport: Boolean read FKeepAliveSupport write FKeepAliveSupport; | ||||||
|     // time-out for keep-alive: how many ms should the server keep the connection alive after a request has been handled |     // time-out for keep-alive: how many ms should the server keep the connection alive after a request has been handled | ||||||
|     Property KeepAliveTimeout: Integer read FKeepAliveTimeout write FKeepAliveTimeout; |     Property KeepAliveTimeout: Integer read FKeepAliveTimeout write FKeepAliveTimeout; | ||||||
| >>>>>>> TFPCustomHttpServer KeepAlive* properties |  | ||||||
|   end; |   end; | ||||||
| 
 | 
 | ||||||
|   TFPHttpServer = Class(TFPCustomHttpServer) |   TFPHttpServer = Class(TFPCustomHttpServer) | ||||||
| @ -619,7 +606,7 @@ begin | |||||||
|         if Assigned(Resp) and (not Resp.ContentSent) then |         if Assigned(Resp) and (not Resp.ContentSent) then | ||||||
|           begin |           begin | ||||||
|           // Add connection header for HTTP 1.0 keep-alive |           // Add connection header for HTTP 1.0 keep-alive | ||||||
|           if FKeepAlive and (Req.HttpVersion='1.0') and not Resp.HeaderIsSet(hhConnection) then |           if KeepAliveSupport and FKeepAlive and (Req.HttpVersion='1.0') and not Resp.HeaderIsSet(hhConnection) then | ||||||
|             Resp.SetHeader(hhConnection,'keep-alive'); |             Resp.SetHeader(hhConnection,'keep-alive'); | ||||||
|           Resp.SendContent; |           Resp.SendContent; | ||||||
|           end; |           end; | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 Ondrej Pokorny
						Ondrej Pokorny