PeanutButter
Loading...
Searching...
No Matches
PeanutButter.SimpleHTTPServer.HttpServerBase Class Referenceabstract

Provides the abstract base HTTP Server. More...

Inheritance diagram for PeanutButter.SimpleHTTPServer.HttpServerBase:
PeanutButter.SimpleTcpServer.TcpServer PeanutButter.SimpleHTTPServer.IHttpServerBase PeanutButter.SimpleTcpServer.ITrackingDisposable PeanutButter.SimpleHTTPServer.HttpServer

Public Member Functions

void HandleRequestWithoutBody (HttpProcessor p, string method)
 Handles a request that does not contain a body (as of the HTTP spec).
Parameters
pThe HTTP processor.
methodThe HTTP method.

void HandleRequestWithBody (HttpProcessor p, MemoryStream inputData, string method)
 Handles a general request with a request body.
Parameters
pThe HTTP processor.
inputDataThe stream to read the request body from.
methodThe HTTP method.

string GetFullUrlFor (string relativeUrl)
 Resolves the full url to the provided path on the current server.
Parameters
relativeUrl
Returns

Public Member Functions inherited from PeanutButter.SimpleTcpServer.TcpServer
void Start ()
 Start the server.
void Stop ()
 Stop the server.
virtual void Dispose ()
 Disposes the server (stops it if it is running)
Public Member Functions inherited from PeanutButter.SimpleHTTPServer.IHttpServerBase
void Start ()
 Start the server.
void Stop ()
 Stop the server.

Protected Member Functions

 HttpServerBase (int port)
 HttpServerBase ()
override IProcessor CreateProcessorFor (TcpClient client)
Protected Member Functions inherited from PeanutButter.SimpleTcpServer.TcpServer
 TcpServer (int minPort=5000, int maxPort=32000)
 Construct the server with a random port within the provided range.
 TcpServer (int port)
 Construct the server with the explicitly-provided port.
void Init ()
 Override in derived classes: this initializes the server system.
void Log (string message, params object[] parameters)
 Provides a convenience logging mechanism which outputs via the established LogAction.
IProcessor CreateProcessorFor (TcpClient client)
 Create a processor for a particular TCP client.
virtual int NextRandomPort ()
 Guesses the next random port to attempt to bind to.

Properties

Action< RequestLogItemRequestLogAction = null [get, set]
 Log action used for requests.
HttpVersion Version [get, set]
 HTTP version reported by the server in responses Note that this does not change behavior of the server, only the exact format of the response.
string BaseUrl [get]
 Provides the base url from which the server serves.
Properties inherited from PeanutButter.SimpleTcpServer.TcpServer
bool Disposed [get]
 Flag: when true, this server has been disposed.
int MaxShutDownTime = 1000 [get, set]
 Maximum time, in milliseconds, to wait on the listener task when shutting down.
bool LogRandomPortDiscovery [get, set]
 Whether or not to log random port discovery processes.
Action< string > LogAction = Console.WriteLine [get, set]
 Action to employ when logging (defaults to logging to the console)
int Port [get, protected set]
 Port which this server has bound to.
bool IsListening [get]
 Flag exposing listening state.
Properties inherited from PeanutButter.SimpleHTTPServer.IHttpServerBase
bool Disposed [get]
 Flag: when true, this server has been disposed.
int MaxShutDownTime [get, set]
 Maximum time, in milliseconds, to wait on the listener task when shutting down.
bool LogRandomPortDiscovery [get, set]
 Whether or not to log random port discovery processes.
Action< string > LogAction [get, set]
 Action to employ when logging (defaults to logging to the console)
int Port [get]
 Port which this server has bound to.
bool IsListening [get]
 Flag exposing listening state.

Detailed Description

Provides the abstract base HTTP Server.

Member Function Documentation

◆ GetFullUrlFor()

string PeanutButter.SimpleHTTPServer.HttpServerBase.GetFullUrlFor ( string relativeUrl)

Resolves the full url to the provided path on the current server.

Parameters
relativeUrl
Returns

Implements PeanutButter.SimpleHTTPServer.IHttpServerBase.

◆ HandleRequestWithBody()

void PeanutButter.SimpleHTTPServer.HttpServerBase.HandleRequestWithBody ( HttpProcessor p,
MemoryStream inputData,
string method )
abstract

Handles a general request with a request body.

Parameters
pThe HTTP processor.
inputDataThe stream to read the request body from.
methodThe HTTP method.

Implements PeanutButter.SimpleHTTPServer.IHttpServerBase.

◆ HandleRequestWithoutBody()

void PeanutButter.SimpleHTTPServer.HttpServerBase.HandleRequestWithoutBody ( HttpProcessor p,
string method )
abstract

Handles a request that does not contain a body (as of the HTTP spec).

Parameters
pThe HTTP processor.
methodThe HTTP method.

Implements PeanutButter.SimpleHTTPServer.IHttpServerBase.

Property Documentation

◆ BaseUrl

string PeanutButter.SimpleHTTPServer.HttpServerBase.BaseUrl
get

Provides the base url from which the server serves.

Implements PeanutButter.SimpleHTTPServer.IHttpServerBase.

◆ RequestLogAction

Action<RequestLogItem> PeanutButter.SimpleHTTPServer.HttpServerBase.RequestLogAction = null
getset

Log action used for requests.

Implements PeanutButter.SimpleHTTPServer.IHttpServerBase.

◆ Version

HttpVersion PeanutButter.SimpleHTTPServer.HttpServerBase.Version
getset

HTTP version reported by the server in responses Note that this does not change behavior of the server, only the exact format of the response.

Implements PeanutButter.SimpleHTTPServer.IHttpServerBase.


The documentation for this class was generated from the following file:
  • source/SimpleServers/PeanutButter.SimpleHTTPServer/HttpServerBase.cs