2using System.Collections.Generic;
3using System.Collections.Specialized;
34 foreach (
string key
in headers.AllKeys)
36 t.SetProperty(key, headers[key]);
51 foreach (Cookie cookie
in cookies)
67 foreach (KeyValuePair<string, BadObject> kvp
in src.InnerTable)
74 dst[kvp.Key] = v.Value;
91 StreamReader sr =
new StreamReader(content, enc);
93 return sr.ReadToEnd();
101 byte[] data =
new byte[content.Length];
102 int read = content.Read(data, 0, data.Length);
104 if (read != data.Length)
174 table.SetFunction(
"SetHeader", (
string key,
string value) => resp.Headers[key] = value);
176 table.SetFunction(
"SetCookie", (Cookie cookie) => resp.Cookies.Add(cookie));
183 if (cookie is BadReflectedObject { Instance: Cookie c })
194 table.SetFunction(
"SetStatusCode", (
int code) => resp.StatusCode = code);
195 table.SetFunction(
"SetStatusDescription", (
string desc) => resp.StatusDescription = desc);
196 table.SetFunction(
"SetContentType", (
string type) => resp.ContentType = type);
197 table.SetFunction(
"SetContentEncoding", (
string enc) => resp.ContentEncoding = Encoding.GetEncoding(enc));
198 table.SetFunction(
"SetContentLength", (
long len) => resp.ContentLength64 = len);
199 table.SetFunction(
"SetKeepAlive", (
bool keepAlive) => resp.KeepAlive = keepAlive);
200 table.SetFunction(
"Redirect", (
string location) => resp.Redirect(location));
201 table.SetFunction(
"Abort", resp.Abort);
202 table.SetFunction(
"Close", resp.Close);
207 byte[] data = (resp.ContentEncoding ?? Encoding.UTF8).GetBytes(content);
208 resp.OutputStream.Write(data, 0, data.Length);
218 AddContextExtensions(provider);
219 AddRequestExtensions(provider);
Exception that is thrown when the remote console encounters an error.
Wrapper for the HttpListenerContext.
HttpListenerContext Context
The underlying HttpListenerContext.
Wrapper for the HttpListenerRequest.
HttpListenerRequest Request
The underlying HttpListenerRequest.
Implements Extensions for the "NetHost" Api.
void AddRequestExtensions(BadInteropExtensionProvider provider)
Adds Extensions for the BadHttpRequest Object.
override void AddExtensions(BadInteropExtensionProvider provider)
static void CopyHeaderTable(NameValueCollection dst, BadTable src)
Copies the Headers from the BadScript Table to the Http Header Table.
static BadTable CreateContentTable(Stream content, Encoding enc)
Creates an Http Content Table.
static BadTable CreateNameValueTable(NameValueCollection headers)
Creates a table from a name value collection.
void AddContextExtensions(BadInteropExtensionProvider provider)
Adds Extensions for the BadHttpContext Object.
static BadArray CreateCookieTable(CookieCollection cookies)
Creates a Cookie Table from the Cookie Collection.
static BadTable CreateResponseTable(HttpListenerResponse resp)
Creates a Response Table for the given Response Object.
Gets thrown by the runtime.
Public Extension API for the BS2 Runtime.
void RegisterObject(Type t, string propName, BadObject obj)
Registers the specified extension for the specified type.
Implements a Reflected Object.
Implements a Dynamic List/Array for the BadScript Language.
List< BadObject > InnerArray
The Inner Array.
The Base Class for all BadScript Objects.
Implements a Table Structure for the BadScript Language.
Helper Class that Builds a Native Class from a Prototype.
static BadClassPrototype GetNative(string name)
Returns a Native Class Prototype for the given Native Type.
Implements the Interface for Native Strings.
Contains the Implementation of the Remote Console Abstraction over TCP.
Contains Network Hosting Extensions and APIs for the BadScript2 Runtime.
Contains the Error Objects for the BadScript2 Language.
Contains the Extension Classes for Functions.
Contains the Classes for Reflection Objects.
Contains the Interop Abstractions and Implementations for the BadScript2 Language.
Contains the Native Runtime Objects.
Contains Runtime Type Objects.
Contains the Runtime Objects.