From 134f86e8d5c414409631b25b8c6f0ee45fbd8631 Mon Sep 17 00:00:00 2001 From: David Walter Seikel Date: Thu, 3 Nov 2016 21:44:39 +1000 Subject: Initial update to OpenSim 0.8.2.1 source code. --- bin/HttpServer_OpenSim.xml | 6495 ++++++++++++++++++++++---------------------- 1 file changed, 3308 insertions(+), 3187 deletions(-) (limited to 'bin/HttpServer_OpenSim.xml') diff --git a/bin/HttpServer_OpenSim.xml b/bin/HttpServer_OpenSim.xml index d31bcca..61c3ad8 100644 --- a/bin/HttpServer_OpenSim.xml +++ b/bin/HttpServer_OpenSim.xml @@ -4,547 +4,659 @@ HttpServer_OpenSim - - - A session store is used to store and load sessions on a media. - The default implementation () saves/retrieves sessions from memory. - - - + - Creates a new http session with a generated id. + Delegate used to find a realm/domain. - A object + + + + Realms are used during HTTP Authentication + + + - + - Creates a new http session with a specific id + A complete HTTP server, you need to add a module to it to be able to handle incoming requests. - Id used to identify the new cookie.. - A object. - - Id should be generated by the store implementation if it's null or . - + + + // this small example will add two web site modules, thus handling + // two different sites. In reality you should add Controller modules or something + // two the website modules to be able to handle different requests. + HttpServer server = new HttpServer(); + server.Add(new WebSiteModule("www.gauffin.com", "Gauffin Telecom AB")); + server.Add(new WebSiteModule("www.vapadi.se", "Remote PBX")); + + // start regular http + server.Start(IPAddress.Any, 80); + + // start https + server.Start(IPAddress.Any, 443, myCertificate); + + + + + - + - Load an existing session. + Initializes a new instance of the class. - Session id (usually retrieved from a client side cookie). - A session if found; otherwise null. + Used to get all components used in the server.. - + - Save an updated session to the store. + Initializes a new instance of the class. - Session id (usually retrieved from a client side cookie). - If Id property have not been specified. - + - We use the flyweight pattern which reuses small objects - instead of creating new each time. + Initializes a new instance of the class. - Unused session that should be reused next time Create is called. + Form decoders are used to convert different types of posted data to the object types. + + - + - Remove expired sessions + Initializes a new instance of the class. + A session store is used to save and retrieve sessions + - + - Remove a session + Initializes a new instance of the class. - id of the session. + The log writer. + - + - Load a session from the store + Initializes a new instance of the class. - - null if session is not found. + Form decoders are used to convert different types of posted data to the object types. + The log writer. + + + - + - Number of minutes before a session expires. + Initializes a new instance of the class. - Default time is 20 minutes. + Form decoders are used to convert different types of posted data to the object types. + A session store is used to save and retrieve sessions + The log writer. + + + + - + - Contains server side HTTP request information. + Adds the specified rule. + The rule. - + - Called during parsing of a . + Add a to the server. - Name of the header, should not be URL encoded - Value of the header, should not be URL encoded - If a header is incorrect. + mode to add - + - Add bytes to the body + Decodes the request body. - buffer to read bytes from - where to start read - number of bytes to read - Number of bytes actually read (same as length unless we got all body bytes). - If body is not writable - bytes is null. - offset is out of range. + The request. + Failed to decode form data. - + - Clear everything in the request + Generate a HTTP error page (that will be added to the response body). + response status code is also set. + Response that the page will be generated in. + . + response body contents. - + - Decode body into a form. + Generate a HTTP error page (that will be added to the response body). + response status code is also set. - A list with form decoders. - If body contents is not valid for the chosen decoder. - If body is still being transferred. + Response that the page will be generated in. + exception. - + - Sets the cookies. + Realms are used by the s. - The cookies. + HTTP request + domain/realm. - + - Create a response object. + Process an incoming request. - Context for the connected client. - A new . + connection to client + request information + response that should be filled + session information - + - Gets kind of types accepted by the client. + Can be overloaded to implement stuff when a client have been connected. + + Default implementation does nothing. + + client that disconnected + disconnect reason - + - Gets or sets body stream. + Handle authentication + + + + true if request can be handled; false if not. + Invalid authorization header - + - Gets whether the body is complete. + Will request authentication. + + Sends respond to client, nothing else can be done with the response after this. + + + + - + - Gets or sets kind of connection used for the session. + Received from a when a request have been parsed successfully. + that received the request. + The request. - + - Gets or sets number of bytes in the body. + To be able to track request count. + + - + - Gets cookies that was sent with the request. + Start the web server using regular HTTP. + IP Address to listen on, use IpAddress.Any to accept connections on all IP addresses/network cards. + Port to listen on. 80 can be a good idea =) + address is null. + Port must be a positive number. - + - Gets form parameters. + Accept secure connections. + IP Address to listen on, use to accept connections on all IP Addresses / network cards. + Port to listen on. 80 can be a good idea =) + Certificate to use + address is null. + Port must be a positive number. - + - Gets headers sent by the client. + shut down the server and listeners - + - Gets or sets version of HTTP protocol that's used. + write an entry to the log file - - Probably or . - - + importance of the message + log message - + - Gets whether the request was made by Ajax (Asynchronous JavaScript) + write an entry to the log file + object that wrote the message + importance of the message + log message - + - Gets or sets requested method. + Server that is handling the current request. - Will always be in upper case. + Will be set as soon as a request arrives to the object. - - + - Gets parameter from or . - - - - - Gets variables sent in the query string + Modules used for authentication. The module that is is added first is used as + the default authentication module. + Use the corresponding property + in the if you are using multiple websites. - + - Gets or sets requested URI. + Form decoder providers are used to decode request body (which normally contains form data). - + - Gets URI absolute path divided into parts. + Server name sent in HTTP responses. - - // URI is: http://gauffin.com/code/tiny/ - Console.WriteLine(request.UriParts[0]); // result: code - Console.WriteLine(request.UriParts[1]); // result: tiny - - If you're using controllers than the first part is controller name, - the second part is method name and the third part is Id property. + Do NOT include version in name, since it makes it + easier for hackers. - - + - Gets or sets path and query. + Name of cookie where session id is stored. - - - Are only used during request parsing. Cannot be set after "Host" header have been - added. - - + - Class that receives Requests from a . + Specified where logging should go. + + + - + - Client have been disconnected. + Number of connections that can wait to be accepted by the server. - Client that was disconnected. - Reason - + Default is 10. - + - Invoked when a client context have received a new HTTP request + Gets or sets maximum number of allowed simultaneous requests. - Client that received the request. - Request that was received. - + + + This property is useful in busy systems. The HTTP server + will start queuing new requests if this limit is hit, instead + of trying to process all incoming requests directly. + + + The default number if allowed simultaneous requests are 10. + + - + - Delegate used by to populate select options. + Gets or sets maximum number of requests queuing to be handled. - current object (for instance a User). - Text that should be displayed in the value part of a <optiongt;-tag. - Text shown in the select list. - - // Class that is going to be used in a SELECT-tag. - public class User - { - private readonly string _realName; - private readonly int _id; - public User(int id, string realName) - { - _id = id; - _realName = realName; - } - public string RealName - { - get { return _realName; } - } - - public int Id - { - get { return _id; } - } - } - - // Using an inline delegate to generate the select list - public void UserInlineDelegate() - { - List<User> items = new List<User>(); - items.Add(new User(1, "adam")); - items.Add(new User(2, "bertial")); - items.Add(new User(3, "david")); - string htmlSelect = Select("users", "users", items, delegate(object o, out object id, out object value) - { - User user = (User)o; - id = user.Id; - value = user.RealName; - }, 2, true); - } - - // Using an method as delegate to generate the select list. - public void UseExternalDelegate() - { - List<User> items = new List<User>(); - items.Add(new User(1, "adam")); - items.Add(new User(2, "bertial")); - items.Add(new User(3, "david")); - string htmlSelect = Select("users", "users", items, UserOptions, 1, true); - } - - // delegate returning id and title - public static void UserOptions(object o, out object id, out object title) - { - User user = (User)o; - id = user.Id; - value = user.RealName; - } /// + + + The WebServer will start turning requests away if response code + to indicate that the server + is too busy to be able to handle the request. + + - + - The server understood the request, but is refusing to fulfill it. - Authorization will not help and the request SHOULD NOT be repeated. - If the request method was not HEAD and the server wishes to make public why the request has not been fulfilled, - it SHOULD describe the reason for the refusal in the entity. If the server does not wish to make this information - available to the client, the status code 404 (Not Found) can be used instead. - - Text taken from: http://www.submissionchamber.com/help-guides/error-codes.php + Realms are used during HTTP authentication. + Default realm is same as server name. - + - All HTTP based exceptions will derive this class. + Let's to receive unhandled exceptions from the threads. + + Exceptions will be thrown during debug mode if this event is not used, + exceptions will be printed to console and suppressed during release mode. + - + - Create a new HttpException + Serves files that are stored in embedded resources. - http status code (sent in the response) - error description - + - Create a new HttpException + A HttpModule can be used to serve Uri's. The module itself + decides if it should serve a Uri or not. In this way, you can + get a very flexible http application since you can let multiple modules + serve almost similar urls. - http status code (sent in the response) - error description - inner exception + + Throw if you are using a and want to prompt for user name/password. + - + - status code to use in the response. + Method that process the url + Information sent by the browser about the request + Information that is being sent back to the client. + Session used to + true if this module handled the request. - + - Initializes a new instance of the class. + Set the log writer to use. - error message + logwriter to use. - + - A session stored in memory. + Log something. + importance of log message + message - + - Interface for sessions + If true specifies that the module doesn't consume the processing of a request so that subsequent modules + can continue processing afterwards. Default is false. - + - Remove everything from the session + Initializes a new instance of the class. + Runs to make sure the basic mime types are available, they can be cleared later + through the use of if desired. - + - Remove everything from the session + Initializes a new instance of the class. + Runs to make sure the basic mime types are available, they can be cleared later + through the use of if desired. - True if the session is cleared due to expiration + The log writer to use when logging events - + - Session id + Mimtypes that this class can handle per default - + - Should + Loads resources from a namespace in the given assembly to an uri - Name of the session variable - null if it's not set - If the object cant be serialized. + The uri to map the resources to + The assembly in which the resources reside + The namespace from which to load the resources + + resourceLoader.LoadResources("/user/", typeof(User).Assembly, "MyLib.Models.User.Views"); + + will make ie the resource MyLib.Models.User.Views.stylesheet.css accessible via /user/stylesheet.css + + The amount of loaded files, giving you the possibility of making sure the resources needed gets loaded - + - When the session was last accessed. - This property is touched by the http server each time the - session is requested. + Returns true if the module can handle the request - + - Number of session variables. + Method that process the url + Information sent by the browser about the request + Information that is being sent back to the client. + Session used to + true if this module handled the request. - + - Event triggered upon clearing the session + List with all mime-type that are allowed. + All other mime types will result in a Forbidden http status code. - + - + Contains some kind of input from the browser/client. + can be QueryString, form data or any other request body content. - A unique id used by the sessions store to identify the session - + - Id + Base class for request data containers - - + - Remove everything from the session + Adds a parameter mapped to the presented name + The name to map the parameter to + The parameter value - + - Clears the specified expire. + Returns true if the container contains the requested parameter - True if the session is cleared due to expiration + Parameter id + True if parameter exists - + - Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. + Returns a request parameter - 2 + The name associated with the parameter + - + + Representation of a non-initialized class instance + + + Variable telling the class that it is non-initialized + + - Session id + Initializes a new instance of the class. + form name. - + - Should + Initializes a new instance of the class. - Name of the session variable - null if it's not set + form name. + if set to true all changes will be ignored. + this constructor should only be used by Empty - + + Creates a deep copy of the HttpInput class + The object to copy + The function makes a deep copy of quite a lot which can be slow + + - when the session was last accessed. + Add a new element. Form array elements are parsed + and added in a correct hierarchy. - - Used to determine when the session should be removed. - + Name is converted to lower case. + + name is null. + Cannot add stuff to . - + - Number of values in the session + Returns true if the class contains a with the corresponding name. + The field/query string name + True if the value exists - + - Flag to indicate that the session have been changed - and should be saved into the session store. + Parses an item and returns it. + This function is primarily used to parse array items as in user[name]. + + + - + + Outputs the instance representing all its values joined together + + + + Returns all items as an unescaped query string. + + + - Event triggered upon clearing the session + Extracts one parameter from an array + Containing the string array + All but the first value + + string test1 = ExtractOne("system[user][extension][id]"); + string test2 = ExtractOne(test1); + string test3 = ExtractOne(test2); + // test1 = user[extension][id] + // test2 = extension[id] + // test3 = id + - + + Resets all data contained by class + + - cookie being sent back to the browser. + Returns an enumerator that iterates through the collection. - + + + A that can be used to iterate through the collection. + + 1 - + - cookie sent by the client/browser + Returns an enumerator that iterates through a collection. - + + + An object that can be used to iterate through the collection. + + 2 - + - Constructor. + Form name as lower case - cookie identifier - cookie content - id or content is null - id is empty - + - Gets the cookie HTML representation. + Get a form item. - cookie string + + Returns if item was not found. - + - Gets the cookie identifier. + The server understood the request, but is refusing to fulfill it. + Authorization will not help and the request SHOULD NOT be repeated. + If the request method was not HEAD and the server wishes to make public why the request has not been fulfilled, + it SHOULD describe the reason for the refusal in the entity. If the server does not wish to make this information + available to the client, the status code 404 (Not Found) can be used instead. + + Text taken from: http://www.submissionchamber.com/help-guides/error-codes.php - + - Cookie value. Set to null to remove cookie. + All HTTP based exceptions will derive this class. - + - Constructor. + Create a new HttpException - cookie identifier - cookie content - cookie expiration date. Use DateTime.MinValue for session cookie. - id or content is null - id is empty + http status code (sent in the response) + error description - + - Create a new cookie + Create a new HttpException - name identifying the cookie - cookie value - when the cookie expires. Setting DateTime.MinValue will delete the cookie when the session is closed. - Path to where the cookie is valid - Domain that the cookie is valid for. + http status code (sent in the response) + error description + inner exception - + - Create a new cookie + status code to use in the response. - Name and value will be used - when the cookie expires. - + - Gets the cookie HTML representation. + Initializes a new instance of the class. - cookie string + error message - + - When the cookie expires. - DateTime.MinValue means that the cookie expires when the session do so. + This class is created as a wrapper, since there are two different cookie types in .Net (Cookie and HttpCookie). + The framework might switch class in the future and we dont want to have to replace all instances - + - Cookie is only valid under this path. + Let's copy all the cookies. + + value from cookie header. + + + + Adds a cookie in the collection. + + cookie to add + cookie is null + + + + Gets a collection enumerator on the cookie list. + + collection enumerator + + + + Remove all cookies. + + + + + Returns an enumerator that iterates through the collection. + + + + A that can be used to iterate through the collection. + + 1 + + + + Remove a cookie from the collection. + + Name of cookie. + + + + Gets the count of cookies in the collection. + + + + + Gets the cookie of a given identifier (null if not existing). @@ -660,102 +772,130 @@ Gets received request. - + - Contains a listener that doesn't do anything with the connections. + Returns item either from a form or a query string (checks them in that order) - + + Representation of a non-initialized HttpParam + + + Initialises the class to hold a value either from a post request or a querystring request + + - Listen for regular HTTP connections + The add method is not availible for HttpParam + since HttpParam checks both Request.Form and Request.QueryString - IP Address to accept connections on - TCP Port to listen on, default HTTP port is 80. - Factory used to create es. - address is null. - Port must be a positive number. + name identifying the value + value to add + - + - Initializes a new instance of the class. + Checks whether the form or querystring has the specified value - IP Address to accept connections on - TCP Port to listen on, default HTTPS port is 443 - Factory used to create es. - Certificate to use + Name, case sensitive + true if found; otherwise false. - + - Initializes a new instance of the class. + Returns an enumerator that iterates through the collection. - IP Address to accept connections on - TCP Port to listen on, default HTTPS port is 443 - Factory used to create es. - Certificate to use - which HTTPS protocol to use, default is TLS. + + + A that can be used to iterate through the collection. + + 1 - - Exception. + + + Returns an enumerator that iterates through a collection. + + + + An object that can be used to iterate through the collection. + + 2 - + - Will try to accept connections one more time. + Fetch an item from the form or querystring (in that order). - If any exceptions is thrown. + + Item if found; otherwise HttpInputItem.EmptyLanguageNode - + - Can be used to create filtering of new connections. + Container class for posted files - Accepted socket - true if connection can be accepted; otherwise false. - + - Start listen for new connections + Creates a container for a posted file - Number of connections that can stand in a queue to be accepted. - Listener have already been started. + The identifier of the post field + The file path + The content type of the file + The name of the file uploaded + If any parameter is null or empty - + - Stop the listener + Creates a container for a posted file - + If any parameter is null or empty - + + Destructor disposing the file + + - Gives you a change to receive log entries for all internals of the HTTP library. + Deletes the temporary file - - You may not switch log writer after starting the listener. - + True if manual dispose - + - True if we should turn on trace logs. + Disposing interface, cleans up managed resources (the temporary file) and suppresses finalization - + - Catch exceptions not handled by the listener. + The name/id of the file - - Exceptions will be thrown during debug mode if this event is not used, - exceptions will be printed to console and suppressed during release mode. - - + - A request have been received from a . + The full file path - + - + The name of the uploaded file + + + + + The type of file + + + + + This decoder converts XML documents to form items. + Each element becomes a subitem in the form, and each attribute becomes an item. + + // xml: somethingdata + // result: + // form["hello"].Value = "something" + // form["hello"]["id"].Value = 1 + // form["hello"]["world]["id"].Value = 1 + // form["hello"]["world"].Value = "data" + - http://www.faqs.org/rfcs/rfc1867.html + The original xml document is stored in form["__xml__"].Value. @@ -780,257 +920,237 @@ Content type (with any additional info like boundry). Content type is always supplied in lower case. True if the decoder can parse the specified content type - - - multipart/form-data - - - - - form-data - - - + Stream containing the content Content type (with any additional info like boundry). Content type is always supplied in lower case - Stream enconding + Stream encoding + Note: contentType and encoding are not used? A http form, or null if content could not be parsed. - If contents in the stream is not valid input data. - If any parameter is null + - + + + Recursive function that will go through an xml element and store it's content + to the form item. + + (parent) Item in form that content should be added to. + Node that should be parsed. + + Checks if the decoder can handle the mime type Content type (with any additional info like boundry). Content type is always supplied in lower case. True if the decoder can parse the specified content type - + - The requested resource was not found in the web server. + The object form class takes an object and creates form items for it. - + - Create a new exception + Initializes a new instance of the class. - message describing the error - inner exception + + form name *and* id. + action to do when form is posted. + - + - Create a new exception + Initializes a new instance of the class. - message describing the error + form name *and* id. + action to do when form is posted. + object to get values from - + - Delegate used to let authentication modules authenticate the user name and password. + Initializes a new instance of the class. - Realm that the user want to authenticate in - User name specified by client - Can either be user password or implementation specific token. - object that will be stored in a session variable called if authentication was successful. - throw forbidden exception if too many attempts have been made. - - - Use to specify that the token is a HA1 token. (MD5 generated - string from realm, user name and password); Md5String(userName + ":" + realm + ":" + password); - - + form action. + object to get values from. - + - Let's you decide on a system level if authentication is required. + write out the FORM-tag. - HTTP request from client - true if user should be authenticated. - throw if no more attempts are allowed. - If no more attempts are allowed + generated html code - + - Authentication modules are used to implement different - kind of HTTP authentication. + Writeout the form tag + form should be posted through ajax. + generated html code - + - Tag used for authentication. + Generates a text box. + + + generated html code - + - Initializes a new instance of the class. + password box - Delegate used to provide information used during authentication. - Delegate used to determine if authentication is required (may be null). + + + generated html code - + - Initializes a new instance of the class. + Hiddens the specified property name. - Delegate used to provide information used during authentication. + Name of the property. + The options. + generated html code - + - Create a response that can be sent in the WWW-Authenticate header. + Labels the specified property name. - Realm that the user should authenticate in - Array with optional options. - A correct authentication request. - If realm is empty or null. + property in object. + caption + generated html code - + - An authentication response have been received from the web browser. - Check if it's correct + Generate a checkbox - Contents from the Authorization header - Realm that should be authenticated - GET/POST/PUT/DELETE etc. - options to specific implementations - Authentication object that is stored for the request. A user class or something like that. - if is invalid - If any of the parameters is empty or null. - - + property in object + checkbox value + additional html attributes. + generated html code + + - Used to invoke the authentication delegate that is used to lookup the user name/realm. + Write a html select tag - Realm (domain) that user want to authenticate in - User name - Password used for validation. Some implementations got password in clear text, they are then sent to client. - object that will be stored in the request to help you identify the user if authentication was successful. - true if authentication was successful + object property. + id column + The title column. + The options. + - + - Determines if authentication is required. + Selects the specified property name. - HTTP request from browser - true if user should be authenticated. - throw from your delegate if no more attempts are allowed. - If no more attempts are allowed + Name of the property. + The items. + The id column. + The title column. + The options. + - + - name used in HTTP request. + Write a submit tag. + button caption + html submit tag - + - Contains some kind of input from the browser/client. - can be QueryString, form data or any other request body content. + html end form tag + html - + - Base class for request data containers + + + http://www.faqs.org/rfcs/rfc1867.html + - + - Adds a parameter mapped to the presented name + multipart/form-data - The name to map the parameter to - The parameter value - + - Returns true if the container contains the requested parameter + form-data - Parameter id - True if parameter exists - + - Returns a request parameter + - The name associated with the parameter - - - - Representation of a non-initialized class instance - - - Variable telling the class that it is non-initialized + Stream containing the content + Content type (with any additional info like boundry). Content type is always supplied in lower case + Stream enconding + A http form, or null if content could not be parsed. + If contents in the stream is not valid input data. + If any parameter is null - + - Initializes a new instance of the class. + Checks if the decoder can handle the mime type - form name. + Content type (with any additional info like boundry). Content type is always supplied in lower case. + True if the decoder can parse the specified content type - + - Initializes a new instance of the class. + The request could not be understood by the server due to malformed syntax. + The client SHOULD NOT repeat the request without modifications. + + Text taken from: http://www.submissionchamber.com/help-guides/error-codes.php - form name. - if set to true all changes will be ignored. - this constructor should only be used by Empty - - - Creates a deep copy of the HttpInput class - The object to copy - The function makes a deep copy of quite a lot which can be slow - + - Add a new element. Form array elements are parsed - and added in a correct hierarchy. + Create a new bad request exception. - Name is converted to lower case. - - name is null. - Cannot add stuff to . + reason to why the request was bad. - + - Returns true if the class contains a with the corresponding name. + Create a new bad request exception. - The field/query string name - True if the value exists + reason to why the request was bad. + inner exception - + - Parses an item and returns it. - This function is primarily used to parse array items as in user[name]. + Cookies that should be set. - - - - - Outputs the instance representing all its values joined together - + + + Adds a cookie in the collection. + + cookie to add + cookie is null - - Returns all items as an unescaped query string. - + + + Copy a request cookie + + + When the cookie should expire - + - Extracts one parameter from an array + Gets a collection enumerator on the cookie list. - Containing the string array - All but the first value - - string test1 = ExtractOne("system[user][extension][id]"); - string test2 = ExtractOne(test1); - string test3 = ExtractOne(test2); - // test1 = user[extension][id] - // test2 = extension[id] - // test3 = id - + collection enumerator - - Resets all data contained by class + + + Remove all cookies + - + Returns an enumerator that iterates through the collection. @@ -1040,3532 +1160,3517 @@ 1 - + - Returns an enumerator that iterates through a collection. + Gets the count of cookies in the collection. - - - An object that can be used to iterate through the collection. - - 2 - + - Form name as lower case + Gets the cookie of a given identifier (null if not existing). - + - Get a form item. + cookie being sent back to the browser. - - Returns if item was not found. + - + - Small design by contract implementation. + cookie sent by the client/browser + - + - Check whether a parameter is empty. + Constructor. - Parameter value - Parameter name, or error description. - value is empty. + cookie identifier + cookie content + id or content is null + id is empty - + - Checks whether a parameter is null. + Gets the cookie HTML representation. - Parameter value - Parameter name, or error description. - value is null. + cookie string - + - Checks whether a parameter is null. + Gets the cookie identifier. - - Parameter value - Parameter name, or error description. - value is null. - + - Contains all HTTP Methods (according to the HTTP 1.1 specification) - - See: http://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html - + Cookie value. Set to null to remove cookie. - + - The DELETE method requests that the origin server delete the resource identified by the Request-URI. + Constructor. - - - This method MAY be overridden by human intervention (or other means) on the origin server. - The client cannot be guaranteed that the operation has been carried out, even if the status code - returned from the origin server indicates that the action has been completed successfully. - - - However, the server SHOULD NOT indicate success unless, at the time the response is given, - it intends to delete the resource or move it to an inaccessible location. - - - A successful response SHOULD be 200 (OK) if the response includes an entity describing the status, - 202 (Accepted) if the action has not yet been enacted, - or 204 (No Content) if the action has been enacted but the response does not include an entity. - - - If the request passes through a cache and the Request-URI identifies one or more currently cached entities, - those entries SHOULD be treated as stale. Responses to this method are not cacheable. - - - - - - The GET method means retrieve whatever information (in the form of an entity) is identified by the Request-URI. + cookie identifier + cookie content + cookie expiration date. Use DateTime.MinValue for session cookie. + id or content is null + id is empty + + + + Create a new cookie - - - If the Request-URI refers to a data-producing process, it is the produced data which shall be returned as the - entity in the response and not the source text of the process, unless that text happens to be the output of the process. - - - The semantics of the GET method change to a "conditional GET" if the request message includes an - If-Modified-Since, If-Unmodified-Since, If-Match, If-None-Match, or If-Range header field. - A conditional GET method requests that the entity be transferred only under the circumstances described - by the conditional header field(s). The conditional GET method is intended to reduce unnecessary network - usage by allowing cached entities to be refreshed without requiring multiple requests or transferring - data already held by the client. - - + name identifying the cookie + cookie value + when the cookie expires. Setting DateTime.MinValue will delete the cookie when the session is closed. + Path to where the cookie is valid + Domain that the cookie is valid for. - + - The HEAD method is identical to GET except that the server MUST NOT return a message-body in the response. + Create a new cookie - - The meta information contained in the HTTP headers in response to a HEAD request SHOULD be identical to the - information sent in response to a GET request. This method can be used for obtaining meta information about - the entity implied by the request without transferring the entity-body itself. - - This method is often used for testing hypertext links for validity, accessibility, and recent modification. - + Name and value will be used + when the cookie expires. - + - The OPTIONS method represents a request for information about the communication options available on the request/response chain identified by the Request-URI. + Gets the cookie HTML representation. - - This method allows the client to determine the options and/or requirements associated with a resource, or the capabilities of a server, without implying a resource action or initiating a resource retrieval. - + cookie string - + - The POST method is used to request that the origin server accept the entity enclosed - in the request as a new subordinate of the resource identified by the Request-URI in the Request-Line. + When the cookie expires. + DateTime.MinValue means that the cookie expires when the session do so. - - POST is designed to allow a uniform method to cover the following functions: - - - Annotation of existing resources; - - Posting a message to a bulletin board, newsgroup, mailing list, or similar group of articles; - - Providing a block of data, such as the result of submitting a form, to a data-handling process; - - Extending a database through an append operation. - - - - If a resource has been created on the origin server, the response SHOULD be 201 (Created) and - contain an entity which describes the status of the request and refers to the new resource, and a - Location header (see section 14.30). - - - The action performed by the POST method might not result in a resource that can be identified by a URI. - In this case, either 200 (OK) or 204 (No Content) is the appropriate response status, depending on - whether or not the response includes an entity that describes the result. - - Responses to this method are not cacheable, unless the response includes appropriate Cache-Control - or Expires header fields. However, the 303 (See Other) response can be used to direct the user agent - to retrieve a cacheable resource. - - - + - The PUT method requests that the enclosed entity be stored under the supplied Request-URI. + Cookie is only valid under this path. + + + + + Inversion of control interface. + + + + + Add a component instance + + Interface type + Instance to add + + + + Get a component. + Interface type + Component if registered, otherwise null. - - - If the Request-URI refers to an already existing resource, the enclosed entity SHOULD be considered as a - modified version of the one residing on the origin server. - - If the Request-URI does not point to an existing resource, and that URI is capable of being defined as a new - resource by the requesting user agent, the origin server can create the resource with that URI. - - If a new resource is created, the origin server MUST inform the user agent via the 201 (Created) response. - - If an existing resource is modified, either the 200 (OK) or 204 (No Content) response codes SHOULD be sent to - indicate successful completion of the request. - - If the resource could not be created or modified with the Request-URI, an appropriate error response SHOULD be - given that reflects the nature of the problem. - - - - The recipient of the entity MUST NOT ignore any Content-* (e.g. Content-Range) headers that it does not - understand or implement and MUST return a 501 (Not Implemented) response in such cases. - + Component will get created if needed. - + - The TRACE method is used to invoke a remote, application-layer loop- back of the request message. + Checks if the specified component interface have been added. + + true if found; otherwise false. - + - Contains all HTTP Methods (according to the HTTP 1.1 specification) - - See: http://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html - + Add a component. + Type being requested. + Type being created. - + - The DELETE method requests that the origin server delete the resource identified by the Request-URI. + Contains a listener that doesn't do anything with the connections. + + + + + Listen for regular HTTP connections + + IP Address to accept connections on + TCP Port to listen on, default HTTP port is 80. + Factory used to create es. + address is null. + Port must be a positive number. + + + + Initializes a new instance of the class. + + IP Address to accept connections on + TCP Port to listen on, default HTTPS port is 443 + Factory used to create es. + Certificate to use + + + + Initializes a new instance of the class. + + IP Address to accept connections on + TCP Port to listen on, default HTTPS port is 443 + Factory used to create es. + Certificate to use + which HTTPS protocol to use, default is TLS. + + + Exception. + + + + Will try to accept connections one more time. + + If any exceptions is thrown. + + + + Can be used to create filtering of new connections. + + Accepted socket + true if connection can be accepted; otherwise false. + + + + Start listen for new connections + + Number of connections that can stand in a queue to be accepted. + Listener have already been started. + + + + Stop the listener + + + + + + Gives you a change to receive log entries for all internals of the HTTP library. - - This method MAY be overridden by human intervention (or other means) on the origin server. - The client cannot be guaranteed that the operation has been carried out, even if the status code - returned from the origin server indicates that the action has been completed successfully. - - - However, the server SHOULD NOT indicate success unless, at the time the response is given, - it intends to delete the resource or move it to an inaccessible location. - - - A successful response SHOULD be 200 (OK) if the response includes an entity describing the status, - 202 (Accepted) if the action has not yet been enacted, - or 204 (No Content) if the action has been enacted but the response does not include an entity. - - - If the request passes through a cache and the Request-URI identifies one or more currently cached entities, - those entries SHOULD be treated as stale. Responses to this method are not cacheable. - + You may not switch log writer after starting the listener. - + - The GET method means retrieve whatever information (in the form of an entity) is identified by the Request-URI. + True if we should turn on trace logs. + + + + + Catch exceptions not handled by the listener. - - If the Request-URI refers to a data-producing process, it is the produced data which shall be returned as the - entity in the response and not the source text of the process, unless that text happens to be the output of the process. - - - The semantics of the GET method change to a "conditional GET" if the request message includes an - If-Modified-Since, If-Unmodified-Since, If-Match, If-None-Match, or If-Range header field. - A conditional GET method requests that the entity be transferred only under the circumstances described - by the conditional header field(s). The conditional GET method is intended to reduce unnecessary network - usage by allowing cached entities to be refreshed without requiring multiple requests or transferring - data already held by the client. - + Exceptions will be thrown during debug mode if this event is not used, + exceptions will be printed to console and suppressed during release mode. + + + + + A request have been received from a . + + + + + New implementation of the HTTP listener. + + + Use the Create methods to create a default listener. - + + + Initializes a new instance of the class. + + IP Address to accept connections on + TCP Port to listen on, default HTTP port is 80. + Factory used to create es. + address is null. + Port must be a positive number. + + + + Initializes a new instance of the class. + + The address. + The port. + The factory. + The certificate. + + - The HEAD method is identical to GET except that the server MUST NOT return a message-body in the response. + Initializes a new instance of the class. - - The meta information contained in the HTTP headers in response to a HEAD request SHOULD be identical to the - information sent in response to a GET request. This method can be used for obtaining meta information about - the entity implied by the request without transferring the entity-body itself. - - This method is often used for testing hypertext links for validity, accessibility, and recent modification. - + The address. + The port. + The factory. + The certificate. + The protocol. - + - The OPTIONS method represents a request for information about the communication options available on the request/response chain identified by the Request-URI. + Creates a new instance with default factories. - - This method allows the client to determine the options and/or requirements associated with a resource, or the capabilities of a server, without implying a resource action or initiating a resource retrieval. - + Address that the listener should accept connections on. + Port that listener should accept connections on. + Created HTTP listener. - + - The POST method is used to request that the origin server accept the entity enclosed - in the request as a new subordinate of the resource identified by the Request-URI in the Request-Line. + Creates a new instance with default factories. - - POST is designed to allow a uniform method to cover the following functions: - - - Annotation of existing resources; - - Posting a message to a bulletin board, newsgroup, mailing list, or similar group of articles; - - Providing a block of data, such as the result of submitting a form, to a data-handling process; - - Extending a database through an append operation. - - - - If a resource has been created on the origin server, the response SHOULD be 201 (Created) and - contain an entity which describes the status of the request and refers to the new resource, and a - Location header (see section 14.30). - - - The action performed by the POST method might not result in a resource that can be identified by a URI. - In this case, either 200 (OK) or 204 (No Content) is the appropriate response status, depending on - whether or not the response includes an entity that describes the result. - - Responses to this method are not cacheable, unless the response includes appropriate Cache-Control - or Expires header fields. However, the 303 (See Other) response can be used to direct the user agent - to retrieve a cacheable resource. - - + Address that the listener should accept connections on. + Port that listener should accept connections on. + Certificate to use + Created HTTP listener. - + - The PUT method requests that the enclosed entity be stored under the supplied Request-URI. + Creates a new instance with default factories. - - - - If the Request-URI refers to an already existing resource, the enclosed entity SHOULD be considered as a - modified version of the one residing on the origin server. - - If the Request-URI does not point to an existing resource, and that URI is capable of being defined as a new - resource by the requesting user agent, the origin server can create the resource with that URI. - - If a new resource is created, the origin server MUST inform the user agent via the 201 (Created) response. - - If an existing resource is modified, either the 200 (OK) or 204 (No Content) response codes SHOULD be sent to - indicate successful completion of the request. - - If the resource could not be created or modified with the Request-URI, an appropriate error response SHOULD be - given that reflects the nature of the problem. - - - - The recipient of the entity MUST NOT ignore any Content-* (e.g. Content-Range) headers that it does not - understand or implement and MUST return a 501 (Not Implemented) response in such cases. - - + Address that the listener should accept connections on. + Port that listener should accept connections on. + Certificate to use + which HTTPS protocol to use, default is TLS. + Created HTTP listener. - + - The TRACE method is used to invoke a remote, application-layer loop- back of the request message. + Can be used to create filtering of new connections. + Accepted socket + + true if connection can be accepted; otherwise false. + - + - Priority for log entries + A client have been accepted, but not handled, by the listener. - - + - Very detailed logs to be able to follow the flow of the program. + redirects from one URL to another. - + - Logs to help debug errors in the application + Rules are used to perform operations before a request is being handled. + Rules can be used to create routing etc. - + - Information to be able to keep track of state changes etc. + Process the incoming request. + + incoming HTTP request + outgoing HTTP response + true if response should be sent to the browser directly (no other rules or modules will be processed). + + returning true means that no modules will get the request. Returning true is typically being done + for redirects. + + If request or response is null. + + + + Initializes a new instance of the class. + Absolute path (no server name) + Absolute path (no server name) + + server.Add(new RedirectRule("/", "/user/index")); + - + - Something did not go as we expected, but it's no problem. + Initializes a new instance of the class. + Absolute path (no server name) + Absolute path (no server name) + true if request should be redirected, false if the request URI should be replaced. + + server.Add(new RedirectRule("/", "/user/index")); + - + - Something that should not fail failed, but we can still keep - on going. + Process the incoming request. + incoming HTTP request + outgoing HTTP response + true if response should be sent to the browser directly (no other rules or modules will be processed). + + returning true means that no modules will get the request. Returning true is typically being done + for redirects. + - + - Something failed, and we cannot handle it properly. + Gets string to match request URI with. + Is compared to request.Uri.AbsolutePath - + - Interface used to write to log files. + Gets where to redirect. - + - Write an entry to the log file. + Gets whether server should redirect client. - object that is writing to the log - importance of the log message - the message + + false means that the rule will replace + the current request URI with the new one from this class. + true means that a redirect response is sent to the client. + - + - This class writes to the console. It colors the output depending on the logprio and includes a 3-level stacktrace (in debug mode) + Parses a HTTP request directly from a stream - - + - The actual instance of this class. + Event driven parser used to parse incoming HTTP requests. + + The parser supports partial messages and keeps the states between + each parsed buffer. It's therefore important that the parser gets + ed if a client disconnects. + - + - Logwriters the specified source. + Parse partial or complete message. - object that wrote the logentry. - Importance of the log message - The message. + buffer containing incoming bytes + where in buffer that parsing should start + number of bytes to parse + Unparsed bytes left in buffer. + BadRequestException. - + - Get color for the specified logprio + Clear parser state. - prio for the log entry - A for the prio - + - Default log writer, writes everything to null (nowhere). + Current state in parser. - - + - The logging instance. + A request have been successfully parsed. - + - Writes everything to null + More body bytes have been received. - object that wrote the log entry. - Importance of the log message - The message. - + - Inversion of control interface. + Request line have been received. - + - Add a component instance + A header have been received. - Interface type - Instance to add - + - Get a component. + Gets or sets the log writer. - Interface type - Component if registered, otherwise null. - - Component will get created if needed. - - + - Checks if the specified component interface have been added. + Create a new request parser - - true if found; otherwise false. + delegate receiving log entries. - + - Add a component. + Add a number of bytes to the body - Type being requested. - Type being created. + buffer containing more body bytes. + starting offset in buffer + number of bytes, from offset, to read. + offset to continue from. - + - Returns item either from a form or a query string (checks them in that order) + Remove all state information for the request. - - Representation of a non-initialized HttpParam - - - Initialises the class to hold a value either from a post request or a querystring request - - + - The add method is not availible for HttpParam - since HttpParam checks both Request.Form and Request.QueryString + Parse request line - name identifying the value - value to add - + + If line is incorrect + Expects the following format: "Method SP Request-URI SP HTTP-Version CRLF" - + - Checks whether the form or querystring has the specified value + We've parsed a new header. - Name, case sensitive - true if found; otherwise false. + Name in lower case + Value, unmodified. + If content length cannot be parsed. - + - Returns an enumerator that iterates through the collection. + Parse a message - - - A that can be used to iterate through the collection. - - 1 + bytes to parse. + where in buffer that parsing should start + number of bytes to parse, starting on . + offset (where to start parsing next). + BadRequestException. - + - Returns an enumerator that iterates through a collection. + Gets or sets the log writer. - - - An object that can be used to iterate through the collection. - - 2 - + - Fetch an item from the form or querystring (in that order). + Current state in parser. - - Item if found; otherwise HttpInputItem.EmptyLanguageNode - - - Container for posted form data - - Instance to help mark a non-initialized form - - - Initializes a form container with the specified name - - + - Makes a deep copy of the input + A request have been successfully parsed. - The input to copy - + - Adds a file to the collection of posted files + More body bytes have been received. - The file to add - If the file is already added - If file is null - If the instance is HttpForm.EmptyForm which cannot be modified - + - Checks if the form contains a specified file + Request line have been received. - Field name of the file parameter - True if the file exists - If the instance is HttpForm.EmptyForm which cannot be modified - + - Retrieves a file held by by the form + A header have been received. - The identifier of the file - The requested file or null if the file was not found - If name is null or empty - If the instance is HttpForm.EmptyForm which cannot be modified - - - Disposes all held HttpFile's and resets values - + - Retrieves the number of files added to the + A thread-safe lockless queue that supports multiple readers and + multiple writers - 0 if no files are added - + + Queue head + + + Queue tail + + + Queue item count + + - The object form class takes an object and creates form items for it. + Constructor - + - Initializes a new instance of the class. + Enqueue an item - - form name *and* id. - action to do when form is posted. - + Item to enqeue - + - Initializes a new instance of the class. + Try to dequeue an item - form name *and* id. - action to do when form is posted. - object to get values from + Dequeued item if the dequeue was successful + True if an item was successfully deqeued, otherwise false - + + Gets the current number of items in the queue. Since this + is a lockless collection this value should be treated as a close + estimate + + - Initializes a new instance of the class. + Provides a node container for data in a singly linked list - form action. - object to get values from. - + + Pointer to the next node in list + + + The data contained by the node + + - write out the FORM-tag. + Constructor - generated html code - + - Writeout the form tag + Constructor - form should be posted through ajax. - generated html code - + - Generates a text box. + Contains server side HTTP request information. - - - generated html code - + - password box + Called during parsing of a . - - - generated html code + Name of the header, should not be URL encoded + Value of the header, should not be URL encoded + If a header is incorrect. - + - Hiddens the specified property name. + Add bytes to the body - Name of the property. - The options. - generated html code + buffer to read bytes from + where to start read + number of bytes to read + Number of bytes actually read (same as length unless we got all body bytes). + If body is not writable + bytes is null. + offset is out of range. - + - Labels the specified property name. + Clear everything in the request - property in object. - caption - generated html code - + - Generate a checkbox + Decode body into a form. - property in object - checkbox value - additional html attributes. - generated html code + A list with form decoders. + If body contents is not valid for the chosen decoder. + If body is still being transferred. - + - Write a html select tag + Sets the cookies. - object property. - id column - The title column. - The options. - + The cookies. - + - Selects the specified property name. + Create a response object. - Name of the property. - The items. - The id column. - The title column. - The options. - + Context for the connected client. + A new . - + - Write a submit tag. + Gets kind of types accepted by the client. - button caption - html submit tag - + - html end form tag + Gets or sets body stream. - html - + - This provider is used to let us implement any type of form decoding we want without - having to rewrite anything else in the server. + Gets whether the body is complete. - + - + Gets or sets kind of connection used for the session. - Should contain boundary and type, as in: multipart/form-data; boundary=---------------------------230051238959 - Stream containing form data. - Encoding used when decoding the stream - if no parser was found. - If stream is null or not readable. - If stream contents cannot be decoded properly. - + - Add a decoder. + Gets or sets number of bytes in the body. - - - + - Number of added decoders. + Gets cookies that was sent with the request. - + - Use with care. + Gets form parameters. - + - Decoder used for unknown content types. + Gets headers sent by the client. - + - We dont want to let the server to die due to exceptions thrown in worker threads. - therefore we use this delegate to give you a change to handle uncaught exceptions. + Gets or sets version of HTTP protocol that's used. - Class that the exception was thrown in. - Exception - Server will throw a InternalServerException in release version if you dont - handle this delegate. + Probably or . + - + - Contains a connection to a browser/client. + Gets whether the request was made by Ajax (Asynchronous JavaScript) + + + + + Gets or sets requested method. - Remember to after you have hooked the event. + Will always be in upper case. - TODO: Maybe this class should be broken up into HttpClientChannel and HttpClientContext? + - + - Initializes a new instance of the class. + Gets parameter from or . - true if the connection is secured (SSL/TLS) - client that connected. - Stream used for communication - Used to create a . - Size of buffer to use when reading data. Must be at least 4096 bytes. - If fails - Stream must be writable and readable. - + - Process incoming body bytes. + Gets variables sent in the query string - - Bytes - + - + Gets or sets requested URI. - - - + - Start reading content. + Gets URI absolute path divided into parts. + + // URI is: http://gauffin.com/code/tiny/ + Console.WriteLine(request.UriParts[0]); // result: code + Console.WriteLine(request.UriParts[1]); // result: tiny + - Make sure to call base.Start() if you override this method. + If you're using controllers than the first part is controller name, + the second part is method name and the third part is Id property. + - + - Clean up context. + Gets or sets path and query. + - Make sure to call base.Cleanup() if you override the method. + Are only used during request parsing. Cannot be set after "Host" header have been + added. - - - Disconnect from client - - error to report in the event. - - - - Send a response. - - Either or - HTTP status code - reason for the status code. - HTML body contents, can be null or empty. - A content type to return the body as, i.e. 'text/html' or 'text/plain', defaults to 'text/html' if null or empty - If is invalid. - - + - Send a response. + PrototypeJS implementation of the javascript functions. - Either or - HTTP status code - reason for the status code. - + - Send a response. + Purpose of this class is to create a javascript toolkit independent javascript helper. - - + - send a whole buffer + Generates a list with JS options. - buffer to send - + StringBuilder that the options should be added to. + the javascript options. name, value pairs. each string value should be escaped by YOU! + true if we should start with a comma. - + - Send data using the stream + Removes any javascript parameters from an array of parameters - Contains data to send - Start position in buffer - number of bytes to send - - + The array of parameters to remove javascript params from + An array of html parameters - + - This context have been cleaned, which means that it can be reused. + javascript action that should be added to the "onsubmit" event in the form tag. + + All javascript option names should end with colon. + + + JSHelper.AjaxRequest("/user/show/1", "onsuccess:", "$('userInfo').update(result);"); + + - + - Context have been started (a new client have connected) + Requests a url through ajax + url to fetch + optional options in format "key, value, key, value", used in JS request object. + a link tag + All javascript option names should end with colon. + + + JSHelper.AjaxRequest("/user/show/1", "onsuccess:", "$('userInfo').update(result);"); + + - + - Overload to specify own type. + Ajax requests that updates an element with + the fetched content - - Must be specified before the context is being used. - + Url to fetch content from + element to update + optional options in format "key, value, key, value", used in JS updater object. + A link tag. + All javascript option names should end with colon. + + + JSHelper.AjaxUpdater("/user/show/1", "userInfo", "onsuccess:", "alert('Successful!');"); + + - + - Using SSL or other encryption method. + A link that pop ups a Dialog (overlay div) + url to contents of dialog + link title + A "a"-tag that popups a dialog when clicked + name/value of html attributes + + WebHelper.DialogLink("/user/show/1", "show user", "onmouseover", "alert('booh!');"); + - + - Using SSL or other encryption method. + Close a javascript dialog window/div. + javascript for closing a dialog. + - + - Specify which logger to use. + Creates a new modal dialog window + url to open in window. + window title (may not be supported by all js implementations) + + - + - Gets or sets the network stream. + Requests a url through ajax + url to fetch. Url is NOT enclosed in quotes by the implementation. You need to do that yourself. + optional options in format "key, value, key, value", used in JS request object. All keys should end with colon. + a link tag + onclick attribute is used by this method. + + + // plain text + JSHelper.AjaxRequest("'/user/show/1'"); + + // ajax request using this.href + string link = "<a href=\"/user/call/1\" onclick=\"" + JSHelper.AjaxRequest("this.href") + "/<call user</a>"; + + - + - Gets or sets IP address that the client connected from. + Determins if a list of strings contains a specific value + options to check in + value to find + true if value was found + case insensitive - + - Gets or sets port that the client connected from. + Ajax requests that updates an element with + the fetched content + URL to fetch. URL is NOT enclosed in quotes by the implementation. You need to do that yourself. + element to update + options in format "key, value, key, value". All keys should end with colon. + A link tag. + + + JSHelper.AjaxUpdater("'/user/show/1'", "user", "onsuccess:", "alert('hello');", "asynchronous:", "true"); + + - + - The context have been disconnected. + A link that pop ups a Dialog (overlay div) - - Event can be used to clean up a context, or to reuse it. + URL to contents of dialog + link title + name, value, name, value + + A "a"-tag that popups a dialog when clicked + + Requires Control.Modal found here: http://livepipe.net/projects/control_modal/ + And the following JavaScript (load it in application.js): + + Event.observe(window, 'load', + function() { + document.getElementsByClassName('modal').each(function(link){ new Control.Modal(link); }); + } + ); + + + WebHelper.DialogLink("/user/show/1", "show user", "onmouseover", "alert('booh!');"); + - + - A request have been received in the context. + create a modal dialog (usually using DIVs) + url to fetch + dialog title + javascript/html attributes. javascript options ends with colon ':'. + - + - Helpers to make XML handling easier + Close a javascript dialog window/div. + javascript for closing a dialog. + - + - Serializes object to XML. + javascript action that should be added to the "onsubmit" event in the form tag. - object to serialize. - XML - - Removes name spaces and adds indentation - + remember to encapsulate strings in '' + + All javascript option names should end with colon. + + + JSHelper.AjaxRequest("/user/show/1", "onsuccess:", "$('userInfo').update(result);"); + + - + - Create an object from a XML string + Helpers making it easier to work with forms. - Type of object - XML string - object + - + - Can handle application/x-www-form-urlencoded + Used to let the website use different JavaScript libraries. + Default is - + + Create a <form> tag. - Stream containing the content - Content type (with any additional info like boundry). Content type is always supplied in lower case - Stream encoding - - A HTTP form, or null if content could not be parsed. - - If contents in the stream is not valid input data. + name of form + action to invoke on submit + form should be posted as Ajax + HTML code + + + // without options + WebHelper.FormStart("frmLogin", "/user/login", Request.IsAjax); + + // with options + WebHelper.FormStart("frmLogin", "/user/login", Request.IsAjax, "style", "display:inline", "class", "greenForm"); + + + HTML attributes or JavaScript options. + Method will ALWAYS be POST. + options must consist of name, value, name, value - + - Checks if the decoder can handle the mime type + Creates a select list with the values in a collection. - Content type (with any additional info like boundry). Content type is always supplied in lower case. - True if the decoder can parse the specified content type + Name of the SELECT-tag + collection used to generate options. + delegate used to return id and title from objects. + value that should be marked as selected. + First row should contain an empty value. + string containing a SELECT-tag. + - + - Invoked when a client have been accepted by the + Creates a select list with the values in a collection. - - Can be used to revoke incoming connections - + Name of the SELECT-tag + Id of the SELECT-tag + collection used to generate options. + delegate used to return id and title from objects. + value that should be marked as selected. + First row should contain an empty value. + string containing a SELECT-tag. + + + + // Class that is going to be used in a SELECT-tag. + public class User + { + private readonly string _realName; + private readonly int _id; + public User(int id, string realName) + { + _id = id; + _realName = realName; + } + public string RealName + { + get { return _realName; } + } + + public int Id + { + get { return _id; } + } + } + + // Using an inline delegate to generate the select list + public void UserInlineDelegate() + { + List<User> items = new List<User>(); + items.Add(new User(1, "adam")); + items.Add(new User(2, "bertial")); + items.Add(new User(3, "david")); + string htmlSelect = Select("users", "users", items, delegate(object o, out object id, out object value) + { + User user = (User)o; + id = user.Id; + value = user.RealName; + }, 2, true); + } + + // Using an method as delegate to generate the select list. + public void UseExternalDelegate() + { + List<User> items = new List<User>(); + items.Add(new User(1, "adam")); + items.Add(new User(2, "bertial")); + items.Add(new User(3, "david")); + string htmlSelect = Select("users", "users", items, UserOptions, 1, true); + } + + // delegate returning id and title + public static void UserOptions(object o, out object id, out object title) + { + User user = (User)o; + id = user.Id; + value = user.RealName; + } + + + name, id, collection or getIdTitle is null. - + - Initializes a new instance of the class. + Creates a select list with the values in a collection. - The socket. + Name of the SELECT-tag + Id of the SELECT-tag + collection used to generate options. + delegate used to return id and title from objects. + value that should be marked as selected. + First row should contain an empty value. + name, value collection of extra HTML attributes. + string containing a SELECT-tag. + + name, id, collection or getIdTitle is null. + Invalid HTML attribute list. - + - Client may not be handled. + Generate a list of HTML options + collection used to generate options. + delegate used to return id and title from objects. + value that should be marked as selected. + First row should contain an empty value. + + collection or getIdTitle is null. - - - Accepted socket. - + + sb is null. - + - Client should be revoked. + Creates a check box. + element name + element value + determines if the check box is selected or not. This is done differently depending on the + type of variable. A boolean simply triggers checked or not, all other types are compared with "value" to determine if + the box is checked or not. + a list with additional attributes (name, value, name, value). + a generated radio button - + - Arguments sent when a is cleared + Creates a check box. + element name + element id + element value + determines if the check box is selected or not. This is done differently depending on the + type of variable. A boolean simply triggers checked or not, all other types are compared with "value" to determine if + the box is checked or not. + a list with additional attributes (name, value, name, value). + a generated radio button + + value in your business object. (check box will be selected if it matches the element value) + - + - Instantiates the arguments for the event + Creates a check box. - True if the session is cleared due to expiration + element name + element id + determines if the check box is selected or not. This is done differently depending on the + type of variable. A boolean simply triggers checked or not, all other types are compared with "value" to determine if + the box is checked or not. + a list with additional attributes (name, value, name, value). + a generated radio button + will set value to "1". - + - Returns true if the session is cleared due to expiration + Creates a RadioButton. + element name + element value + determines if the radio button is selected or not. This is done differently depending on the + type of variable. A boolean simply triggers checked or not, all other types are compared with "value" to determine if + the box is checked or not. + a list with additional attributes (name, value, name, value). + a generated radio button - + - Delegate for when a IHttpSession is cleared + Creates a RadioButton. - this is being cleared. - Arguments for the clearing + element name + element id + element value + determines if the radio button is selected or not. This is done differently depending on the + type of variable. A boolean simply triggers checked or not, all other types are compared with "value" to determine if + the box is checked or not. + a list with additional attributes (name, value, name, value). + a generated radio button - + - Event arguments used when a new header have been parsed. + form close tag + - + - Initializes a new instance of the class. + We dont want to let the server to die due to exceptions thrown in worker threads. + therefore we use this delegate to give you a change to handle uncaught exceptions. - Name of header. - Header value. + Class that the exception was thrown in. + Exception + + Server will throw a InternalServerException in release version if you dont + handle this delegate. + - + - Initializes a new instance of the class. + Implements HTTP Digest authentication. It's more secure than Basic auth since password is + encrypted with a "key" from the server. + + Keep in mind that the password is encrypted with MD5. Use a combination of SSL and digest auth to be secure. + - + - Gets or sets header name. + Authentication modules are used to implement different + kind of HTTP authentication. - + - Gets or sets header value. + Tag used for authentication. - - Class to handle loading of resource files - - + - Initializes a new instance of the class. + Initializes a new instance of the class. + Delegate used to provide information used during authentication. + Delegate used to determine if authentication is required (may be null). - + - Initializes a new instance of the class. + Initializes a new instance of the class. - logger. + Delegate used to provide information used during authentication. - + - Loads resources from a namespace in the given assembly to an URI + Create a response that can be sent in the WWW-Authenticate header. - The URI to map the resources to - The assembly in which the resources reside - The namespace from which to load the resources - - - resourceLoader.LoadResources("/user/", typeof(User).Assembly, "MyLib.Models.User.Views"); - - Will make the resource MyLib.Models.User.Views.list.Haml accessible via /user/list.haml or /user/list/ - - The amount of loaded files, giving you the possibility of making sure the resources needed gets loaded - If a resource has already been mapped to an uri + Realm that the user should authenticate in + Array with optional options. + A correct authentication request. + If realm is empty or null. - + - Retrieves a stream for the specified resource path if loaded otherwise null + An authentication response have been received from the web browser. + Check if it's correct - Path to the resource to retrieve a stream for - A stream or null if the resource couldn't be found + Contents from the Authorization header + Realm that should be authenticated + GET/POST/PUT/DELETE etc. + options to specific implementations + Authentication object that is stored for the request. A user class or something like that. + if is invalid + If any of the parameters is empty or null. - + - Fetch all files from the resource that matches the specified arguments. + Used to invoke the authentication delegate that is used to lookup the user name/realm. - The path to the resource to extract - - a list of files if found; or an empty array if no files are found. - - Search path must end with an asterisk for finding arbitrary files + Realm (domain) that user want to authenticate in + User name + Password used for validation. Some implementations got password in clear text, they are then sent to client. + object that will be stored in the request to help you identify the user if authentication was successful. + true if authentication was successful - + - Fetch all files from the resource that matches the specified arguments. + Determines if authentication is required. - Where the file should reside. - Files to check - - a list of files if found; or an empty array if no files are found. - + HTTP request from browser + true if user should be authenticated. + throw from your delegate if no more attempts are allowed. + If no more attempts are allowed - + - Returns whether or not the loader has an instance of the file requested + name used in HTTP request. - The name of the template/file - True if the loader can provide the file - + - redirects from one URL to another. + Initializes a new instance of the class. + Delegate used to provide information used during authentication. + Delegate used to determine if authentication is required (may be null). - + - Rules are used to perform operations before a request is being handled. - Rules can be used to create routing etc. + Initializes a new instance of the class. + Delegate used to provide information used during authentication. - + - Process the incoming request. + Used by test classes to be able to use hardcoded values - incoming HTTP request - outgoing HTTP response - true if response should be sent to the browser directly (no other rules or modules will be processed). - - returning true means that no modules will get the request. Returning true is typically being done - for redirects. - - If request or response is null. - + - Initializes a new instance of the class. + An authentication response have been received from the web browser. + Check if it's correct - Absolute path (no server name) - Absolute path (no server name) - - server.Add(new RedirectRule("/", "/user/index")); - + Contents from the Authorization header + Realm that should be authenticated + GET/POST/PUT/DELETE etc. + First option: true if username/password is correct but not cnonce + + Authentication object that is stored for the request. A user class or something like that. + + if authenticationHeader is invalid + If any of the paramters is empty or null. - + - Initializes a new instance of the class. + Encrypts parameters into a Digest string - Absolute path (no server name) - Absolute path (no server name) - true if request should be redirected, false if the request URI should be replaced. - - server.Add(new RedirectRule("/", "/user/index")); - + Realm that the user want to log into. + User logging in + Users password. + HTTP method. + Uri/domain that generated the login prompt. + Quality of Protection. + "Number used ONCE" + Hexadecimal request counter. + "Client Number used ONCE" + Digest encrypted string - + - Process the incoming request. + - incoming HTTP request - outgoing HTTP response - true if response should be sent to the browser directly (no other rules or modules will be processed). - - returning true means that no modules will get the request. Returning true is typically being done - for redirects. - + Md5 hex encoded "userName:realm:password", without the quotes. + Md5 hex encoded "method:uri", without the quotes + Quality of Protection + "Number used ONCE" + Hexadecimal request counter. + Client number used once + - + - Gets string to match request URI with. + Create a response that can be sent in the WWW-Authenticate header. - Is compared to request.Uri.AbsolutePath + Realm that the user should authenticate in + First options specifies if true if username/password is correct but not cnonce. + A correct auth request. + If realm is empty or null. - + - Gets where to redirect. + Decodes authorization header value + header value + Encoding that the buffer is in + All headers and their values if successful; otherwise null + + NameValueCollection header = DigestAuthentication.Decode("response=\"6629fae49393a05397450978507c4ef1\",\r\nc=00001", Encoding.ASCII); + + Can handle lots of whitespaces and new lines without failing. - + - Gets whether server should redirect client. + Gets the current nonce. - - false means that the rule will replace - the current request URI with the new one from this class. - true means that a redirect response is sent to the client. - + - + - Used to queue incoming requests. + Gets the Md5 hash bin hex2. + To be hashed. + - + - Initializes a new instance of the class. + determines if the nonce is valid or has expired. - Called when a request should be processed. + nonce value (check wikipedia for info) + true if the nonce has not expired. - + - Used to process queued requests. + name used in http request. - + - Gets or sets maximum number of allowed simultaneous requests. + Gets or sets whether the token supplied in is a + HA1 generated string. - + - Gets or sets maximum number of requests queuing to be handled. + Generic helper functions for HTTP - + - Specifies how many requests the HTTP server is currently processing. + Version string for HTTP v1.0 - + - Used two queue incoming requests to avoid - thread starvation. + Version string for HTTP v1.1 - + - Method used to process a queued request + An empty URI - Context that the request was received from. - Request to process. - + - Parses a HTTP request directly from a stream + Parses a query string. + Query string (URI encoded) + A object if successful; otherwise + queryString is null. + If string cannot be parsed. - + - Event driven parser used to parse incoming HTTP requests. + Delegate used to let authentication modules authenticate the user name and password. + Realm that the user want to authenticate in + User name specified by client + Can either be user password or implementation specific token. + object that will be stored in a session variable called if authentication was successful. + throw forbidden exception if too many attempts have been made. - The parser supports partial messages and keeps the states between - each parsed buffer. It's therefore important that the parser gets - ed if a client disconnects. + + Use to specify that the token is a HA1 token. (MD5 generated + string from realm, user name and password); Md5String(userName + ":" + realm + ":" + password); + - - - Parse partial or complete message. - - buffer containing incoming bytes - where in buffer that parsing should start - number of bytes to parse - Unparsed bytes left in buffer. - BadRequestException. - - + - Clear parser state. + Let's you decide on a system level if authentication is required. + HTTP request from client + true if user should be authenticated. + throw if no more attempts are allowed. + If no more attempts are allowed - + - Current state in parser. + Arguments used when more body bytes have come. - + - A request have been successfully parsed. + Initializes a new instance of the class. + buffer that contains the received bytes. + offset in buffer where to start processing. + number of bytes from that should be parsed. - + - More body bytes have been received. + Initializes a new instance of the class. - + - Request line have been received. + Gets or sets buffer that contains the received bytes. - + - A header have been received. + Gets or sets number of bytes from that should be parsed. - + - Gets or sets the log writer. + Gets or sets offset in buffer where to start processing. - + - Create a new request parser + Contains all HTTP Methods (according to the HTTP 1.1 specification) + + See: http://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html + - delegate receiving log entries. - + - Add a number of bytes to the body + The DELETE method requests that the origin server delete the resource identified by the Request-URI. - buffer containing more body bytes. - starting offset in buffer - number of bytes, from offset, to read. - offset to continue from. + + + This method MAY be overridden by human intervention (or other means) on the origin server. + The client cannot be guaranteed that the operation has been carried out, even if the status code + returned from the origin server indicates that the action has been completed successfully. + + + However, the server SHOULD NOT indicate success unless, at the time the response is given, + it intends to delete the resource or move it to an inaccessible location. + + + A successful response SHOULD be 200 (OK) if the response includes an entity describing the status, + 202 (Accepted) if the action has not yet been enacted, + or 204 (No Content) if the action has been enacted but the response does not include an entity. + + + If the request passes through a cache and the Request-URI identifies one or more currently cached entities, + those entries SHOULD be treated as stale. Responses to this method are not cacheable. + + - + - Remove all state information for the request. + The GET method means retrieve whatever information (in the form of an entity) is identified by the Request-URI. + + + If the Request-URI refers to a data-producing process, it is the produced data which shall be returned as the + entity in the response and not the source text of the process, unless that text happens to be the output of the process. + + + The semantics of the GET method change to a "conditional GET" if the request message includes an + If-Modified-Since, If-Unmodified-Since, If-Match, If-None-Match, or If-Range header field. + A conditional GET method requests that the entity be transferred only under the circumstances described + by the conditional header field(s). The conditional GET method is intended to reduce unnecessary network + usage by allowing cached entities to be refreshed without requiring multiple requests or transferring + data already held by the client. + + - + - Parse request line + The HEAD method is identical to GET except that the server MUST NOT return a message-body in the response. - - If line is incorrect - Expects the following format: "Method SP Request-URI SP HTTP-Version CRLF" + + The meta information contained in the HTTP headers in response to a HEAD request SHOULD be identical to the + information sent in response to a GET request. This method can be used for obtaining meta information about + the entity implied by the request without transferring the entity-body itself. + + This method is often used for testing hypertext links for validity, accessibility, and recent modification. + - + - We've parsed a new header. + The OPTIONS method represents a request for information about the communication options available on the request/response chain identified by the Request-URI. - Name in lower case - Value, unmodified. - If content length cannot be parsed. + + This method allows the client to determine the options and/or requirements associated with a resource, or the capabilities of a server, without implying a resource action or initiating a resource retrieval. + - + - Parse a message + The POST method is used to request that the origin server accept the entity enclosed + in the request as a new subordinate of the resource identified by the Request-URI in the Request-Line. - bytes to parse. - where in buffer that parsing should start - number of bytes to parse, starting on . - offset (where to start parsing next). - BadRequestException. + + POST is designed to allow a uniform method to cover the following functions: + + + Annotation of existing resources; + + Posting a message to a bulletin board, newsgroup, mailing list, or similar group of articles; + + Providing a block of data, such as the result of submitting a form, to a data-handling process; + + Extending a database through an append operation. + + + + If a resource has been created on the origin server, the response SHOULD be 201 (Created) and + contain an entity which describes the status of the request and refers to the new resource, and a + Location header (see section 14.30). + + + The action performed by the POST method might not result in a resource that can be identified by a URI. + In this case, either 200 (OK) or 204 (No Content) is the appropriate response status, depending on + whether or not the response includes an entity that describes the result. + + Responses to this method are not cacheable, unless the response includes appropriate Cache-Control + or Expires header fields. However, the 303 (See Other) response can be used to direct the user agent + to retrieve a cacheable resource. + + - + - Gets or sets the log writer. + The PUT method requests that the enclosed entity be stored under the supplied Request-URI. + + + + If the Request-URI refers to an already existing resource, the enclosed entity SHOULD be considered as a + modified version of the one residing on the origin server. + + If the Request-URI does not point to an existing resource, and that URI is capable of being defined as a new + resource by the requesting user agent, the origin server can create the resource with that URI. + + If a new resource is created, the origin server MUST inform the user agent via the 201 (Created) response. + + If an existing resource is modified, either the 200 (OK) or 204 (No Content) response codes SHOULD be sent to + indicate successful completion of the request. + + If the resource could not be created or modified with the Request-URI, an appropriate error response SHOULD be + given that reflects the nature of the problem. + + + + The recipient of the entity MUST NOT ignore any Content-* (e.g. Content-Range) headers that it does not + understand or implement and MUST return a 501 (Not Implemented) response in such cases. + + - + - Current state in parser. + The TRACE method is used to invoke a remote, application-layer loop- back of the request message. - + - A request have been successfully parsed. + Contains all HTTP Methods (according to the HTTP 1.1 specification) + + See: http://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html + - + - More body bytes have been received. + The DELETE method requests that the origin server delete the resource identified by the Request-URI. + + + This method MAY be overridden by human intervention (or other means) on the origin server. + The client cannot be guaranteed that the operation has been carried out, even if the status code + returned from the origin server indicates that the action has been completed successfully. + + + However, the server SHOULD NOT indicate success unless, at the time the response is given, + it intends to delete the resource or move it to an inaccessible location. + + + A successful response SHOULD be 200 (OK) if the response includes an entity describing the status, + 202 (Accepted) if the action has not yet been enacted, + or 204 (No Content) if the action has been enacted but the response does not include an entity. + + + If the request passes through a cache and the Request-URI identifies one or more currently cached entities, + those entries SHOULD be treated as stale. Responses to this method are not cacheable. + + - + - Request line have been received. + The GET method means retrieve whatever information (in the form of an entity) is identified by the Request-URI. + + + If the Request-URI refers to a data-producing process, it is the produced data which shall be returned as the + entity in the response and not the source text of the process, unless that text happens to be the output of the process. + + + The semantics of the GET method change to a "conditional GET" if the request message includes an + If-Modified-Since, If-Unmodified-Since, If-Match, If-None-Match, or If-Range header field. + A conditional GET method requests that the entity be transferred only under the circumstances described + by the conditional header field(s). The conditional GET method is intended to reduce unnecessary network + usage by allowing cached entities to be refreshed without requiring multiple requests or transferring + data already held by the client. + + - + - A header have been received. + The HEAD method is identical to GET except that the server MUST NOT return a message-body in the response. - - - - Response that is sent back to the web browser / client. - - A response can be sent if different ways. The easiest one is - to just fill the Body stream with content, everything else - will then be taken care of by the framework. The default content-type - is text/html, you should change it if you send anything else. + + The meta information contained in the HTTP headers in response to a HEAD request SHOULD be identical to the + information sent in response to a GET request. This method can be used for obtaining meta information about + the entity implied by the request without transferring the entity-body itself. - The second and slighty more complex way is to send the response - as parts. Start with sending the header using the SendHeaders method and - then you can send the body using SendBody method, but do not forget - to set ContentType and ContentLength before doing so. - - - public void MyHandler(IHttpRequest request, IHttpResponse response) - { - - } - + This method is often used for testing hypertext links for validity, accessibility, and recent modification. + - + - Add another header to the document. + The OPTIONS method represents a request for information about the communication options available on the request/response chain identified by the Request-URI. - Name of the header, case sensitive, use lower cases. - Header values can span over multiple lines as long as each line starts with a white space. New line chars should be \r\n - If headers already been sent. - If value conditions have not been met. - Adding any header will override the default ones and those specified by properties. + + This method allows the client to determine the options and/or requirements associated with a resource, or the capabilities of a server, without implying a resource action or initiating a resource retrieval. + - + - Send headers and body to the browser. + The POST method is used to request that the origin server accept the entity enclosed + in the request as a new subordinate of the resource identified by the Request-URI in the Request-Line. - If content have already been sent. + + POST is designed to allow a uniform method to cover the following functions: + + + Annotation of existing resources; + + Posting a message to a bulletin board, newsgroup, mailing list, or similar group of articles; + + Providing a block of data, such as the result of submitting a form, to a data-handling process; + + Extending a database through an append operation. + + + + If a resource has been created on the origin server, the response SHOULD be 201 (Created) and + contain an entity which describes the status of the request and refers to the new resource, and a + Location header (see section 14.30). + + + The action performed by the POST method might not result in a resource that can be identified by a URI. + In this case, either 200 (OK) or 204 (No Content) is the appropriate response status, depending on + whether or not the response includes an entity that describes the result. + + Responses to this method are not cacheable, unless the response includes appropriate Cache-Control + or Expires header fields. However, the 303 (See Other) response can be used to direct the user agent + to retrieve a cacheable resource. + + - + - Make sure that you have specified ContentLength and sent the headers first. + The PUT method requests that the enclosed entity be stored under the supplied Request-URI. - - If headers have not been sent. - - offest of first byte to send - number of bytes to send. - - - This method can be used if you want to send body contents without caching them first. This - is recommended for larger files to keep the memory usage low. + + + + If the Request-URI refers to an already existing resource, the enclosed entity SHOULD be considered as a + modified version of the one residing on the origin server. + + If the Request-URI does not point to an existing resource, and that URI is capable of being defined as a new + resource by the requesting user agent, the origin server can create the resource with that URI. + + If a new resource is created, the origin server MUST inform the user agent via the 201 (Created) response. + + If an existing resource is modified, either the 200 (OK) or 204 (No Content) response codes SHOULD be sent to + indicate successful completion of the request. + + If the resource could not be created or modified with the Request-URI, an appropriate error response SHOULD be + given that reflects the nature of the problem. + + + + The recipient of the entity MUST NOT ignore any Content-* (e.g. Content-Range) headers that it does not + understand or implement and MUST return a 501 (Not Implemented) response in such cases. + + - + - Make sure that you have specified ContentLength and sent the headers first. + The TRACE method is used to invoke a remote, application-layer loop- back of the request message. - - If headers have not been sent. - - - - This method can be used if you want to send body contents without caching them first. This - is recommended for larger files to keep the memory usage low. - + - Send headers to the client. + Used to create and reuse contexts. - If headers already been sent. - - - - + - Redirect client to somewhere else using the 302 status code. + Used to create es. - Destination of the redirect - If headers already been sent. - You can not do anything more with the request when a redirect have been done. This should be your last - action. - + - redirect to somewhere + Creates a that handles a connected client. - where the redirect should go - - No body are allowed when doing redirects. - + Client socket (accepted by the ). + A creates . - + - The body stream is used to cache the body contents - before sending everything to the client. It's the simplest - way to serve documents. + Create a secure . + Client socket (accepted by the ). + HTTPS certificate to use. + Kind of HTTPS protocol. Usually TLS or SSL. + A created . - + - Defines the version of the HTTP Response for applications where it's required - for this to be forced. + Server is shutting down so shut down the factory - + - The chunked encoding modifies the body of a message in order to - transfer it as a series of chunks, each with its own size indicator, - followed by an OPTIONAL trailer containing entity-header fields. This - allows dynamically produced content to be transferred along with the - information necessary for the recipient to verify that it has - received the full message. + A request have been received from one of the contexts. - + - Kind of connection + Initializes a new instance of the class. + The writer. + Amount of bytes to read from the incoming socket stream. + Used to create a request parser. - + - Encoding to use when sending stuff to the client. + Create a new context. - Default is UTF8 + true if socket is running HTTPS. + Client that connected + Network/SSL stream. + A context. - + - Number of seconds to keep connection alive + Create a new context. - Only used if Connection property is set to ConnectionType.KeepAlive + true if HTTPS is used. + Remote client + Network stream, uses . + A new context (always). - + - Status code that is sent to the client. + Create a secure . - Default is HttpStatusCode.Ok + Client socket (accepted by the ). + HTTPS certificate to use. + Kind of HTTPS protocol. Usually TLS or SSL. + + A created . + - + - Information about why a specific status code was used. + Creates a that handles a connected client. + Client socket (accepted by the ). + + A creates . + - + - Size of the body. MUST be specified before sending the header, - unless property Chunked is set to true. + Server is shutting down so shut down the factory - + - Kind of content in the body + True if detailed trace logs should be written. - Default is text/html - + - Headers have been sent to the client- + A request have been received from one of the contexts. - You can not send any additional headers if they have already been sent. - + - The whole response have been sent. + Custom network stream to mark sockets as reusable when disposing the stream. - + - Cookies that should be created/changed. + Creates a new instance of the class for the specified . + + The that the will use to send and receive data. + + + The parameter is null. + + + The parameter is not connected. + -or- + The property of the parameter is not . + -or- + The parameter is in a nonblocking state. + - + - Type of HTTP connection + Initializes a new instance of the class for the specified with the specified ownership. + + The that the will use to send and receive data. + + + Set to true to indicate that the will take ownership of the ; otherwise, false. + + + The parameter is null. + + + The parameter is not connected. + -or- + the value of the property of the parameter is not . + -or- + the parameter is in a nonblocking state. + - + - Connection is closed after each request-response + Creates a new instance of the class for the specified with the specified access rights. + + The that the will use to send and receive data. + + + A bitwise combination of the values that specify the type of access given to the over the provided . + + + The parameter is null. + + + The parameter is not connected. + -or- + the property of the parameter is not . + -or- + the parameter is in a nonblocking state. + - + - Connection is kept alive for X seconds (unless another request have been made) + Creates a new instance of the class for the specified with the specified access rights and the specified ownership. + + The that the will use to send and receive data. + + + A bitwise combination of the values that specifies the type of access given to the over the provided . + + + Set to true to indicate that the will take ownership of the ; otherwise, false. + + + The parameter is null. + + + The parameter is not connected. + -or- + The property of the parameter is not . + -or- + The parameter is in a nonblocking state. + - + - Response that is sent back to the web browser / client. + Closes the current stream and releases any resources (such as sockets and file handles) associated with the current stream. - - - A response can be sent if different ways. The easiest one is - to just fill the Body stream with content, everything else - will then be taken care of by the framework. The default content-type - is text/html, you should change it if you send anything else. - - The second and slightly more complex way is to send the response - as parts. Start with sending the header using the SendHeaders method and - then you can send the body using SendBody method, but do not forget - to set and before doing so. - - - - - // Example using response body. - class MyModule : HttpModule - { - public override bool Process(IHttpRequest request, IHttpResponse response, IHttpSession session) - { - StreamWriter writer = new StreamWriter(response.Body); - writer.WriteLine("Hello dear World!"); - writer.Flush(); - - // return true to tell webserver that we've handled the url - return true; - } - } - - - todo: add two examples, using SendHeaders/SendBody and just the Body stream. - + - Initializes a new instance of the class. + Releases the unmanaged resources used by the and optionally releases the managed resources. - Client that send the . - Contains information of what the client want to receive. - cannot be empty. + true to release both managed and unmanaged resources; false to release only unmanaged resources. - + - Initializes a new instance of the class. + Invoked when a client have been accepted by the - Client that send the . - Version of HTTP protocol that the client uses. - Type of HTTP connection used. + + Can be used to revoke incoming connections + - + - Add another header to the document. + Initializes a new instance of the class. - Name of the header, case sensitive, use lower cases. - Header values can span over multiple lines as long as each line starts with a white space. New line chars should be \r\n - If headers already been sent. - If value conditions have not been met. - Adding any header will override the default ones and those specified by properties. + The socket. - + - Send headers and body to the browser. + Client may not be handled. - If content have already been sent. - + - Make sure that you have specified and sent the headers first. + Accepted socket. - - If headers have not been sent. - - offset of first byte to send - number of bytes to send. - - - This method can be used if you want to send body contents without caching them first. This - is recommended for larger files to keep the memory usage low. - + - Make sure that you have specified and sent the headers first. + Client should be revoked. - - If headers have not been sent. - - - - This method can be used if you want to send body contents without caching them first. This - is recommended for larger files to keep the memory usage low. - + - Send headers to the client. + A session stored in memory. - If headers already been sent. - - - - + - Redirect client to somewhere else using the 302 status code. + Interface for sessions - Destination of the redirect - If headers already been sent. - You can not do anything more with the request when a redirect have been done. This should be your last - action. - + - redirect to somewhere + Remove everything from the session - where the redirect should go - - No body are allowed when doing redirects. - - + - The body stream is used to cache the body contents - before sending everything to the client. It's the simplest - way to serve documents. + Remove everything from the session + True if the session is cleared due to expiration - + - The chunked encoding modifies the body of a message in order to - transfer it as a series of chunks, each with its own size indicator, - followed by an OPTIONAL trailer containing entity-header fields. This - allows dynamically produced content to be transferred along with the - information necessary for the recipient to verify that it has - received the full message. + Session id - + - Defines the version of the HTTP Response for applications where it's required - for this to be forced. + Should + Name of the session variable + null if it's not set + If the object cant be serialized. - + - Kind of connection + When the session was last accessed. + This property is touched by the http server each time the + session is requested. - + - Encoding to use when sending stuff to the client. + Number of session variables. - Default is UTF8 - + - Number of seconds to keep connection alive + Event triggered upon clearing the session - Only used if Connection property is set to . - + - Status code that is sent to the client. + - Default is + A unique id used by the sessions store to identify the session - + - Information about why a specific status code was used. + Id + - + - Size of the body. MUST be specified before sending the header, - unless property Chunked is set to true. + Remove everything from the session - + - Kind of content in the body + Clears the specified expire. - Default type is "text/html" + True if the session is cleared due to expiration - + - Headers have been sent to the client- + Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. - You can not send any additional headers if they have already been sent. + 2 - + - The whole response have been sent. + Session id - + - Cookies that should be created/changed. + Should + Name of the session variable + null if it's not set - + - represents a HTTP input item. Each item can have multiple sub items, a sub item - is made in a HTML form by using square brackets + when the session was last accessed. - - // becomes: - Console.WriteLine("Value: {0}", form["user"]["FirstName"].Value); - - All names in a form SHOULD be in lowercase. + Used to determine when the session should be removed. - - Representation of a non-initialized . - - + - Initializes an input item setting its name/identifier and value + Number of values in the session - Parameter name/id - Parameter value - - - Creates a deep copy of the item specified - The item to copy - The function makes a deep copy of quite a lot which can be slow - + - Add another value to this item + Flag to indicate that the session have been changed + and should be saved into the session store. - Value to add. - Cannot add stuff to . - + - checks if a sub-item exists (and has a value). + Event triggered upon clearing the session - name in lower case - true if the sub-item exists and has a value; otherwise false. - - - Returns a formatted representation of the instance with the values of all contained parameters - + - Outputs the string in a formatted manner + A reverse proxy are used to act as a bridge between local (protected/hidden) websites + and public clients. + + A typical usage is to allow web servers on non standard ports to still be available + to the public clients, or allow web servers on private ips to be available. - A prefix to append, used internally - produce a query string - + - Add a sub item. + - Can contain array formatting, the item is then parsed and added in multiple levels - Value to add. - Argument is null. - Cannot add stuff to . + Base url requested from browser + Base url on private web server + + // this will return contents from http://192.168.1.128/view/jonas when client requests http://www.gauffin.com/user/view/jonas + _server.Add(new ReverseProxyModule("http://www.gauffin.com/user/", "http://192.168.1.128/"); + - + - Returns an enumerator that iterates through the collection. + Method that determines if an url should be handled or not by the module - - - A that can be used to iterate through the collection. - - 1 + Url requested by the client. + true if module should handle the url. - + - Returns an enumerator that iterates through a collection. + Method that process the url - - - An object that can be used to iterate through the collection. - - 2 + Information sent by the browser about the request + Information that is being sent back to the client. + Session used to - + - Outputs the string in a formatted manner + Can handle application/x-www-form-urlencoded - A prefix to append, used internally - - + - Number of values + Stream containing the content + Content type (with any additional info like boundry). Content type is always supplied in lower case + Stream encoding + + A HTTP form, or null if content could not be parsed. + + If contents in the stream is not valid input data. - + - Get a sub item + Checks if the decoder can handle the mime type - name in lower case. - if no item was found. + Content type (with any additional info like boundry). Content type is always supplied in lower case. + True if the decoder can parse the specified content type - + - Name of item (in lower case). + This provider is used to let us implement any type of form decoding we want without + having to rewrite anything else in the server. - + - Returns the first value, or null if no value exist. + + Should contain boundary and type, as in: multipart/form-data; boundary=---------------------------230051238959 + Stream containing form data. + Encoding used when decoding the stream + if no parser was found. + If stream is null or not readable. + If stream contents cannot be decoded properly. - + - Returns the last value, or null if no value exist. + Add a decoder. + + - + - Returns the list with values. + Number of added decoders. - + - + Use with care. - name in lower case - - + - Helpers making it easier to work with forms. + Decoder used for unknown content types. - - + - Used to let the website use different JavaScript libraries. - Default is + The server encountered an unexpected condition which prevented it from fulfilling the request. - + - Create a <form> tag. + Initializes a new instance of the class. - name of form - action to invoke on submit - form should be posted as Ajax - HTML code - - - // without options - WebHelper.FormStart("frmLogin", "/user/login", Request.IsAjax); - - // with options - WebHelper.FormStart("frmLogin", "/user/login", Request.IsAjax, "style", "display:inline", "class", "greenForm"); - - - HTML attributes or JavaScript options. - Method will ALWAYS be POST. - options must consist of name, value, name, value - + - Creates a select list with the values in a collection. + Initializes a new instance of the class. - Name of the SELECT-tag - collection used to generate options. - delegate used to return id and title from objects. - value that should be marked as selected. - First row should contain an empty value. - string containing a SELECT-tag. - + error message. - + - Creates a select list with the values in a collection. + Initializes a new instance of the class. - Name of the SELECT-tag - Id of the SELECT-tag - collection used to generate options. - delegate used to return id and title from objects. - value that should be marked as selected. - First row should contain an empty value. - string containing a SELECT-tag. - - - - // Class that is going to be used in a SELECT-tag. - public class User - { - private readonly string _realName; - private readonly int _id; - public User(int id, string realName) - { - _id = id; - _realName = realName; - } - public string RealName - { - get { return _realName; } - } - - public int Id - { - get { return _id; } - } - } - - // Using an inline delegate to generate the select list - public void UserInlineDelegate() - { - List<User> items = new List<User>(); - items.Add(new User(1, "adam")); - items.Add(new User(2, "bertial")); - items.Add(new User(3, "david")); - string htmlSelect = Select("users", "users", items, delegate(object o, out object id, out object value) - { - User user = (User)o; - id = user.Id; - value = user.RealName; - }, 2, true); - } + error message. + inner exception. + + + + Response that is sent back to the web browser / client. - // Using an method as delegate to generate the select list. - public void UseExternalDelegate() - { - List<User> items = new List<User>(); - items.Add(new User(1, "adam")); - items.Add(new User(2, "bertial")); - items.Add(new User(3, "david")); - string htmlSelect = Select("users", "users", items, UserOptions, 1, true); - } + A response can be sent if different ways. The easiest one is + to just fill the Body stream with content, everything else + will then be taken care of by the framework. The default content-type + is text/html, you should change it if you send anything else. - // delegate returning id and title - public static void UserOptions(object o, out object id, out object title) + The second and slighty more complex way is to send the response + as parts. Start with sending the header using the SendHeaders method and + then you can send the body using SendBody method, but do not forget + to set ContentType and ContentLength before doing so. + + + public void MyHandler(IHttpRequest request, IHttpResponse response) { - User user = (User)o; - id = user.Id; - value = user.RealName; + } - - name, id, collection or getIdTitle is null. - + - Creates a select list with the values in a collection. + Add another header to the document. - Name of the SELECT-tag - Id of the SELECT-tag - collection used to generate options. - delegate used to return id and title from objects. - value that should be marked as selected. - First row should contain an empty value. - name, value collection of extra HTML attributes. - string containing a SELECT-tag. - - name, id, collection or getIdTitle is null. - Invalid HTML attribute list. + Name of the header, case sensitive, use lower cases. + Header values can span over multiple lines as long as each line starts with a white space. New line chars should be \r\n + If headers already been sent. + If value conditions have not been met. + Adding any header will override the default ones and those specified by properties. - + - Generate a list of HTML options + Send headers and body to the browser. - collection used to generate options. - delegate used to return id and title from objects. - value that should be marked as selected. - First row should contain an empty value. - - collection or getIdTitle is null. + If content have already been sent. - - sb is null. + + + Make sure that you have specified ContentLength and sent the headers first. + + + If headers have not been sent. + + offest of first byte to send + number of bytes to send. + + + This method can be used if you want to send body contents without caching them first. This + is recommended for larger files to keep the memory usage low. - + - Creates a check box. + Make sure that you have specified ContentLength and sent the headers first. - element name - element value - determines if the check box is selected or not. This is done differently depending on the - type of variable. A boolean simply triggers checked or not, all other types are compared with "value" to determine if - the box is checked or not. - a list with additional attributes (name, value, name, value). - a generated radio button + + If headers have not been sent. + + + + This method can be used if you want to send body contents without caching them first. This + is recommended for larger files to keep the memory usage low. - + - Creates a check box. + Send headers to the client. - element name - element id - element value - determines if the check box is selected or not. This is done differently depending on the - type of variable. A boolean simply triggers checked or not, all other types are compared with "value" to determine if - the box is checked or not. - a list with additional attributes (name, value, name, value). - a generated radio button - - value in your business object. (check box will be selected if it matches the element value) - + If headers already been sent. + + + - + - Creates a check box. + Redirect client to somewhere else using the 302 status code. - element name - element id - determines if the check box is selected or not. This is done differently depending on the - type of variable. A boolean simply triggers checked or not, all other types are compared with "value" to determine if - the box is checked or not. - a list with additional attributes (name, value, name, value). - a generated radio button - will set value to "1". + Destination of the redirect + If headers already been sent. + You can not do anything more with the request when a redirect have been done. This should be your last + action. - + - Creates a RadioButton. + redirect to somewhere - element name - element value - determines if the radio button is selected or not. This is done differently depending on the - type of variable. A boolean simply triggers checked or not, all other types are compared with "value" to determine if - the box is checked or not. - a list with additional attributes (name, value, name, value). - a generated radio button + where the redirect should go + + No body are allowed when doing redirects. + - + - Creates a RadioButton. + The body stream is used to cache the body contents + before sending everything to the client. It's the simplest + way to serve documents. - element name - element id - element value - determines if the radio button is selected or not. This is done differently depending on the - type of variable. A boolean simply triggers checked or not, all other types are compared with "value" to determine if - the box is checked or not. - a list with additional attributes (name, value, name, value). - a generated radio button - + - form close tag + Defines the version of the HTTP Response for applications where it's required + for this to be forced. - - + - Add a component instance + The chunked encoding modifies the body of a message in order to + transfer it as a series of chunks, each with its own size indicator, + followed by an OPTIONAL trailer containing entity-header fields. This + allows dynamically produced content to be transferred along with the + information necessary for the recipient to verify that it has + received the full message. - Interface type - Instance to add - + - Get a component. + Kind of connection - Interface type - Component if registered, otherwise null. - - Component will get created if needed. - - - If instance cannot be created. + + + Encoding to use when sending stuff to the client. + + Default is UTF8 - + - Checks if the specified component interface have been added. + Number of seconds to keep connection alive - - true if found; otherwise false. + Only used if Connection property is set to ConnectionType.KeepAlive - + - Add a component. + Status code that is sent to the client. - Type being requested. - Type being created. - Type have already been mapped. + Default is HttpStatusCode.Ok - + - Arguments used when more body bytes have come. + Information about why a specific status code was used. - + - Initializes a new instance of the class. + Size of the body. MUST be specified before sending the header, + unless property Chunked is set to true. - buffer that contains the received bytes. - offset in buffer where to start processing. - number of bytes from that should be parsed. - + - Initializes a new instance of the class. + Kind of content in the body + Default is text/html - + - Gets or sets buffer that contains the received bytes. + Headers have been sent to the client- + You can not send any additional headers if they have already been sent. - + - Gets or sets number of bytes from that should be parsed. + The whole response have been sent. - + - Gets or sets offset in buffer where to start processing. + Cookies that should be created/changed. - + - Used to create and reuse contexts. + Type of HTTP connection - + - Used to create es. + Connection is closed after each request-response - + - Creates a that handles a connected client. + Connection is kept alive for X seconds (unless another request have been made) - Client socket (accepted by the ). - A creates . - + - Create a secure . + The website module let's you handle multiple websites in the same server. + It uses the "Host" header to check which site you want. - Client socket (accepted by the ). - HTTPS certificate to use. - Kind of HTTPS protocol. Usually TLS or SSL. - A created . + It's recommended that you do not + add any other modules to HttpServer if you are using the website module. Instead, + add all wanted modules to each website. - + - A request have been received from one of the contexts. + + domain name that should be handled. + - + - Initializes a new instance of the class. + Method that process the url - The writer. - Amount of bytes to read from the incoming socket stream. - Used to create a request parser. + Information sent by the browser about the request + Information that is being sent back to the client. + Session used to - + - Create a new context. + Name of site. - true if socket is running HTTPS. - Client that connected - Network/SSL stream. - A context. - + - Create a new context. + Used to inform http server that - true if HTTPS is used. - Remote client - Network stream, uses . - A new context (always). - + - Create a secure . + Eventarguments used when an exception is thrown by a module - Client socket (accepted by the ). - HTTPS certificate to use. - Kind of HTTPS protocol. Usually TLS or SSL. - - A created . - + the exception - + - Creates a that handles a connected client. + Exception thrown in a module - Client socket (accepted by the ). - - A creates . - - + - True if detailed trace logs should be written. + represents a HTTP input item. Each item can have multiple sub items, a sub item + is made in a HTML form by using square brackets + + // becomes: + Console.WriteLine("Value: {0}", form["user"]["FirstName"].Value); + + + All names in a form SHOULD be in lowercase. + - + + Representation of a non-initialized . + + - A request have been received from one of the contexts. + Initializes an input item setting its name/identifier and value + Parameter name/id + Parameter value - + + Creates a deep copy of the item specified + The item to copy + The function makes a deep copy of quite a lot which can be slow + + - Custom network stream to mark sockets as reusable when disposing the stream. + Add another value to this item + Value to add. + Cannot add stuff to . - + - Creates a new instance of the class for the specified . + checks if a sub-item exists (and has a value). - - The that the will use to send and receive data. - - - The parameter is null. - - - The parameter is not connected. - -or- - The property of the parameter is not . - -or- - The parameter is in a nonblocking state. - + name in lower case + true if the sub-item exists and has a value; otherwise false. - + + Returns a formatted representation of the instance with the values of all contained parameters + + - Initializes a new instance of the class for the specified with the specified ownership. + Outputs the string in a formatted manner - - The that the will use to send and receive data. - - - Set to true to indicate that the will take ownership of the ; otherwise, false. - - - The parameter is null. - - - The parameter is not connected. - -or- - the value of the property of the parameter is not . - -or- - the parameter is in a nonblocking state. - + A prefix to append, used internally + produce a query string - + - Creates a new instance of the class for the specified with the specified access rights. + Add a sub item. - - The that the will use to send and receive data. - - - A bitwise combination of the values that specify the type of access given to the over the provided . - - - The parameter is null. - - - The parameter is not connected. - -or- - the property of the parameter is not . - -or- - the parameter is in a nonblocking state. - + Can contain array formatting, the item is then parsed and added in multiple levels + Value to add. + Argument is null. + Cannot add stuff to . - + - Creates a new instance of the class for the specified with the specified access rights and the specified ownership. + Returns an enumerator that iterates through the collection. - - The that the will use to send and receive data. - - - A bitwise combination of the values that specifies the type of access given to the over the provided . - - - Set to true to indicate that the will take ownership of the ; otherwise, false. - - - The parameter is null. - - - The parameter is not connected. - -or- - The property of the parameter is not . - -or- - The parameter is in a nonblocking state. - + + + A that can be used to iterate through the collection. + + 1 - + - Closes the current stream and releases any resources (such as sockets and file handles) associated with the current stream. + Returns an enumerator that iterates through a collection. + + + An object that can be used to iterate through the collection. + + 2 - + - Releases the unmanaged resources used by the and optionally releases the managed resources. + Outputs the string in a formatted manner - true to release both managed and unmanaged resources; false to release only unmanaged resources. + A prefix to append, used internally + - + - Serves files that are stored in embedded resources. + Number of values - + - A HttpModule can be used to serve Uri's. The module itself - decides if it should serve a Uri or not. In this way, you can - get a very flexible http application since you can let multiple modules - serve almost similar urls. + Get a sub item - - Throw if you are using a and want to prompt for user name/password. - + name in lower case. + if no item was found. - + - Method that process the url + Name of item (in lower case). - Information sent by the browser about the request - Information that is being sent back to the client. - Session used to - true if this module handled the request. - + - Set the log writer to use. + Returns the first value, or null if no value exist. - logwriter to use. - + - Log something. + Returns the last value, or null if no value exist. - importance of log message - message - + - If true specifies that the module doesn't consume the processing of a request so that subsequent modules - can continue processing afterwards. Default is false. + Returns the list with values. - + - Initializes a new instance of the class. - Runs to make sure the basic mime types are available, they can be cleared later - through the use of if desired. + + name in lower case + - + + Class to handle loading of resource files + + - Initializes a new instance of the class. - Runs to make sure the basic mime types are available, they can be cleared later - through the use of if desired. + Initializes a new instance of the class. - The log writer to use when logging events - + - Mimtypes that this class can handle per default + Initializes a new instance of the class. + logger. - + - Loads resources from a namespace in the given assembly to an uri + Loads resources from a namespace in the given assembly to an URI - The uri to map the resources to + The URI to map the resources to The assembly in which the resources reside The namespace from which to load the resources + resourceLoader.LoadResources("/user/", typeof(User).Assembly, "MyLib.Models.User.Views"); - - will make ie the resource MyLib.Models.User.Views.stylesheet.css accessible via /user/stylesheet.css + + Will make the resource MyLib.Models.User.Views.list.Haml accessible via /user/list.haml or /user/list/ The amount of loaded files, giving you the possibility of making sure the resources needed gets loaded + If a resource has already been mapped to an uri - + - Returns true if the module can handle the request + Retrieves a stream for the specified resource path if loaded otherwise null + Path to the resource to retrieve a stream for + A stream or null if the resource couldn't be found - + - Method that process the url + Fetch all files from the resource that matches the specified arguments. - Information sent by the browser about the request - Information that is being sent back to the client. - Session used to - true if this module handled the request. + The path to the resource to extract + + a list of files if found; or an empty array if no files are found. + + Search path must end with an asterisk for finding arbitrary files - + - List with all mime-type that are allowed. + Fetch all files from the resource that matches the specified arguments. - All other mime types will result in a Forbidden http status code. + Where the file should reside. + Files to check + + a list of files if found; or an empty array if no files are found. + - + - The purpose of this module is to serve files. + Returns whether or not the loader has an instance of the file requested + The name of the template/file + True if the loader can provide the file - + - Initializes a new instance of the class. + Used when the request line have been successfully parsed. - Uri to serve, for instance "/files/" - Path on hard drive where we should start looking for files - If true a Last-Modifed header will be sent upon requests urging web browser to cache files - + - Initializes a new instance of the class. + Initializes a new instance of the class. - Uri to serve, for instance "/files/" - Path on hard drive where we should start looking for files + The HTTP method. + The URI path. + The HTTP version. - + - Mimtypes that this class can handle per default + Initializes a new instance of the class. - + - Determines if the request should be handled by this module. - Invoked by the + Gets or sets http method. - - true if this module should handle it. - - - Illegal path + + Should be one of the methods declared in . + - + - check if source contains any of the chars. + Gets or sets the version of the HTTP protocol that the client want to use. - - - - + - Method that process the Uri. + Gets or sets requested URI path. - Information sent by the browser about the request - Information that is being sent back to the client. - Session used to - Failed to find file extension - File type is forbidden. - + - return a file extension from an absolute Uri path (or plain filename) + Class that receives Requests from a . - - - + - List with all mime-type that are allowed. + Client have been disconnected. - All other mime types will result in a Forbidden http status code. + Client that was disconnected. + Reason + - + - characters that may not exist in a path. + Invoked when a client context have received a new HTTP request - - fileMod.ForbiddenChars = new string[]{ "\\", "..", ":" }; - + Client that received the request. + Request that was received. + - - - The server encountered an unexpected condition which prevented it from fulfilling the request. - + + Container for posted form data - - - Initializes a new instance of the class. - + + Instance to help mark a non-initialized form - - - Initializes a new instance of the class. - - error message. + + Initializes a form container with the specified name - + - Initializes a new instance of the class. + Makes a deep copy of the input - error message. - inner exception. + The input to copy - + - Class to make dynamic binding of redirects. Instead of having to specify a number of similar redirect rules - a regular expression can be used to identify redirect URLs and their targets. + Adds a file to the collection of posted files - - [a-z0-9]+)", "/users/${target}?find=true", RegexOptions.IgnoreCase) - ]]> - + The file to add + If the file is already added + If file is null + If the instance is HttpForm.EmptyForm which cannot be modified - + - Initializes a new instance of the class. + Checks if the form contains a specified file - Expression to match URL - Expression to generate URL - - [a-zA-Z0-9]+)", "/user/${first}")); - Result of ie. /employee1 will then be /user/employee1 - ]]> - + Field name of the file parameter + True if the file exists + If the instance is HttpForm.EmptyForm which cannot be modified - + - Initializes a new instance of the class. + Retrieves a file held by by the form - Expression to match URL - Expression to generate URL - Regular expression options to use, can be null - - [a-zA-Z0-9]+)", "/user/{first}", RegexOptions.IgnoreCase)); - Result of ie. /employee1 will then be /user/employee1 - ]]> - + The identifier of the file + The requested file or null if the file was not found + If name is null or empty + If the instance is HttpForm.EmptyForm which cannot be modified - + + Disposes all held HttpFile's and resets values + + - Initializes a new instance of the class. + Retrieves the number of files added to the - Expression to match URL - Expression to generate URL - Regular expression options to apply - true if request should be redirected, false if the request URI should be replaced. - - [a-zA-Z0-9]+)", "/user/${first}", RegexOptions.None)); - Result of ie. /employee1 will then be /user/employee1 - ]]> - - Argument is null. - + 0 if no files are added - + - Process the incoming request. + Contains a connection to a browser/client. - incoming HTTP request - outgoing HTTP response - true if response should be sent to the browser directly (no other rules or modules will be processed). - returning true means that no modules will get the request. Returning true is typically being done - for redirects. + Remember to after you have hooked the event. - If request or response is null + TODO: Maybe this class should be broken up into HttpClientChannel and HttpClientContext? - + - Used when the request line have been successfully parsed. + Initializes a new instance of the class. + + true if the connection is secured (SSL/TLS) + client that connected. + Stream used for communication + Used to create a . + Size of buffer to use when reading data. Must be at least 4096 bytes. + If fails + Stream must be writable and readable. + + + + Process incoming body bytes. + + Bytes - + - Initializes a new instance of the class. + - The HTTP method. - The URI path. - The HTTP version. + + - + - Initializes a new instance of the class. + Start reading content. + + Make sure to call base.Start() if you override this method. + - + - Gets or sets http method. + Clean up context. - Should be one of the methods declared in . + Make sure to call base.Cleanup() if you override the method. - + - Gets or sets the version of the HTTP protocol that the client want to use. + Disconnect from client + error to report in the event. - + - Gets or sets requested URI path. + Send a response. + Either or + HTTP status code + reason for the status code. + HTML body contents, can be null or empty. + A content type to return the body as, i.e. 'text/html' or 'text/plain', defaults to 'text/html' if null or empty + If is invalid. - + - Delegate used to find a realm/domain. + Send a response. - - - - Realms are used during HTTP Authentication - - - + Either or + HTTP status code + reason for the status code. - + - A complete HTTP server, you need to add a module to it to be able to handle incoming requests. + Send a response. - - - // this small example will add two web site modules, thus handling - // two different sites. In reality you should add Controller modules or something - // two the website modules to be able to handle different requests. - HttpServer server = new HttpServer(); - server.Add(new WebSiteModule("www.gauffin.com", "Gauffin Telecom AB")); - server.Add(new WebSiteModule("www.vapadi.se", "Remote PBX")); - - // start regular http - server.Start(IPAddress.Any, 80); - - // start https - server.Start(IPAddress.Any, 443, myCertificate); - - - - - + - + - Initializes a new instance of the class. + send a whole buffer - Used to get all components used in the server.. + buffer to send + - + - Initializes a new instance of the class. + Send data using the stream + Contains data to send + Start position in buffer + number of bytes to send + + - + - Initializes a new instance of the class. + This context have been cleaned, which means that it can be reused. - Form decoders are used to convert different types of posted data to the object types. - - - + - Initializes a new instance of the class. + Context have been started (a new client have connected) - A session store is used to save and retrieve sessions - - + - Initializes a new instance of the class. + Overload to specify own type. - The log writer. - + + Must be specified before the context is being used. + - + - Initializes a new instance of the class. + Using SSL or other encryption method. - Form decoders are used to convert different types of posted data to the object types. - The log writer. - - - - + - Initializes a new instance of the class. + Using SSL or other encryption method. - Form decoders are used to convert different types of posted data to the object types. - A session store is used to save and retrieve sessions - The log writer. - - - - - + - Adds the specified rule. + Specify which logger to use. - The rule. - + - Add a to the server. + Gets or sets the network stream. - mode to add - + - Decodes the request body. + Gets or sets IP address that the client connected from. - The request. - Failed to decode form data. - + - Generate a HTTP error page (that will be added to the response body). - response status code is also set. + Gets or sets port that the client connected from. - Response that the page will be generated in. - . - response body contents. - + - Generate a HTTP error page (that will be added to the response body). - response status code is also set. + The context have been disconnected. - Response that the page will be generated in. - exception. + + Event can be used to clean up a context, or to reuse it. + - + - Realms are used by the s. + A request have been received in the context. - HTTP request - domain/realm. - + - Process an incoming request. + Helpers to make XML handling easier - connection to client - request information - response that should be filled - session information - + - Can be overloaded to implement stuff when a client have been connected. + Serializes object to XML. + object to serialize. + XML - Default implementation does nothing. + Removes name spaces and adds indentation - client that disconnected - disconnect reason - + - Handle authentication + Create an object from a XML string - - - - true if request can be handled; false if not. - Invalid authorization header + Type of object + XML string + object - + - Will request authentication. + - - Sends respond to client, nothing else can be done with the response after this. - - - - + + + - + + Represents a field in a multipart form + + - Received from a when a request have been parsed successfully. + Small design by contract implementation. - that received the request. - The request. - + - To be able to track request count. + Check whether a parameter is empty. - - + Parameter value + Parameter name, or error description. + value is empty. - + - Start the web server using regular HTTP. + Checks whether a parameter is null. - IP Address to listen on, use IpAddress.Any to accept connections on all IP addresses/network cards. - Port to listen on. 80 can be a good idea =) - address is null. - Port must be a positive number. + Parameter value + Parameter name, or error description. + value is null. - + - Accept secure connections. + Checks whether a parameter is null. - IP Address to listen on, use to accept connections on all IP Addresses / network cards. - Port to listen on. 80 can be a good idea =) - Certificate to use - address is null. - Port must be a positive number. + + Parameter value + Parameter name, or error description. + value is null. - + - shut down the server and listeners + Priority for log entries + - + - write an entry to the log file + Very detailed logs to be able to follow the flow of the program. - importance of the message - log message - + - write an entry to the log file - - object that wrote the message - importance of the message - log message + Logs to help debug errors in the application + - + - Server that is handling the current request. + Information to be able to keep track of state changes etc. - - Will be set as soon as a request arrives to the object. - - + - Modules used for authentication. The module that is is added first is used as - the default authentication module. + Something did not go as we expected, but it's no problem. - Use the corresponding property - in the if you are using multiple websites. - + - Form decoder providers are used to decode request body (which normally contains form data). + Something that should not fail failed, but we can still keep + on going. - + - Server name sent in HTTP responses. + Something failed, and we cannot handle it properly. - - Do NOT include version in name, since it makes it - easier for hackers. - - + - Name of cookie where session id is stored. + Interface used to write to log files. - + - Specified where logging should go. + Write an entry to the log file. - - - + object that is writing to the log + importance of the log message + the message - + - Number of connections that can wait to be accepted by the server. + This class writes to the console. It colors the output depending on the logprio and includes a 3-level stacktrace (in debug mode) - Default is 10. + - + - Gets or sets maximum number of allowed simultaneous requests. + The actual instance of this class. - - - This property is useful in busy systems. The HTTP server - will start queuing new requests if this limit is hit, instead - of trying to process all incoming requests directly. - - - The default number if allowed simultaneous requests are 10. - - - + - Gets or sets maximum number of requests queuing to be handled. + Logwriters the specified source. - - - The WebServer will start turning requests away if response code - to indicate that the server - is too busy to be able to handle the request. - - + object that wrote the logentry. + Importance of the log message + The message. - + - Realms are used during HTTP authentication. - Default realm is same as server name. + Get color for the specified logprio + prio for the log entry + A for the prio - + - Let's to receive unhandled exceptions from the threads. + Default log writer, writes everything to null (nowhere). - - Exceptions will be thrown during debug mode if this event is not used, - exceptions will be printed to console and suppressed during release mode. - + - + - The request requires user authentication. The response MUST include a - WWW-Authenticate header field (section 14.47) containing a challenge - applicable to the requested resource. - - The client MAY repeat the request with a suitable Authorization header - field (section 14.8). If the request already included Authorization - credentials, then the 401 response indicates that authorization has been - refused for those credentials. If the 401 response contains the same challenge - as the prior response, and the user agent has already attempted authentication - at least once, then the user SHOULD be presented the entity that was given in the response, - since that entity might include relevant diagnostic information. - - HTTP access authentication is explained in rfc2617: - http://www.ietf.org/rfc/rfc2617.txt - - (description is taken from - http://www.submissionchamber.com/help-guides/error-codes.php#sec10.4.2) + The logging instance. - + - Create a new unauhtorized exception. + Writes everything to null - + object that wrote the log entry. + Importance of the log message + The message. - + - Create a new unauhtorized exception. + Response that is sent back to the web browser / client. - reason to why the request was unauthorized. - inner exception + + + A response can be sent if different ways. The easiest one is + to just fill the Body stream with content, everything else + will then be taken care of by the framework. The default content-type + is text/html, you should change it if you send anything else. + + The second and slightly more complex way is to send the response + as parts. Start with sending the header using the SendHeaders method and + then you can send the body using SendBody method, but do not forget + to set and before doing so. + + + + + // Example using response body. + class MyModule : HttpModule + { + public override bool Process(IHttpRequest request, IHttpResponse response, IHttpSession session) + { + StreamWriter writer = new StreamWriter(response.Body); + writer.WriteLine("Hello dear World!"); + writer.Flush(); + + // return true to tell webserver that we've handled the url + return true; + } + } + + + todo: add two examples, using SendHeaders/SendBody and just the Body stream. - + - Create a new unauhtorized exception. + Initializes a new instance of the class. - reason to why the request was unauthorized. + Client that send the . + Contains information of what the client want to receive. + cannot be empty. - + - Lists content type mime types. + Initializes a new instance of the class. + Client that send the . + Version of HTTP protocol that the client uses. + Type of HTTP connection used. - + - text/plain + Add another header to the document. + Name of the header, case sensitive, use lower cases. + Header values can span over multiple lines as long as each line starts with a white space. New line chars should be \r\n + If headers already been sent. + If value conditions have not been met. + Adding any header will override the default ones and those specified by properties. - + - text/haml + Send headers and body to the browser. + If content have already been sent. - + - content type for javascript documents = application/javascript + Make sure that you have specified and sent the headers first. - - - RFC 4329 states that text/javascript have been superseeded by - application/javascript. You might still want to check browser versions - since older ones do not support application/javascript. - - Browser support: http://krijnhoetmer.nl/stuff/javascript/mime-types/ - + + If headers have not been sent. + + offset of first byte to send + number of bytes to send. + + + This method can be used if you want to send body contents without caching them first. This + is recommended for larger files to keep the memory usage low. - + - text/xml + Make sure that you have specified and sent the headers first. + + If headers have not been sent. + + + + This method can be used if you want to send body contents without caching them first. This + is recommended for larger files to keep the memory usage low. - + - A list of content types + Send headers to the client. + If headers already been sent. + + + - + - + Redirect client to somewhere else using the 302 status code. - Semicolon separated content types. + Destination of the redirect + If headers already been sent. + You can not do anything more with the request when a redirect have been done. This should be your last + action. - + - Returns an enumerator that iterates through a collection. + redirect to somewhere - - An object that can be used to iterate through the collection. - + where the redirect should go + + No body are allowed when doing redirects. + - + - Searches for the specified type + The body stream is used to cache the body contents + before sending everything to the client. It's the simplest + way to serve documents. - Can also be a part of a type (searching for "xml" would return true for "application/xml"). - true if type was found. - + - Get this first content type. + The chunked encoding modifies the body of a message in order to + transfer it as a series of chunks, each with its own size indicator, + followed by an OPTIONAL trailer containing entity-header fields. This + allows dynamically produced content to be transferred along with the + information necessary for the recipient to verify that it has + received the full message. - + - Fetch a content type + Defines the version of the HTTP Response for applications where it's required + for this to be forced. - Part of type ("xml" would return "application/xml") - - All content types are in lower case. - + - Session store using memory for each session. + Kind of connection - + - Initializes the class setting the expirationtimer to clean the session every minute + Encoding to use when sending stuff to the client. + Default is UTF8 - + - Delegate for the cleanup timer + Number of seconds to keep connection alive + Only used if Connection property is set to . - + - Creates a new http session + Status code that is sent to the client. - + Default is - + - Creates a new http session with a specific id + Information about why a specific status code was used. - Id used to identify the new cookie.. - A object. - - Id should be generated by the store implementation if it's null or . - - + - Load an existing session. + Size of the body. MUST be specified before sending the header, + unless property Chunked is set to true. - - - + - Save an updated session to the store. + Kind of content in the body - + Default type is "text/html" - + - We use the flyweight pattern which reuses small objects - instead of creating new each time. + Headers have been sent to the client- - EmptyLanguageNode (unused) session that should be reused next time Create is called. + You can not send any additional headers if they have already been sent. - + - Remove expired sessions + The whole response have been sent. - + - Remove a session + Cookies that should be created/changed. - id of the session. - + - Load a session from the store + The requested resource was not found in the web server. - - null if session is not found. - + - Number of minutes before a session expires. - Default is 20 minutes. + Create a new exception + message describing the error + inner exception - + - Webhelper provides helpers for common tasks in HTML. + Create a new exception + message describing the error - + - Used to let the website use different javascript libraries. - Default is + Timeout Manager. Checks for dead clients. Clients with open connections that are not doing anything. Closes sessions opened with keepalive. - + - Creates a link that invokes through ajax. + Causes the watcher to immediately check the connections. - url to fetch - link title - - optional options in format "key, value, key, value". - Javascript options starts with ':'. - - a link tag - - WebHelper.AjaxRequest("/users/add/", "Add user", "method:", "post", "onclick", "validate('this');"); - - + - Builds a link that updates an element with the fetched ajax content. + Environment.TickCount is an int but it counts all 32 bits so it goes positive + and negative every 24.9 days. This trims down TickCount so it doesn't wrap + for the callers. + This trims it to a 12 day interval so don't let your frame time get too long. - Url to fetch content from - link title - html element to update with the results of the ajax request. - optional options in format "key, value, key, value" - A link tag. + - + - A link that pop ups a Dialog (overlay div) + Environment.TickCount is an int but it counts all 32 bits so it goes positive + and negative every 24.9 days. Subtracts the passed value (previously fetched by + 'EnvironmentTickCount()') and accounts for any wrapping. - url to contents of dialog - link title - name/value of html attributes. - A "a"-tag that popups a dialog when clicked - - WebHelper.DialogLink("/user/show/1", "show user", "onmouseover", "alert('booh!');"); - + + + subtraction of passed prevValue from current Environment.TickCount - + - Create/Open a dialog box using ajax + Environment.TickCount is an int but it counts all 32 bits so it goes positive + and negative every 24.9 days. Subtracts the passed value (previously fetched by + 'EnvironmentTickCount()') and accounts for any wrapping. - - - - + + + subtraction of passed prevValue from current Environment.TickCount - + - Close a javascript dialog window/div. + Environment.TickCount is an int but it counts all 32 bits so it goes positive + and negative every 24.9 days. Subtracts the passed value (previously fetched by + 'EnvironmentTickCount()') and accounts for any wrapping. - javascript for closing a dialog. - + subtraction of passed prevValue from current Environment.TickCount - + - Create a <form> tag. + Use a Thread or a Timer to monitor the ugly - name of form - action to invoke on submit - form should be posted as ajax - html code - - WebHelper.FormStart("frmLogin", "/user/login", Request.IsAjax); - - + - Create a link tag. + Session store using memory for each session. - url to go to - link title (text that is displayed) - html attributes, name, value, name, value - html code - - WebHelper.Link("/user/show/1", "Show user", "id", "showUser", "onclick", "return confirm('Are you shure?');"); - - + - Build a link + A session store is used to store and load sessions on a media. + The default implementation () saves/retrieves sessions from memory. - url to go to. - title of link (displayed text) - extra html attributes. - a complete link - + - Build a link + Creates a new http session with a generated id. - url to go to. - title of link (displayed text) - extra html attributes. - a complete link - more options + A object - + - Obsolete + Creates a new http session with a specific id - Obsolete - Obsolete - Obsolete - Obsolete - Obsolete - Obsolete + Id used to identify the new cookie.. + A object. + + Id should be generated by the store implementation if it's null or . + - + - Obsolete + Load an existing session. - Obsolete - Obsolete - Obsolete - Obsolete - Obsolete - Obsolete - Obsolete + Session id (usually retrieved from a client side cookie). + A session if found; otherwise null. - + - Render errors into a UL with class "errors" + Save an updated session to the store. - class used by UL-tag. - items to list - an unordered html list. + Session id (usually retrieved from a client side cookie). + If Id property have not been specified. - + - Render errors into a UL with class "errors" + We use the flyweight pattern which reuses small objects + instead of creating new each time. - class used by UL-tag. - items to list - an unordered html list. + Unused session that should be reused next time Create is called. - + - Render errors into a UL with class "errors" + Remove expired sessions - - - + - Generates a list with html attributes. + Remove a session - StringBuilder that the options should be added to. - attributes set by user. - attributes set by any of the helper classes. + id of the session. - + - Generates a list with html attributes. + Load a session from the store - StringBuilder that the options should be added to. - + + null if session is not found. - + - Purpose of this class is to create a javascript toolkit independent javascript helper. + Number of minutes before a session expires. + Default time is 20 minutes. - + - Generates a list with JS options. + Initializes the class setting the expirationtimer to clean the session every minute - StringBuilder that the options should be added to. - the javascript options. name, value pairs. each string value should be escaped by YOU! - true if we should start with a comma. - + - Removes any javascript parameters from an array of parameters + Delegate for the cleanup timer - The array of parameters to remove javascript params from - An array of html parameters - + - javascript action that should be added to the "onsubmit" event in the form tag. + Creates a new http session - All javascript option names should end with colon. - - - JSHelper.AjaxRequest("/user/show/1", "onsuccess:", "$('userInfo').update(result);"); - - - + - Requests a url through ajax + Creates a new http session with a specific id - url to fetch - optional options in format "key, value, key, value", used in JS request object. - a link tag - All javascript option names should end with colon. - - - JSHelper.AjaxRequest("/user/show/1", "onsuccess:", "$('userInfo').update(result);"); - - + Id used to identify the new cookie.. + A object. + + Id should be generated by the store implementation if it's null or . + - + - Ajax requests that updates an element with - the fetched content + Load an existing session. - Url to fetch content from - element to update - optional options in format "key, value, key, value", used in JS updater object. - A link tag. - All javascript option names should end with colon. - - - JSHelper.AjaxUpdater("/user/show/1", "userInfo", "onsuccess:", "alert('Successful!');"); - - + + - + - A link that pop ups a Dialog (overlay div) + Save an updated session to the store. - url to contents of dialog - link title - A "a"-tag that popups a dialog when clicked - name/value of html attributes - - WebHelper.DialogLink("/user/show/1", "show user", "onmouseover", "alert('booh!');"); - + - + - Close a javascript dialog window/div. + We use the flyweight pattern which reuses small objects + instead of creating new each time. - javascript for closing a dialog. - + EmptyLanguageNode (unused) session that should be reused next time Create is called. - + - Creates a new modal dialog window + Remove expired sessions - url to open in window. - window title (may not be supported by all js implementations) - - - + - + Remove a session - - - + id of the session. - - Represents a field in a multipart form + + + Load a session from the store + + + null if session is not found. - + - The request could not be understood by the server due to malformed syntax. - The client SHOULD NOT repeat the request without modifications. - - Text taken from: http://www.submissionchamber.com/help-guides/error-codes.php + Number of minutes before a session expires. + Default is 20 minutes. - + - Create a new bad request exception. + Arguments sent when a is cleared - reason to why the request was bad. - + - Create a new bad request exception. + Instantiates the arguments for the event - reason to why the request was bad. - inner exception + True if the session is cleared due to expiration - + - Container class for posted files + Returns true if the session is cleared due to expiration - + - Creates a container for a posted file + Delegate for when a IHttpSession is cleared - The identifier of the post field - The file path - The content type of the file - The name of the file uploaded - If any parameter is null or empty + this is being cleared. + Arguments for the clearing - + - Creates a container for a posted file + Used to queue incoming requests. - If any parameter is null or empty - - Destructor disposing the file + + + Initializes a new instance of the class. + + Called when a request should be processed. - + - Deletes the temporary file + Used to process queued requests. - True if manual dispose - + - Disposing interface, cleans up managed resources (the temporary file) and suppresses finalization + Gets or sets maximum number of allowed simultaneous requests. - + - The name/id of the file + Gets or sets maximum number of requests queuing to be handled. - + - The full file path + Specifies how many requests the HTTP server is currently processing. - + - The name of the uploaded file + Used two queue incoming requests to avoid + thread starvation. - + - The type of file + Method used to process a queued request + Context that the request was received from. + Request to process. - + - Will contain helper functions for javascript. + Event arguments used when a new header have been parsed. - + - Requests a url through ajax + Initializes a new instance of the class. - url to fetch. Url is NOT enclosed in quotes by the implementation. You need to do that yourself. - optional options in format "key, value, key, value", used in JS request object. All keys should end with colon. - a link tag - onclick attribute is used by this method. - - - // plain text - JSHelper.AjaxRequest("'/user/show/1'"); - - // ajax request using this.href - string link = "<a href=\"/user/call/1\" onclick=\"" + JSHelper.AjaxRequest("this.href") + "/<call user</a>"; - - + Name of header. + Header value. - + - Ajax requests that updates an element with - the fetched content + Initializes a new instance of the class. - url to fetch. Url is NOT enclosed in quotes by the implementation. You need to do that yourself. - element to update - options in format "key, value, key, value". All keys should end with colon. - A link tag. - - - JSHelper.AjaxUpdater("'/user/show/1'", "user", "onsuccess:", "alert('hello');", "asynchronous:", "true"); - - - + - Opens contents in a dialog window. + Gets or sets header name. - url to contents of dialog - link title - name, value, name, value, all parameter names should end with colon. - + - Close a javascript dialog window/div. + Gets or sets header value. - javascript for closing a dialog. - @@ -4738,39 +4843,113 @@ Gets whether the request was made by Ajax (Asynchronous JavaScript) - + + + Gets cookies that was sent with the request. + + + + + Add a component instance + + Interface type + Instance to add + + + + Get a component. + + Interface type + Component if registered, otherwise null. + + Component will get created if needed. + + + + If instance cannot be created. + + + + Checks if the specified component interface have been added. + + + true if found; otherwise false. + + + + Add a component. + + Type being requested. + Type being created. + Type have already been mapped. + + - Gets cookies that was sent with the request. + Class to make dynamic binding of redirects. Instead of having to specify a number of similar redirect rules + a regular expression can be used to identify redirect URLs and their targets. + + [a-z0-9]+)", "/users/${target}?find=true", RegexOptions.IgnoreCase) + ]]> + - + - The website module let's you handle multiple websites in the same server. - It uses the "Host" header to check which site you want. + Initializes a new instance of the class. - It's recommended that you do not - add any other modules to HttpServer if you are using the website module. Instead, - add all wanted modules to each website. + Expression to match URL + Expression to generate URL + + [a-zA-Z0-9]+)", "/user/${first}")); + Result of ie. /employee1 will then be /user/employee1 + ]]> + - + - + Initializes a new instance of the class. - domain name that should be handled. - + Expression to match URL + Expression to generate URL + Regular expression options to use, can be null + + [a-zA-Z0-9]+)", "/user/{first}", RegexOptions.IgnoreCase)); + Result of ie. /employee1 will then be /user/employee1 + ]]> + - + - Method that process the url + Initializes a new instance of the class. - Information sent by the browser about the request - Information that is being sent back to the client. - Session used to + Expression to match URL + Expression to generate URL + Regular expression options to apply + true if request should be redirected, false if the request URI should be replaced. + + [a-zA-Z0-9]+)", "/user/${first}", RegexOptions.None)); + Result of ie. /employee1 will then be /user/employee1 + ]]> + + Argument is null. + - + - Name of site. + Process the incoming request. + incoming HTTP request + outgoing HTTP response + true if response should be sent to the browser directly (no other rules or modules will be processed). + + returning true means that no modules will get the request. Returning true is typically being done + for redirects. + + If request or response is null @@ -4812,30 +4991,6 @@ Retrieves the full path name to the resource file - - - Creates request parsers when needed. - - - - - Creates request parsers when needed. - - - - - Create a new request parser. - - Used when logging should be enabled. - A new request parser. - - - - Create a new request parser. - - Used when logging should be enabled. - A new request parser. - The "basic" authentication scheme is based on the model that the @@ -4921,533 +5076,499 @@ Adding bytes to body - - - This decoder converts XML documents to form items. - Each element becomes a subitem in the form, and each attribute becomes an item. - - - // xml: somethingdata - // result: - // form["hello"].Value = "something" - // form["hello"]["id"].Value = 1 - // form["hello"]["world]["id"].Value = 1 - // form["hello"]["world"].Value = "data" - - - The original xml document is stored in form["__xml__"].Value. - - - - - - - Stream containing the content - Content type (with any additional info like boundry). Content type is always supplied in lower case - Stream encoding - Note: contentType and encoding are not used? - A http form, or null if content could not be parsed. - - - - - Recursive function that will go through an xml element and store it's content - to the form item. - - (parent) Item in form that content should be added to. - Node that should be parsed. - - - - Checks if the decoder can handle the mime type - - Content type (with any additional info like boundry). Content type is always supplied in lower case. - True if the decoder can parse the specified content type - - - - Cookies that should be set. - - - - - Adds a cookie in the collection. - - cookie to add - cookie is null - - - - Copy a request cookie - - - When the cookie should expire - - - - Gets a collection enumerator on the cookie list. - - collection enumerator - - + - Remove all cookies + Will contain helper functions for javascript. - + - Returns an enumerator that iterates through the collection. + Requests a url through ajax + url to fetch. Url is NOT enclosed in quotes by the implementation. You need to do that yourself. + optional options in format "key, value, key, value", used in JS request object. All keys should end with colon. + a link tag + onclick attribute is used by this method. + + + // plain text + JSHelper.AjaxRequest("'/user/show/1'"); - - A that can be used to iterate through the collection. - - 1 + // ajax request using this.href + string link = "<a href=\"/user/call/1\" onclick=\"" + JSHelper.AjaxRequest("this.href") + "/<call user</a>"; + + - + - Gets the count of cookies in the collection. + Ajax requests that updates an element with + the fetched content + url to fetch. Url is NOT enclosed in quotes by the implementation. You need to do that yourself. + element to update + options in format "key, value, key, value". All keys should end with colon. + A link tag. + + + JSHelper.AjaxUpdater("'/user/show/1'", "user", "onsuccess:", "alert('hello');", "asynchronous:", "true"); + + - + - Gets the cookie of a given identifier (null if not existing). + Opens contents in a dialog window. + url to contents of dialog + link title + name, value, name, value, all parameter names should end with colon. - + - This class is created as a wrapper, since there are two different cookie types in .Net (Cookie and HttpCookie). - The framework might switch class in the future and we dont want to have to replace all instances + Close a javascript dialog window/div. + javascript for closing a dialog. + - + - Let's copy all the cookies. + Lists content type mime types. - value from cookie header. - + - Adds a cookie in the collection. + text/plain - cookie to add - cookie is null - + - Gets a collection enumerator on the cookie list. + text/haml - collection enumerator - + - Remove all cookies. + content type for javascript documents = application/javascript + + + RFC 4329 states that text/javascript have been superseeded by + application/javascript. You might still want to check browser versions + since older ones do not support application/javascript. + + Browser support: http://krijnhoetmer.nl/stuff/javascript/mime-types/ + - + - Returns an enumerator that iterates through the collection. + text/xml - - - A that can be used to iterate through the collection. - - 1 - + - Remove a cookie from the collection. + A list of content types - Name of cookie. - + - Gets the count of cookies in the collection. + + Semicolon separated content types. - + - Gets the cookie of a given identifier (null if not existing). + Returns an enumerator that iterates through a collection. + + An object that can be used to iterate through the collection. + - + - New implementation of the HTTP listener. + Searches for the specified type - - Use the Create methods to create a default listener. - + Can also be a part of a type (searching for "xml" would return true for "application/xml"). + true if type was found. - + - Initializes a new instance of the class. + Get this first content type. - IP Address to accept connections on - TCP Port to listen on, default HTTP port is 80. - Factory used to create es. - address is null. - Port must be a positive number. - + - Initializes a new instance of the class. + Fetch a content type - The address. - The port. - The factory. - The certificate. + Part of type ("xml" would return "application/xml") + + All content types are in lower case. - + - Initializes a new instance of the class. + Creates request parsers when needed. - The address. - The port. - The factory. - The certificate. - The protocol. - + - Creates a new instance with default factories. + Creates request parsers when needed. - Address that the listener should accept connections on. - Port that listener should accept connections on. - Created HTTP listener. - + - Creates a new instance with default factories. + Create a new request parser. - Address that the listener should accept connections on. - Port that listener should accept connections on. - Certificate to use - Created HTTP listener. + Used when logging should be enabled. + A new request parser. - + - Creates a new instance with default factories. + Create a new request parser. - Address that the listener should accept connections on. - Port that listener should accept connections on. - Certificate to use - which HTTPS protocol to use, default is TLS. - Created HTTP listener. + Used when logging should be enabled. + A new request parser. - + - Can be used to create filtering of new connections. + The request requires user authentication. The response MUST include a + WWW-Authenticate header field (section 14.47) containing a challenge + applicable to the requested resource. + + The client MAY repeat the request with a suitable Authorization header + field (section 14.8). If the request already included Authorization + credentials, then the 401 response indicates that authorization has been + refused for those credentials. If the 401 response contains the same challenge + as the prior response, and the user agent has already attempted authentication + at least once, then the user SHOULD be presented the entity that was given in the response, + since that entity might include relevant diagnostic information. + + HTTP access authentication is explained in rfc2617: + http://www.ietf.org/rfc/rfc2617.txt + + (description is taken from + http://www.submissionchamber.com/help-guides/error-codes.php#sec10.4.2) - Accepted socket - - true if connection can be accepted; otherwise false. - - + - A client have been accepted, but not handled, by the listener. + Create a new unauhtorized exception. + - + - Generic helper functions for HTTP + Create a new unauhtorized exception. + reason to why the request was unauthorized. + inner exception - + - Version string for HTTP v1.0 + Create a new unauhtorized exception. + reason to why the request was unauthorized. - + - Version string for HTTP v1.1 + The purpose of this module is to serve files. - + - An empty URI + Initializes a new instance of the class. + Uri to serve, for instance "/files/" + Path on hard drive where we should start looking for files + If true a Last-Modifed header will be sent upon requests urging web browser to cache files - + - Parses a query string. + Initializes a new instance of the class. - Query string (URI encoded) - A object if successful; otherwise - queryString is null. - If string cannot be parsed. + Uri to serve, for instance "/files/" + Path on hard drive where we should start looking for files - + - A reverse proxy are used to act as a bridge between local (protected/hidden) websites - and public clients. - - A typical usage is to allow web servers on non standard ports to still be available - to the public clients, or allow web servers on private ips to be available. + Mimtypes that this class can handle per default - + - + Determines if the request should be handled by this module. + Invoked by the - Base url requested from browser - Base url on private web server - - // this will return contents from http://192.168.1.128/view/jonas when client requests http://www.gauffin.com/user/view/jonas - _server.Add(new ReverseProxyModule("http://www.gauffin.com/user/", "http://192.168.1.128/"); - + + true if this module should handle it. - + + Illegal path + + - Method that determines if an url should be handled or not by the module + check if source contains any of the chars. - Url requested by the client. - true if module should handle the url. + + + - + - Method that process the url + Method that process the Uri. Information sent by the browser about the request Information that is being sent back to the client. Session used to + Failed to find file extension + File type is forbidden. - + - Used to inform http server that + return a file extension from an absolute Uri path (or plain filename) + + - + - Eventarguments used when an exception is thrown by a module + List with all mime-type that are allowed. - the exception + All other mime types will result in a Forbidden http status code. - + - Exception thrown in a module + characters that may not exist in a path. + + fileMod.ForbiddenChars = new string[]{ "\\", "..", ":" }; + - + - PrototypeJS implementation of the javascript functions. + Webhelper provides helpers for common tasks in HTML. - + - Requests a url through ajax + Used to let the website use different javascript libraries. + Default is - url to fetch. Url is NOT enclosed in quotes by the implementation. You need to do that yourself. - optional options in format "key, value, key, value", used in JS request object. All keys should end with colon. - a link tag - onclick attribute is used by this method. - - - // plain text - JSHelper.AjaxRequest("'/user/show/1'"); - - // ajax request using this.href - string link = "<a href=\"/user/call/1\" onclick=\"" + JSHelper.AjaxRequest("this.href") + "/<call user</a>"; - - - + - Determins if a list of strings contains a specific value + Creates a link that invokes through ajax. - options to check in - value to find - true if value was found - case insensitive + url to fetch + link title + + optional options in format "key, value, key, value". + Javascript options starts with ':'. + + a link tag + + WebHelper.AjaxRequest("/users/add/", "Add user", "method:", "post", "onclick", "validate('this');"); + - + - Ajax requests that updates an element with - the fetched content + Builds a link that updates an element with the fetched ajax content. - URL to fetch. URL is NOT enclosed in quotes by the implementation. You need to do that yourself. - element to update - options in format "key, value, key, value". All keys should end with colon. + Url to fetch content from + link title + html element to update with the results of the ajax request. + optional options in format "key, value, key, value" A link tag. - - - JSHelper.AjaxUpdater("'/user/show/1'", "user", "onsuccess:", "alert('hello');", "asynchronous:", "true"); - - - + A link that pop ups a Dialog (overlay div) - URL to contents of dialog + url to contents of dialog link title - name, value, name, value - - A "a"-tag that popups a dialog when clicked - - Requires Control.Modal found here: http://livepipe.net/projects/control_modal/ - And the following JavaScript (load it in application.js): - - Event.observe(window, 'load', - function() { - document.getElementsByClassName('modal').each(function(link){ new Control.Modal(link); }); - } - ); - - + name/value of html attributes. + A "a"-tag that popups a dialog when clicked WebHelper.DialogLink("/user/show/1", "show user", "onmouseover", "alert('booh!');"); - + - create a modal dialog (usually using DIVs) + Create/Open a dialog box using ajax - url to fetch - dialog title - javascript/html attributes. javascript options ends with colon ':'. + + + - + Close a javascript dialog window/div. javascript for closing a dialog. - + - + - javascript action that should be added to the "onsubmit" event in the form tag. + Create a <form> tag. - remember to encapsulate strings in '' - - All javascript option names should end with colon. + name of form + action to invoke on submit + form should be posted as ajax + html code - - JSHelper.AjaxRequest("/user/show/1", "onsuccess:", "$('userInfo').update(result);"); - + WebHelper.FormStart("frmLogin", "/user/login", Request.IsAjax); - - - Implements HTTP Digest authentication. It's more secure than Basic auth since password is - encrypted with a "key" from the server. - - - Keep in mind that the password is encrypted with MD5. Use a combination of SSL and digest auth to be secure. - - - - - Initializes a new instance of the class. - - Delegate used to provide information used during authentication. - Delegate used to determine if authentication is required (may be null). - - - - Initializes a new instance of the class. - - Delegate used to provide information used during authentication. - - + - Used by test classes to be able to use hardcoded values + Create a link tag. + url to go to + link title (text that is displayed) + html attributes, name, value, name, value + html code + + WebHelper.Link("/user/show/1", "Show user", "id", "showUser", "onclick", "return confirm('Are you shure?');"); + - + - An authentication response have been received from the web browser. - Check if it's correct + Build a link - Contents from the Authorization header - Realm that should be authenticated - GET/POST/PUT/DELETE etc. - First option: true if username/password is correct but not cnonce - - Authentication object that is stored for the request. A user class or something like that. - - if authenticationHeader is invalid - If any of the paramters is empty or null. + url to go to. + title of link (displayed text) + extra html attributes. + a complete link - + - Encrypts parameters into a Digest string + Build a link - Realm that the user want to log into. - User logging in - Users password. - HTTP method. - Uri/domain that generated the login prompt. - Quality of Protection. - "Number used ONCE" - Hexadecimal request counter. - "Client Number used ONCE" - Digest encrypted string + url to go to. + title of link (displayed text) + extra html attributes. + a complete link + more options - + - + Obsolete - Md5 hex encoded "userName:realm:password", without the quotes. - Md5 hex encoded "method:uri", without the quotes - Quality of Protection - "Number used ONCE" - Hexadecimal request counter. - Client number used once - + Obsolete + Obsolete + Obsolete + Obsolete + Obsolete + Obsolete - + - Create a response that can be sent in the WWW-Authenticate header. + Obsolete - Realm that the user should authenticate in - First options specifies if true if username/password is correct but not cnonce. - A correct auth request. - If realm is empty or null. + Obsolete + Obsolete + Obsolete + Obsolete + Obsolete + Obsolete + Obsolete - + - Decodes authorization header value + Render errors into a UL with class "errors" - header value - Encoding that the buffer is in - All headers and their values if successful; otherwise null - - NameValueCollection header = DigestAuthentication.Decode("response=\"6629fae49393a05397450978507c4ef1\",\r\nc=00001", Encoding.ASCII); - - Can handle lots of whitespaces and new lines without failing. + class used by UL-tag. + items to list + an unordered html list. - + - Gets the current nonce. + Render errors into a UL with class "errors" - + class used by UL-tag. + items to list + an unordered html list. - + - Gets the Md5 hash bin hex2. + Render errors into a UL with class "errors" - To be hashed. + - + - determines if the nonce is valid or has expired. + Generates a list with html attributes. - nonce value (check wikipedia for info) - true if the nonce has not expired. + StringBuilder that the options should be added to. + attributes set by user. + attributes set by any of the helper classes. - + - name used in http request. + Generates a list with html attributes. + StringBuilder that the options should be added to. + - + - Gets or sets whether the token supplied in is a - HA1 generated string. + Delegate used by to populate select options. + current object (for instance a User). + Text that should be displayed in the value part of a <optiongt;-tag. + Text shown in the select list. + + // Class that is going to be used in a SELECT-tag. + public class User + { + private readonly string _realName; + private readonly int _id; + public User(int id, string realName) + { + _id = id; + _realName = realName; + } + public string RealName + { + get { return _realName; } + } + + public int Id + { + get { return _id; } + } + } + + // Using an inline delegate to generate the select list + public void UserInlineDelegate() + { + List<User> items = new List<User>(); + items.Add(new User(1, "adam")); + items.Add(new User(2, "bertial")); + items.Add(new User(3, "david")); + string htmlSelect = Select("users", "users", items, delegate(object o, out object id, out object value) + { + User user = (User)o; + id = user.Id; + value = user.RealName; + }, 2, true); + } + + // Using an method as delegate to generate the select list. + public void UseExternalDelegate() + { + List<User> items = new List<User>(); + items.Add(new User(1, "adam")); + items.Add(new User(2, "bertial")); + items.Add(new User(3, "david")); + string htmlSelect = Select("users", "users", items, UserOptions, 1, true); + } + + // delegate returning id and title + public static void UserOptions(object o, out object id, out object title) + { + User user = (User)o; + id = user.Id; + value = user.RealName; + } /// -- cgit v1.1