Skip to content
This repository has been archived by the owner on Jun 24, 2023. It is now read-only.

Commit

Permalink
docs: added on_load() and on_leave() skeletons to template
Browse files Browse the repository at this point in the history
  • Loading branch information
hugsy committed Jun 14, 2016
1 parent ad90949 commit 5551c47
Show file tree
Hide file tree
Showing 7 changed files with 107 additions and 2 deletions.
21 changes: 21 additions & 0 deletions docs/plugins/c.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,16 @@ c_plugin_info_t MyPlugin = {
};


int proxenet_request_on_load()
{
return 0;
}

int proxenet_request_on_leave()
{
return 0;
}

char* proxenet_request_hook(unsigned long request_id, char *request, char* uri, size_t* buflen)
{
return request;
Expand Down Expand Up @@ -72,6 +82,17 @@ c_plugin_info_t MyPlugin = {
};


int proxenet_request_on_load()
{
return 0;
}

int proxenet_request_on_leave()
{
return 0;
}


char* proxenet_request_hook(unsigned long request_id, char *request, char* uri, size_t* buflen)
{
const char* header = "X-Powered-By: c-proxenet\r\n\r\n";
Expand Down
14 changes: 14 additions & 0 deletions docs/plugins/java.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,13 @@ public class MyPlugin
public static String AUTHOR = "";
public static String PLUGIN_NAME = "";

public void proxenet_on_load(){
return;
}

public void proxenet_on_leave(){
return;
}

public static byte[] proxenet_request_hook(int request_id, byte[] request, String uri){
return request;
Expand Down Expand Up @@ -46,6 +53,13 @@ public class AddHeader
public static String AUTHOR = "hugsy";
public static String PLUGIN_NAME = "AddHeader";

public void proxenet_on_load(){
return;
}

public void proxenet_on_leave(){
return;
}

public static byte[] proxenet_request_hook(int request_id, byte[] request, String uri){
String myReq = new String( request );
Expand Down
12 changes: 12 additions & 0 deletions docs/plugins/lua.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@ This page will explain how to write a Lua plugin for `proxenet`.
AUTHOR = ""
PLUGIN_NAME = ""

function proxenet_on_load ()
end

function proxenet_on_leave ()
end

function proxenet_request_hook (request_id, request, uri)
return request
end
Expand All @@ -26,6 +32,12 @@ end
AUTHOR = "hugsy"
PLUGIN_NAME = "AddHeader"

function proxenet_on_load ()
end

function proxenet_on_leave ()
end

function proxenet_request_hook (request_id, request, uri)
local CRLF = "\r\n"
local header = "X-Powered-By: lua-proxenet"
Expand Down
16 changes: 16 additions & 0 deletions docs/plugins/perl.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,14 @@ package MyPlugin;
our $AUTHOR = "";
our $PLUGIN_NAME = "";

sub proxenet_on_load {
return;
}

sub proxenet_on_leave {
return;
}

sub proxenet_request_hook {
my ($request_id, $request, $uri) = @_;
return $request;
Expand All @@ -37,6 +45,14 @@ package AddHeader;
our $AUTHOR = "hugsy";
our $PLUGIN_NAME = "AddHeader";

sub proxenet_on_load {
return;
}

sub proxenet_on_leave {
return;
}

sub proxenet_request_hook {
my ($rid, $req, $uri) = @_;
$crlf = "\r\n";
Expand Down
10 changes: 10 additions & 0 deletions docs/plugins/python.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ This page will explain how to write a Python plugin for `proxenet`.
AUTHOR = ""
PLUGIN_NAME = ""

def proxenet_on_load():
return request

def proxenet_on_leave():
return

def proxenet_request_hook(request_id, request, uri):
return request
Expand All @@ -30,6 +35,11 @@ if __name__ == "__main__":
AUTHOR = "hugsy"
PLUGIN_NAME = "AddHeader"

def proxenet_on_load():
return request

def proxenet_on_leave():
return

def proxenet_request_hook(request_id, request, uri):
header = "X-Powered-By: python-proxenet"
Expand Down
20 changes: 18 additions & 2 deletions docs/plugins/ruby.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,15 @@ module MyPlugin
$PLUGIN_NAME = ""

module_function


def proxenet_on_load()
return
end

def proxenet_on_leave()
return
end

def proxenet_request_hook(request_id, request, uri)
return request
end
Expand All @@ -40,7 +48,15 @@ module AddHeader
$PLUGIN_NAME = "AddHeader"

module_function


def proxenet_on_load()
return
end

def proxenet_on_leave()
return
end

def proxenet_request_hook(request_id, request, uri)
@CRLF = "\r\n"
@header = "X-Powered-By: ruby-proxenet"
Expand Down
16 changes: 16 additions & 0 deletions docs/plugins/tcl.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,14 @@ This page will explain how to write a Tcl plugin for `proxenet`.
AUTHOR = ""
PLUGIN_NAME = ""
proc proxenet_on_load {} {
return
}
proc proxenet_on_leave {} {
return
}
proc proxenet_request_hook {request_id request uri} {
return $request
}
Expand All @@ -27,6 +35,14 @@ proc proxenet_response_hook {response_id response uri} {
AUTHOR = "hugsy"
PLUGIN_NAME = "AddHeader"
proc proxenet_on_load {} {
return
}
proc proxenet_on_leave {} {
return
}
proc proxenet_request_hook {request_id request uri} {
regsub -all "\r\n\r\n" $request "\r\nX-Powered-By: tcl-proxenet\r\n\r\n" request
return $request
Expand Down

0 comments on commit 5551c47

Please sign in to comment.