xitiomet is sharing code with you
Bitbucket is a code hosting site. Unlimited public and private repositories. Free for small teams.
Don't show this againplacebohttp / README
- commit
- 24bcde817c29
- parent
- 9e6ab8ab1d73
- branch
- default
merges
1 |
71c2b596737f
|
Placebo HTTP Server |
2 |
71c2b596737f
|
------------------- |
3 |
71c2b596737f
|
|
4 |
71c2b596737f
|
1. Setup |
5 |
71c2b596737f
|
-------- |
6 |
51a9d815205f
|
|
7 |
51a9d815205f
|
==> Windows users.... |
8 |
71c2b596737f
|
open a command prompt to the folder |
9 |
71c2b596737f
|
\> compile.cmd |
10 |
71c2b596737f
|
\> java -jar placebohttp.jar --help |
11 |
71c2b596737f
|
|
12 |
51a9d815205f
|
==> Linux users.... |
13 |
71c2b596737f
|
First install gcj4.3 |
14 |
71c2b596737f
|
|
15 |
71c2b596737f
|
$ make |
16 |
71c2b596737f
|
$ ./placebohttp --help |
17 |
71c2b596737f
|
|
18 |
51a9d815205f
|
==> Solaris users.... |
19 |
71c2b596737f
|
$ make jvm |
20 |
71c2b596737f
|
$ java -jar placebohttp.jar --help |
21 |
71c2b596737f
|
|
22 |
51a9d815205f
|
==> OSX users..... |
23 |
51a9d815205f
|
$ make osx |
24 |
51a9d815205f
|
$ open PlaceboHTTP.app |
25 |
71c2b596737f
|
|
26 |
71c2b596737f
|
2. Usage |
27 |
71c2b596737f
|
-------- |
28 |
71c2b596737f
|
Placebo is full of tons of odd features, and if you were to ask my rationale behind them |
29 |
71c2b596737f
|
my answer would be, "because i needed them." Placebo is meant to be a quick and easy to |
30 |
71c2b596737f
|
use swiss army knife of a webserver. |
31 |
71c2b596737f
|
|
32 |
71c2b596737f
|
Aside the command line options placebo handles certain kinds of files in a very special |
33 |
71c2b596737f
|
way. These types are jar, war, ini, and zip. When it comes to the archive types placebo |
34 |
71c2b596737f
|
allows you to traverse the contents of the archive as part of your url. So if you had a |
35 |
71c2b596737f
|
file called stuff.zip in your webroot, and this file was filled with media you could do |
36 |
71c2b596737f
|
the following... |
37 |
71c2b596737f
|
|
38 |
71c2b596737f
|
http://127.0.0.1:8090/stuff.zip/images/someimage.jpg |
39 |
71c2b596737f
|
|
40 |
71c2b596737f
|
Assuming that inside stuff.zip there was an images directory with someimage.jpg in it. |
41 |
71c2b596737f
|
This functionality works the same for war, jar, and zip files. |
42 |
71c2b596737f
|
|
43 |
71c2b596737f
|
What About INI Files? |
44 |
71c2b596737f
|
|
45 |
71c2b596737f
|
Sadly this was one of the poorest cludges i ever made for the sake of quickly adding |
46 |
71c2b596737f
|
proxies to an existing sever. INI files have a few things they can contain that placebo |
47 |
71c2b596737f
|
will recognize as a traversable path. Imagine an ini file called google.ini that had the |
48 |
71c2b596737f
|
following line. |
49 |
71c2b596737f
|
|
50 |
71c2b596737f
|
proxy_url=http://www.google.com/ |
51 |
71c2b596737f
|
|
52 |
71c2b596737f
|
so if this file were located in your webroot you could do the following |
53 |
71c2b596737f
|
|
54 |
71c2b596737f
|
http://127.0.0.1:8090/google.ini/ |
55 |
71c2b596737f
|
|
56 |
71c2b596737f
|
Also files with no extensions are assumed to be ini files so if you had renamed google.ini |
57 |
71c2b596737f
|
to just google, you could have the following url |
58 |
71c2b596737f
|
|
59 |
71c2b596737f
|
http://127.0.0.1:8090/google/ |
60 |
71c2b596737f
|
|
61 |
71c2b596737f
|
which would proxy googles homepage. Right now there are only two other proxy features. |
62 |
71c2b596737f
|
buffered_proxy_url which will cause placebo to buffer the data before relaying it to |
63 |
71c2b596737f
|
the client, and json_to_html_url which will take the json data of any target and render |
64 |
71c2b596737f
|
it as pretty html. |
65 |
71c2b596737f
|
|
66 |
71c2b596737f
|