diff options
author | lbsa71 | 2007-07-04 14:12:32 +0000 |
---|---|---|
committer | lbsa71 | 2007-07-04 14:12:32 +0000 |
commit | 6a2588454a1ac4bb484ad0b9ee648e9ac156f8db (patch) | |
tree | fd4e0d33f65e36365d15d991f95d323e6d15e8b1 /OpenSim | |
parent | * Added StreamHandler support (diff) | |
download | opensim-SC-6a2588454a1ac4bb484ad0b9ee648e9ac156f8db.zip opensim-SC-6a2588454a1ac4bb484ad0b9ee648e9ac156f8db.tar.gz opensim-SC-6a2588454a1ac4bb484ad0b9ee648e9ac156f8db.tar.bz2 opensim-SC-6a2588454a1ac4bb484ad0b9ee648e9ac156f8db.tar.xz |
* Removed AssetHttpServer, using BaseHttpServer instead
* Removed legacy REST handling
* Created two custom IStreamHandlers for asset up/download
* Removed quite a lot of double and triple encodings, trying to work towards binary only and direct write into storage.
* Introduced BaseStreamHandler with GetParam() and some other goodies
Diffstat (limited to '')
-rw-r--r-- | OpenSim.sln | 309 | ||||
-rw-r--r-- | OpenSim/Framework/Servers/BaseHttpServer.cs | 163 | ||||
-rw-r--r-- | OpenSim/Framework/Servers/BaseStreamHandler.cs | 40 | ||||
-rw-r--r-- | OpenSim/Framework/Servers/IStreamHandler.cs | 3 | ||||
-rw-r--r-- | OpenSim/Framework/Servers/OpenSim.Framework.Servers.csproj | 3 | ||||
-rw-r--r-- | OpenSim/Framework/Servers/OpenSim.Framework.Servers.dll.build | 1 | ||||
-rw-r--r-- | OpenSim/Framework/Servers/RestStreamHandler.cs | 30 | ||||
-rw-r--r-- | OpenSim/Grid/AssetServer/AssetHttpServer.cs | 125 | ||||
-rw-r--r-- | OpenSim/Grid/AssetServer/Main.cs | 169 | ||||
-rw-r--r-- | OpenSim/Grid/AssetServer/OpenSim.Grid.AssetServer.csproj | 3 | ||||
-rw-r--r-- | OpenSim/Grid/AssetServer/OpenSim.Grid.AssetServer.exe.build | 1 | ||||
-rw-r--r-- | OpenSim/Grid/GridServer/Main.cs | 29 | ||||
-rw-r--r-- | OpenSim/Grid/UserServer/Main.cs | 4 | ||||
-rw-r--r-- | OpenSim/Region/Application/OpenSimMain.cs | 94 | ||||
-rw-r--r-- | OpenSim/Region/Capabilities/Caps.cs | 11 |
15 files changed, 454 insertions, 531 deletions
diff --git a/OpenSim.sln b/OpenSim.sln index 54743ee..bd39235 100644 --- a/OpenSim.sln +++ b/OpenSim.sln | |||
@@ -53,200 +53,117 @@ EndProject | |||
53 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SimpleApp", "OpenSim\Region\Examples\SimpleApp\SimpleApp.csproj", "{24B12448-0000-0000-0000-000000000000}" | 53 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SimpleApp", "OpenSim\Region\Examples\SimpleApp\SimpleApp.csproj", "{24B12448-0000-0000-0000-000000000000}" |
54 | EndProject | 54 | EndProject |
55 | Global | 55 | Global |
56 | GlobalSection(SolutionConfigurationPlatforms) = preSolution | 56 | GlobalSection(SolutionConfigurationPlatforms) = preSolution |
57 | Debug|Any CPU = Debug|Any CPU | 57 | Debug|Any CPU = Debug|Any CPU |
58 | Release|Any CPU = Release|Any CPU | 58 | Release|Any CPU = Release|Any CPU |
59 | EndGlobalSection | 59 | EndGlobalSection |
60 | GlobalSection(ProjectDependencies) = postSolution | 60 | GlobalSection(ProjectConfigurationPlatforms) = postSolution |
61 | ({438A9556-0000-0000-0000-000000000000}).3 = ({8ACA2445-0000-0000-0000-000000000000}) | 61 | {438A9556-0000-0000-0000-000000000000}.Debug|Any CPU.ActiveCfg = Debug|Any CPU |
62 | ({438A9556-0000-0000-0000-000000000000}).4 = ({CB52B7E7-0000-0000-0000-000000000000}) | 62 | {438A9556-0000-0000-0000-000000000000}.Debug|Any CPU.Build.0 = Debug|Any CPU |
63 | ({438A9556-0000-0000-0000-000000000000}).5 = ({A7CD0630-0000-0000-0000-000000000000}) | 63 | {438A9556-0000-0000-0000-000000000000}.Release|Any CPU.ActiveCfg = Release|Any CPU |
64 | ({438A9556-0000-0000-0000-000000000000}).6 = ({36B72A9B-0000-0000-0000-000000000000}) | 64 | {438A9556-0000-0000-0000-000000000000}.Release|Any CPU.Build.0 = Release|Any CPU |
65 | ({438A9556-0000-0000-0000-000000000000}).7 = ({C74E4A30-0000-0000-0000-000000000000}) | 65 | {8ACA2445-0000-0000-0000-000000000000}.Debug|Any CPU.ActiveCfg = Debug|Any CPU |
66 | ({438A9556-0000-0000-0000-000000000000}).8 = ({2CC71860-0000-0000-0000-000000000000}) | 66 | {8ACA2445-0000-0000-0000-000000000000}.Debug|Any CPU.Build.0 = Debug|Any CPU |
67 | ({438A9556-0000-0000-0000-000000000000}).9 = ({586E2916-0000-0000-0000-000000000000}) | 67 | {8ACA2445-0000-0000-0000-000000000000}.Release|Any CPU.ActiveCfg = Release|Any CPU |
68 | ({438A9556-0000-0000-0000-000000000000}).10 = ({61FCCDB3-0000-0000-0000-000000000000}) | 68 | {8ACA2445-0000-0000-0000-000000000000}.Release|Any CPU.Build.0 = Release|Any CPU |
69 | ({438A9556-0000-0000-0000-000000000000}).11 = ({DC3698B2-0000-0000-0000-000000000000}) | 69 | {CB52B7E7-0000-0000-0000-000000000000}.Debug|Any CPU.ActiveCfg = Debug|Any CPU |
70 | ({438A9556-0000-0000-0000-000000000000}).12 = ({BFB5D807-0000-0000-0000-000000000000}) | 70 | {CB52B7E7-0000-0000-0000-000000000000}.Debug|Any CPU.Build.0 = Debug|Any CPU |
71 | ({438A9556-0000-0000-0000-000000000000}).13 = ({4806E378-0000-0000-0000-000000000000}) | 71 | {CB52B7E7-0000-0000-0000-000000000000}.Release|Any CPU.ActiveCfg = Release|Any CPU |
72 | ({438A9556-0000-0000-0000-000000000000}).14 = ({DCBA491C-0000-0000-0000-000000000000}) | 72 | {CB52B7E7-0000-0000-0000-000000000000}.Release|Any CPU.Build.0 = Release|Any CPU |
73 | ({438A9556-0000-0000-0000-000000000000}).15 = ({F4FF31EB-0000-0000-0000-000000000000}) | 73 | {A7CD0630-0000-0000-0000-000000000000}.Debug|Any CPU.ActiveCfg = Debug|Any CPU |
74 | ({438A9556-0000-0000-0000-000000000000}).16 = ({C9E0F891-0000-0000-0000-000000000000}) | 74 | {A7CD0630-0000-0000-0000-000000000000}.Debug|Any CPU.Build.0 = Debug|Any CPU |
75 | ({8ACA2445-0000-0000-0000-000000000000}).2 = ({A7CD0630-0000-0000-0000-000000000000}) | 75 | {A7CD0630-0000-0000-0000-000000000000}.Release|Any CPU.ActiveCfg = Release|Any CPU |
76 | ({CB52B7E7-0000-0000-0000-000000000000}).1 = ({8ACA2445-0000-0000-0000-000000000000}) | 76 | {A7CD0630-0000-0000-0000-000000000000}.Release|Any CPU.Build.0 = Release|Any CPU |
77 | ({CB52B7E7-0000-0000-0000-000000000000}).2 = ({36B72A9B-0000-0000-0000-000000000000}) | 77 | {36B72A9B-0000-0000-0000-000000000000}.Debug|Any CPU.ActiveCfg = Debug|Any CPU |
78 | ({FD2D303D-0000-0000-0000-000000000000}).2 = ({36B72A9B-0000-0000-0000-000000000000}) | 78 | {36B72A9B-0000-0000-0000-000000000000}.Debug|Any CPU.Build.0 = Debug|Any CPU |
79 | ({C74E4A30-0000-0000-0000-000000000000}).0 = ({8ACA2445-0000-0000-0000-000000000000}) | 79 | {36B72A9B-0000-0000-0000-000000000000}.Release|Any CPU.ActiveCfg = Release|Any CPU |
80 | ({2CC71860-0000-0000-0000-000000000000}).1 = ({8ACA2445-0000-0000-0000-000000000000}) | 80 | {36B72A9B-0000-0000-0000-000000000000}.Release|Any CPU.Build.0 = Release|Any CPU |
81 | ({2CC71860-0000-0000-0000-000000000000}).2 = ({A7CD0630-0000-0000-0000-000000000000}) | 81 | {FD2D303D-0000-0000-0000-000000000000}.Debug|Any CPU.ActiveCfg = Debug|Any CPU |
82 | ({586E2916-0000-0000-0000-000000000000}).2 = ({8ACA2445-0000-0000-0000-000000000000}) | 82 | {FD2D303D-0000-0000-0000-000000000000}.Debug|Any CPU.Build.0 = Debug|Any CPU |
83 | ({586E2916-0000-0000-0000-000000000000}).3 = ({A7CD0630-0000-0000-0000-000000000000}) | 83 | {FD2D303D-0000-0000-0000-000000000000}.Release|Any CPU.ActiveCfg = Release|Any CPU |
84 | ({586E2916-0000-0000-0000-000000000000}).4 = ({36B72A9B-0000-0000-0000-000000000000}) | 84 | {FD2D303D-0000-0000-0000-000000000000}.Release|Any CPU.Build.0 = Release|Any CPU |
85 | ({586E2916-0000-0000-0000-000000000000}).5 = ({C74E4A30-0000-0000-0000-000000000000}) | 85 | {C74E4A30-0000-0000-0000-000000000000}.Debug|Any CPU.ActiveCfg = Debug|Any CPU |
86 | ({586E2916-0000-0000-0000-000000000000}).6 = ({2CC71860-0000-0000-0000-000000000000}) | 86 | {C74E4A30-0000-0000-0000-000000000000}.Debug|Any CPU.Build.0 = Debug|Any CPU |
87 | ({61FCCDB3-0000-0000-0000-000000000000}).1 = ({8ACA2445-0000-0000-0000-000000000000}) | 87 | {C74E4A30-0000-0000-0000-000000000000}.Release|Any CPU.ActiveCfg = Release|Any CPU |
88 | ({39038E85-0000-0000-0000-000000000000}).1 = ({8ACA2445-0000-0000-0000-000000000000}) | 88 | {C74E4A30-0000-0000-0000-000000000000}.Release|Any CPU.Build.0 = Release|Any CPU |
89 | ({39038E85-0000-0000-0000-000000000000}).2 = ({2CC71860-0000-0000-0000-000000000000}) | 89 | {2CC71860-0000-0000-0000-000000000000}.Debug|Any CPU.ActiveCfg = Debug|Any CPU |
90 | ({39038E85-0000-0000-0000-000000000000}).3 = ({61FCCDB3-0000-0000-0000-000000000000}) | 90 | {2CC71860-0000-0000-0000-000000000000}.Debug|Any CPU.Build.0 = Debug|Any CPU |
91 | ({DC3698B2-0000-0000-0000-000000000000}).3 = ({8ACA2445-0000-0000-0000-000000000000}) | 91 | {2CC71860-0000-0000-0000-000000000000}.Release|Any CPU.ActiveCfg = Release|Any CPU |
92 | ({DC3698B2-0000-0000-0000-000000000000}).4 = ({A7CD0630-0000-0000-0000-000000000000}) | 92 | {2CC71860-0000-0000-0000-000000000000}.Release|Any CPU.Build.0 = Release|Any CPU |
93 | ({DC3698B2-0000-0000-0000-000000000000}).5 = ({2CC71860-0000-0000-0000-000000000000}) | 93 | {586E2916-0000-0000-0000-000000000000}.Debug|Any CPU.ActiveCfg = Debug|Any CPU |
94 | ({DC3698B2-0000-0000-0000-000000000000}).6 = ({61FCCDB3-0000-0000-0000-000000000000}) | 94 | {586E2916-0000-0000-0000-000000000000}.Debug|Any CPU.Build.0 = Debug|Any CPU |
95 | ({DC3698B2-0000-0000-0000-000000000000}).7 = ({F4FF31EB-0000-0000-0000-000000000000}) | 95 | {586E2916-0000-0000-0000-000000000000}.Release|Any CPU.ActiveCfg = Release|Any CPU |
96 | ({DC3698B2-0000-0000-0000-000000000000}).8 = ({C9E0F891-0000-0000-0000-000000000000}) | 96 | {586E2916-0000-0000-0000-000000000000}.Release|Any CPU.Build.0 = Release|Any CPU |
97 | ({BFB5D807-0000-0000-0000-000000000000}).1 = ({8ACA2445-0000-0000-0000-000000000000}) | 97 | {61FCCDB3-0000-0000-0000-000000000000}.Debug|Any CPU.ActiveCfg = Debug|Any CPU |
98 | ({BFB5D807-0000-0000-0000-000000000000}).2 = ({CB52B7E7-0000-0000-0000-000000000000}) | 98 | {61FCCDB3-0000-0000-0000-000000000000}.Debug|Any CPU.Build.0 = Debug|Any CPU |
99 | ({BFB5D807-0000-0000-0000-000000000000}).3 = ({36B72A9B-0000-0000-0000-000000000000}) | 99 | {61FCCDB3-0000-0000-0000-000000000000}.Release|Any CPU.ActiveCfg = Release|Any CPU |
100 | ({BFB5D807-0000-0000-0000-000000000000}).4 = ({586E2916-0000-0000-0000-000000000000}) | 100 | {61FCCDB3-0000-0000-0000-000000000000}.Release|Any CPU.Build.0 = Release|Any CPU |
101 | ({4806E378-0000-0000-0000-000000000000}).1 = ({8ACA2445-0000-0000-0000-000000000000}) | 101 | {39038E85-0000-0000-0000-000000000000}.Debug|Any CPU.ActiveCfg = Debug|Any CPU |
102 | ({4806E378-0000-0000-0000-000000000000}).2 = ({CB52B7E7-0000-0000-0000-000000000000}) | 102 | {39038E85-0000-0000-0000-000000000000}.Debug|Any CPU.Build.0 = Debug|Any CPU |
103 | ({4806E378-0000-0000-0000-000000000000}).3 = ({A7CD0630-0000-0000-0000-000000000000}) | 103 | {39038E85-0000-0000-0000-000000000000}.Release|Any CPU.ActiveCfg = Release|Any CPU |
104 | ({4806E378-0000-0000-0000-000000000000}).4 = ({36B72A9B-0000-0000-0000-000000000000}) | 104 | {39038E85-0000-0000-0000-000000000000}.Release|Any CPU.Build.0 = Release|Any CPU |
105 | ({4806E378-0000-0000-0000-000000000000}).5 = ({2CC71860-0000-0000-0000-000000000000}) | 105 | {DC3698B2-0000-0000-0000-000000000000}.Debug|Any CPU.ActiveCfg = Debug|Any CPU |
106 | ({DCBA491C-0000-0000-0000-000000000000}).4 = ({8ACA2445-0000-0000-0000-000000000000}) | 106 | {DC3698B2-0000-0000-0000-000000000000}.Debug|Any CPU.Build.0 = Debug|Any CPU |
107 | ({DCBA491C-0000-0000-0000-000000000000}).5 = ({CB52B7E7-0000-0000-0000-000000000000}) | 107 | {DC3698B2-0000-0000-0000-000000000000}.Release|Any CPU.ActiveCfg = Release|Any CPU |
108 | ({DCBA491C-0000-0000-0000-000000000000}).6 = ({A7CD0630-0000-0000-0000-000000000000}) | 108 | {DC3698B2-0000-0000-0000-000000000000}.Release|Any CPU.Build.0 = Release|Any CPU |
109 | ({DCBA491C-0000-0000-0000-000000000000}).7 = ({C74E4A30-0000-0000-0000-000000000000}) | 109 | {BFB5D807-0000-0000-0000-000000000000}.Debug|Any CPU.ActiveCfg = Debug|Any CPU |
110 | ({DCBA491C-0000-0000-0000-000000000000}).8 = ({2CC71860-0000-0000-0000-000000000000}) | 110 | {BFB5D807-0000-0000-0000-000000000000}.Debug|Any CPU.Build.0 = Debug|Any CPU |
111 | ({DCBA491C-0000-0000-0000-000000000000}).9 = ({61FCCDB3-0000-0000-0000-000000000000}) | 111 | {BFB5D807-0000-0000-0000-000000000000}.Release|Any CPU.ActiveCfg = Release|Any CPU |
112 | ({DCBA491C-0000-0000-0000-000000000000}).10 = ({39038E85-0000-0000-0000-000000000000}) | 112 | {BFB5D807-0000-0000-0000-000000000000}.Release|Any CPU.Build.0 = Release|Any CPU |
113 | ({DCBA491C-0000-0000-0000-000000000000}).11 = ({F4FF31EB-0000-0000-0000-000000000000}) | 113 | {4806E378-0000-0000-0000-000000000000}.Debug|Any CPU.ActiveCfg = Debug|Any CPU |
114 | ({DCBA491C-0000-0000-0000-000000000000}).12 = ({C9E0F891-0000-0000-0000-000000000000}) | 114 | {4806E378-0000-0000-0000-000000000000}.Debug|Any CPU.Build.0 = Debug|Any CPU |
115 | ({241A8CDD-0000-0000-0000-000000000000}).2 = ({8ACA2445-0000-0000-0000-000000000000}) | 115 | {4806E378-0000-0000-0000-000000000000}.Release|Any CPU.ActiveCfg = Release|Any CPU |
116 | ({241A8CDD-0000-0000-0000-000000000000}).3 = ({A7CD0630-0000-0000-0000-000000000000}) | 116 | {4806E378-0000-0000-0000-000000000000}.Release|Any CPU.Build.0 = Release|Any CPU |
117 | ({98C7B681-0000-0000-0000-000000000000}).1 = ({8ACA2445-0000-0000-0000-000000000000}) | 117 | {DCBA491C-0000-0000-0000-000000000000}.Debug|Any CPU.ActiveCfg = Debug|Any CPU |
118 | ({98C7B681-0000-0000-0000-000000000000}).2 = ({A7CD0630-0000-0000-0000-000000000000}) | 118 | {DCBA491C-0000-0000-0000-000000000000}.Debug|Any CPU.Build.0 = Debug|Any CPU |
119 | ({15B4FEF3-0000-0000-0000-000000000000}).1 = ({F4FF31EB-0000-0000-0000-000000000000}) | 119 | {DCBA491C-0000-0000-0000-000000000000}.Release|Any CPU.ActiveCfg = Release|Any CPU |
120 | ({F4FF31EB-0000-0000-0000-000000000000}).1 = ({8ACA2445-0000-0000-0000-000000000000}) | 120 | {DCBA491C-0000-0000-0000-000000000000}.Release|Any CPU.Build.0 = Release|Any CPU |
121 | ({F4FF31EB-0000-0000-0000-000000000000}).2 = ({A7CD0630-0000-0000-0000-000000000000}) | 121 | {241A8CDD-0000-0000-0000-000000000000}.Debug|Any CPU.ActiveCfg = Debug|Any CPU |
122 | ({90620634-0000-0000-0000-000000000000}).2 = ({F4FF31EB-0000-0000-0000-000000000000}) | 122 | {241A8CDD-0000-0000-0000-000000000000}.Debug|Any CPU.Build.0 = Debug|Any CPU |
123 | ({A6D191D8-0000-0000-0000-000000000000}).1 = ({F4FF31EB-0000-0000-0000-000000000000}) | 123 | {241A8CDD-0000-0000-0000-000000000000}.Release|Any CPU.ActiveCfg = Release|Any CPU |
124 | ({A4691E59-0000-0000-0000-000000000000}).3 = ({8ACA2445-0000-0000-0000-000000000000}) | 124 | {241A8CDD-0000-0000-0000-000000000000}.Release|Any CPU.Build.0 = Release|Any CPU |
125 | ({A4691E59-0000-0000-0000-000000000000}).4 = ({A7CD0630-0000-0000-0000-000000000000}) | 125 | {98C7B681-0000-0000-0000-000000000000}.Debug|Any CPU.ActiveCfg = Debug|Any CPU |
126 | ({43DB702D-0000-0000-0000-000000000000}).2 = ({8ACA2445-0000-0000-0000-000000000000}) | 126 | {98C7B681-0000-0000-0000-000000000000}.Debug|Any CPU.Build.0 = Debug|Any CPU |
127 | ({43DB702D-0000-0000-0000-000000000000}).3 = ({A7CD0630-0000-0000-0000-000000000000}) | 127 | {98C7B681-0000-0000-0000-000000000000}.Release|Any CPU.ActiveCfg = Release|Any CPU |
128 | ({477B9270-0000-0000-0000-000000000000}).1 = ({8ACA2445-0000-0000-0000-000000000000}) | 128 | {98C7B681-0000-0000-0000-000000000000}.Release|Any CPU.Build.0 = Release|Any CPU |
129 | ({477B9270-0000-0000-0000-000000000000}).2 = ({A7CD0630-0000-0000-0000-000000000000}) | 129 | {15B4FEF3-0000-0000-0000-000000000000}.Debug|Any CPU.ActiveCfg = Debug|Any CPU |
130 | ({24B12448-0000-0000-0000-000000000000}).1 = ({8ACA2445-0000-0000-0000-000000000000}) | 130 | {15B4FEF3-0000-0000-0000-000000000000}.Debug|Any CPU.Build.0 = Debug|Any CPU |
131 | ({24B12448-0000-0000-0000-000000000000}).2 = ({CB52B7E7-0000-0000-0000-000000000000}) | 131 | {15B4FEF3-0000-0000-0000-000000000000}.Release|Any CPU.ActiveCfg = Release|Any CPU |
132 | ({24B12448-0000-0000-0000-000000000000}).3 = ({A7CD0630-0000-0000-0000-000000000000}) | 132 | {15B4FEF3-0000-0000-0000-000000000000}.Release|Any CPU.Build.0 = Release|Any CPU |
133 | ({24B12448-0000-0000-0000-000000000000}).4 = ({2CC71860-0000-0000-0000-000000000000}) | 133 | {F4FF31EB-0000-0000-0000-000000000000}.Debug|Any CPU.ActiveCfg = Debug|Any CPU |
134 | ({24B12448-0000-0000-0000-000000000000}).5 = ({586E2916-0000-0000-0000-000000000000}) | 134 | {F4FF31EB-0000-0000-0000-000000000000}.Debug|Any CPU.Build.0 = Debug|Any CPU |
135 | ({24B12448-0000-0000-0000-000000000000}).6 = ({61FCCDB3-0000-0000-0000-000000000000}) | 135 | {F4FF31EB-0000-0000-0000-000000000000}.Release|Any CPU.ActiveCfg = Release|Any CPU |
136 | ({24B12448-0000-0000-0000-000000000000}).7 = ({39038E85-0000-0000-0000-000000000000}) | 136 | {F4FF31EB-0000-0000-0000-000000000000}.Release|Any CPU.Build.0 = Release|Any CPU |
137 | ({24B12448-0000-0000-0000-000000000000}).8 = ({DC3698B2-0000-0000-0000-000000000000}) | 137 | {90620634-0000-0000-0000-000000000000}.Debug|Any CPU.ActiveCfg = Debug|Any CPU |
138 | ({24B12448-0000-0000-0000-000000000000}).9 = ({BFB5D807-0000-0000-0000-000000000000}) | 138 | {90620634-0000-0000-0000-000000000000}.Debug|Any CPU.Build.0 = Debug|Any CPU |
139 | ({24B12448-0000-0000-0000-000000000000}).10 = ({DCBA491C-0000-0000-0000-000000000000}) | 139 | {90620634-0000-0000-0000-000000000000}.Release|Any CPU.ActiveCfg = Release|Any CPU |
140 | ({24B12448-0000-0000-0000-000000000000}).11 = ({241A8CDD-0000-0000-0000-000000000000}) | 140 | {90620634-0000-0000-0000-000000000000}.Release|Any CPU.Build.0 = Release|Any CPU |
141 | ({24B12448-0000-0000-0000-000000000000}).12 = ({F4FF31EB-0000-0000-0000-000000000000}) | 141 | {A6D191D8-0000-0000-0000-000000000000}.Debug|Any CPU.ActiveCfg = Debug|Any CPU |
142 | EndGlobalSection | 142 | {A6D191D8-0000-0000-0000-000000000000}.Debug|Any CPU.Build.0 = Debug|Any CPU |
143 | GlobalSection(ProjectConfigurationPlatforms) = postSolution | 143 | {A6D191D8-0000-0000-0000-000000000000}.Release|Any CPU.ActiveCfg = Release|Any CPU |
144 | {438A9556-0000-0000-0000-000000000000}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | 144 | {A6D191D8-0000-0000-0000-000000000000}.Release|Any CPU.Build.0 = Release|Any CPU |
145 | {438A9556-0000-0000-0000-000000000000}.Debug|Any CPU.Build.0 = Debug|Any CPU | 145 | {A4691E59-0000-0000-0000-000000000000}.Debug|Any CPU.ActiveCfg = Debug|Any CPU |
146 | {438A9556-0000-0000-0000-000000000000}.Release|Any CPU.ActiveCfg = Release|Any CPU | 146 | {A4691E59-0000-0000-0000-000000000000}.Debug|Any CPU.Build.0 = Debug|Any CPU |
147 | {438A9556-0000-0000-0000-000000000000}.Release|Any CPU.Build.0 = Release|Any CPU | 147 | {A4691E59-0000-0000-0000-000000000000}.Release|Any CPU.ActiveCfg = Release|Any CPU |
148 | {8ACA2445-0000-0000-0000-000000000000}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | 148 | {A4691E59-0000-0000-0000-000000000000}.Release|Any CPU.Build.0 = Release|Any CPU |
149 | {8ACA2445-0000-0000-0000-000000000000}.Debug|Any CPU.Build.0 = Debug|Any CPU | 149 | {43DB702D-0000-0000-0000-000000000000}.Debug|Any CPU.ActiveCfg = Debug|Any CPU |
150 | {8ACA2445-0000-0000-0000-000000000000}.Release|Any CPU.ActiveCfg = Release|Any CPU | 150 | {43DB702D-0000-0000-0000-000000000000}.Debug|Any CPU.Build.0 = Debug|Any CPU |
151 | {8ACA2445-0000-0000-0000-000000000000}.Release|Any CPU.Build.0 = Release|Any CPU | 151 | {43DB702D-0000-0000-0000-000000000000}.Release|Any CPU.ActiveCfg = Release|Any CPU |
152 | {CB52B7E7-0000-0000-0000-000000000000}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | 152 | {43DB702D-0000-0000-0000-000000000000}.Release|Any CPU.Build.0 = Release|Any CPU |
153 | {CB52B7E7-0000-0000-0000-000000000000}.Debug|Any CPU.Build.0 = Debug|Any CPU | 153 | {477B9270-0000-0000-0000-000000000000}.Debug|Any CPU.ActiveCfg = Debug|Any CPU |
154 | {CB52B7E7-0000-0000-0000-000000000000}.Release|Any CPU.ActiveCfg = Release|Any CPU | 154 | {477B9270-0000-0000-0000-000000000000}.Debug|Any CPU.Build.0 = Debug|Any CPU |
155 | {CB52B7E7-0000-0000-0000-000000000000}.Release|Any CPU.Build.0 = Release|Any CPU | 155 | {477B9270-0000-0000-0000-000000000000}.Release|Any CPU.ActiveCfg = Release|Any CPU |
156 | {A7CD0630-0000-0000-0000-000000000000}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | 156 | {477B9270-0000-0000-0000-000000000000}.Release|Any CPU.Build.0 = Release|Any CPU |
157 | {A7CD0630-0000-0000-0000-000000000000}.Debug|Any CPU.Build.0 = Debug|Any CPU | 157 | {C9E0F891-0000-0000-0000-000000000000}.Debug|Any CPU.ActiveCfg = Debug|Any CPU |
158 | {A7CD0630-0000-0000-0000-000000000000}.Release|Any CPU.ActiveCfg = Release|Any CPU | 158 | {C9E0F891-0000-0000-0000-000000000000}.Debug|Any CPU.Build.0 = Debug|Any CPU |
159 | {A7CD0630-0000-0000-0000-000000000000}.Release|Any CPU.Build.0 = Release|Any CPU | 159 | {C9E0F891-0000-0000-0000-000000000000}.Release|Any CPU.ActiveCfg = Release|Any CPU |
160 | {36B72A9B-0000-0000-0000-000000000000}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | 160 | {C9E0F891-0000-0000-0000-000000000000}.Release|Any CPU.Build.0 = Release|Any CPU |
161 | {36B72A9B-0000-0000-0000-000000000000}.Debug|Any CPU.Build.0 = Debug|Any CPU | 161 | {24B12448-0000-0000-0000-000000000000}.Debug|Any CPU.ActiveCfg = Debug|Any CPU |
162 | {36B72A9B-0000-0000-0000-000000000000}.Release|Any CPU.ActiveCfg = Release|Any CPU | 162 | {24B12448-0000-0000-0000-000000000000}.Debug|Any CPU.Build.0 = Debug|Any CPU |
163 | {36B72A9B-0000-0000-0000-000000000000}.Release|Any CPU.Build.0 = Release|Any CPU | 163 | {24B12448-0000-0000-0000-000000000000}.Release|Any CPU.ActiveCfg = Release|Any CPU |
164 | {FD2D303D-0000-0000-0000-000000000000}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | 164 | {24B12448-0000-0000-0000-000000000000}.Release|Any CPU.Build.0 = Release|Any CPU |
165 | {FD2D303D-0000-0000-0000-000000000000}.Debug|Any CPU.Build.0 = Debug|Any CPU | 165 | EndGlobalSection |
166 | {FD2D303D-0000-0000-0000-000000000000}.Release|Any CPU.ActiveCfg = Release|Any CPU | 166 | GlobalSection(SolutionProperties) = preSolution |
167 | {FD2D303D-0000-0000-0000-000000000000}.Release|Any CPU.Build.0 = Release|Any CPU | 167 | HideSolutionNode = FALSE |
168 | {C74E4A30-0000-0000-0000-000000000000}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | 168 | EndGlobalSection |
169 | {C74E4A30-0000-0000-0000-000000000000}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
170 | {C74E4A30-0000-0000-0000-000000000000}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
171 | {C74E4A30-0000-0000-0000-000000000000}.Release|Any CPU.Build.0 = Release|Any CPU | ||
172 | {2CC71860-0000-0000-0000-000000000000}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
173 | {2CC71860-0000-0000-0000-000000000000}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
174 | {2CC71860-0000-0000-0000-000000000000}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
175 | {2CC71860-0000-0000-0000-000000000000}.Release|Any CPU.Build.0 = Release|Any CPU | ||
176 | {586E2916-0000-0000-0000-000000000000}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
177 | {586E2916-0000-0000-0000-000000000000}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
178 | {586E2916-0000-0000-0000-000000000000}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
179 | {586E2916-0000-0000-0000-000000000000}.Release|Any CPU.Build.0 = Release|Any CPU | ||
180 | {61FCCDB3-0000-0000-0000-000000000000}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
181 | {61FCCDB3-0000-0000-0000-000000000000}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
182 | {61FCCDB3-0000-0000-0000-000000000000}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
183 | {61FCCDB3-0000-0000-0000-000000000000}.Release|Any CPU.Build.0 = Release|Any CPU | ||
184 | {39038E85-0000-0000-0000-000000000000}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
185 | {39038E85-0000-0000-0000-000000000000}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
186 | {39038E85-0000-0000-0000-000000000000}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
187 | {39038E85-0000-0000-0000-000000000000}.Release|Any CPU.Build.0 = Release|Any CPU | ||
188 | {DC3698B2-0000-0000-0000-000000000000}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
189 | {DC3698B2-0000-0000-0000-000000000000}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
190 | {DC3698B2-0000-0000-0000-000000000000}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
191 | {DC3698B2-0000-0000-0000-000000000000}.Release|Any CPU.Build.0 = Release|Any CPU | ||
192 | {BFB5D807-0000-0000-0000-000000000000}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
193 | {BFB5D807-0000-0000-0000-000000000000}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
194 | {BFB5D807-0000-0000-0000-000000000000}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
195 | {BFB5D807-0000-0000-0000-000000000000}.Release|Any CPU.Build.0 = Release|Any CPU | ||
196 | {4806E378-0000-0000-0000-000000000000}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
197 | {4806E378-0000-0000-0000-000000000000}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
198 | {4806E378-0000-0000-0000-000000000000}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
199 | {4806E378-0000-0000-0000-000000000000}.Release|Any CPU.Build.0 = Release|Any CPU | ||
200 | {DCBA491C-0000-0000-0000-000000000000}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
201 | {DCBA491C-0000-0000-0000-000000000000}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
202 | {DCBA491C-0000-0000-0000-000000000000}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
203 | {DCBA491C-0000-0000-0000-000000000000}.Release|Any CPU.Build.0 = Release|Any CPU | ||
204 | {241A8CDD-0000-0000-0000-000000000000}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
205 | {241A8CDD-0000-0000-0000-000000000000}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
206 | {241A8CDD-0000-0000-0000-000000000000}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
207 | {241A8CDD-0000-0000-0000-000000000000}.Release|Any CPU.Build.0 = Release|Any CPU | ||
208 | {98C7B681-0000-0000-0000-000000000000}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
209 | {98C7B681-0000-0000-0000-000000000000}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
210 | {98C7B681-0000-0000-0000-000000000000}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
211 | {98C7B681-0000-0000-0000-000000000000}.Release|Any CPU.Build.0 = Release|Any CPU | ||
212 | {15B4FEF3-0000-0000-0000-000000000000}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
213 | {15B4FEF3-0000-0000-0000-000000000000}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
214 | {15B4FEF3-0000-0000-0000-000000000000}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
215 | {15B4FEF3-0000-0000-0000-000000000000}.Release|Any CPU.Build.0 = Release|Any CPU | ||
216 | {F4FF31EB-0000-0000-0000-000000000000}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
217 | {F4FF31EB-0000-0000-0000-000000000000}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
218 | {F4FF31EB-0000-0000-0000-000000000000}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
219 | {F4FF31EB-0000-0000-0000-000000000000}.Release|Any CPU.Build.0 = Release|Any CPU | ||
220 | {90620634-0000-0000-0000-000000000000}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
221 | {90620634-0000-0000-0000-000000000000}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
222 | {90620634-0000-0000-0000-000000000000}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
223 | {90620634-0000-0000-0000-000000000000}.Release|Any CPU.Build.0 = Release|Any CPU | ||
224 | {A6D191D8-0000-0000-0000-000000000000}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
225 | {A6D191D8-0000-0000-0000-000000000000}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
226 | {A6D191D8-0000-0000-0000-000000000000}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
227 | {A6D191D8-0000-0000-0000-000000000000}.Release|Any CPU.Build.0 = Release|Any CPU | ||
228 | {A4691E59-0000-0000-0000-000000000000}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
229 | {A4691E59-0000-0000-0000-000000000000}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
230 | {A4691E59-0000-0000-0000-000000000000}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
231 | {A4691E59-0000-0000-0000-000000000000}.Release|Any CPU.Build.0 = Release|Any CPU | ||
232 | {43DB702D-0000-0000-0000-000000000000}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
233 | {43DB702D-0000-0000-0000-000000000000}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
234 | {43DB702D-0000-0000-0000-000000000000}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
235 | {43DB702D-0000-0000-0000-000000000000}.Release|Any CPU.Build.0 = Release|Any CPU | ||
236 | {477B9270-0000-0000-0000-000000000000}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
237 | {477B9270-0000-0000-0000-000000000000}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
238 | {477B9270-0000-0000-0000-000000000000}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
239 | {477B9270-0000-0000-0000-000000000000}.Release|Any CPU.Build.0 = Release|Any CPU | ||
240 | {C9E0F891-0000-0000-0000-000000000000}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
241 | {C9E0F891-0000-0000-0000-000000000000}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
242 | {C9E0F891-0000-0000-0000-000000000000}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
243 | {C9E0F891-0000-0000-0000-000000000000}.Release|Any CPU.Build.0 = Release|Any CPU | ||
244 | {24B12448-0000-0000-0000-000000000000}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
245 | {24B12448-0000-0000-0000-000000000000}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
246 | {24B12448-0000-0000-0000-000000000000}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
247 | {24B12448-0000-0000-0000-000000000000}.Release|Any CPU.Build.0 = Release|Any CPU | ||
248 | EndGlobalSection | ||
249 | GlobalSection(SolutionProperties) = preSolution | ||
250 | HideSolutionNode = FALSE | ||
251 | EndGlobalSection | ||
252 | EndGlobal | 169 | EndGlobal |
diff --git a/OpenSim/Framework/Servers/BaseHttpServer.cs b/OpenSim/Framework/Servers/BaseHttpServer.cs index 9831108..aed538b 100644 --- a/OpenSim/Framework/Servers/BaseHttpServer.cs +++ b/OpenSim/Framework/Servers/BaseHttpServer.cs | |||
@@ -42,48 +42,56 @@ namespace OpenSim.Framework.Servers | |||
42 | { | 42 | { |
43 | protected Thread m_workerThread; | 43 | protected Thread m_workerThread; |
44 | protected HttpListener m_httpListener; | 44 | protected HttpListener m_httpListener; |
45 | protected Dictionary<string, RestMethodEntry> m_restHandlers = new Dictionary<string, RestMethodEntry>(); | 45 | //protected Dictionary<string, RestMethodEntry> m_restHandlers = new Dictionary<string, RestMethodEntry>(); |
46 | protected Dictionary<string, XmlRpcMethod> m_rpcHandlers = new Dictionary<string, XmlRpcMethod>(); | 46 | protected Dictionary<string, XmlRpcMethod> m_rpcHandlers = new Dictionary<string, XmlRpcMethod>(); |
47 | protected Dictionary<string, IStreamHandler> m_streamHandlers = new Dictionary<string, IStreamHandler>(); | 47 | protected Dictionary<string, IStreamHandler> m_streamHandlers = new Dictionary<string, IStreamHandler>(); |
48 | protected int m_port; | 48 | protected int m_port; |
49 | protected bool firstcaps = true; | 49 | protected bool m_firstcaps = true; |
50 | 50 | ||
51 | public BaseHttpServer(int port) | 51 | public BaseHttpServer(int port) |
52 | { | 52 | { |
53 | m_port = port; | 53 | m_port = port; |
54 | } | 54 | } |
55 | 55 | ||
56 | public void AddStreamHandler( string path, IStreamHandler handler) | 56 | public void AddStreamHandler( IStreamHandler handler) |
57 | { | 57 | { |
58 | string handlerKey = handler.HttpMethod + ":" + path; | 58 | string httpMethod = handler.HttpMethod; |
59 | string path = handler.Path; | ||
60 | |||
61 | string handlerKey = GetHandlerKey(httpMethod, path); | ||
59 | m_streamHandlers.Add(handlerKey, handler); | 62 | m_streamHandlers.Add(handlerKey, handler); |
60 | } | 63 | } |
61 | 64 | ||
62 | public bool AddRestHandler(string method, string path, RestMethod handler) | 65 | private static string GetHandlerKey(string httpMethod, string path) |
63 | { | 66 | { |
64 | //Console.WriteLine("adding new REST handler for path " + path); | 67 | return httpMethod + ":" + path; |
65 | string methodKey = String.Format("{0}: {1}", method, path); | ||
66 | |||
67 | if (!this.m_restHandlers.ContainsKey(methodKey)) | ||
68 | { | ||
69 | this.m_restHandlers.Add(methodKey, new RestMethodEntry(path, handler)); | ||
70 | return true; | ||
71 | } | ||
72 | |||
73 | //must already have a handler for that path so return false | ||
74 | return false; | ||
75 | } | 68 | } |
76 | 69 | ||
77 | public bool RemoveRestHandler(string method, string path) | 70 | //public bool AddRestHandler(string method, string path, RestMethod handler) |
78 | { | 71 | //{ |
79 | string methodKey = String.Format("{0}: {1}", method, path); | 72 | // //Console.WriteLine("adding new REST handler for path " + path); |
80 | if (this.m_restHandlers.ContainsKey(methodKey)) | 73 | // string methodKey = String.Format("{0}: {1}", method, path); |
81 | { | 74 | |
82 | this.m_restHandlers.Remove(methodKey); | 75 | // if (!this.m_restHandlers.ContainsKey(methodKey)) |
83 | return true; | 76 | // { |
84 | } | 77 | // this.m_restHandlers.Add(methodKey, new RestMethodEntry(path, handler)); |
85 | return false; | 78 | // return true; |
86 | } | 79 | // } |
80 | |||
81 | // //must already have a handler for that path so return false | ||
82 | // return false; | ||
83 | //} | ||
84 | |||
85 | //public bool RemoveRestHandler(string method, string path) | ||
86 | //{ | ||
87 | // string methodKey = String.Format("{0}: {1}", method, path); | ||
88 | // if (this.m_restHandlers.ContainsKey(methodKey)) | ||
89 | // { | ||
90 | // this.m_restHandlers.Remove(methodKey); | ||
91 | // return true; | ||
92 | // } | ||
93 | // return false; | ||
94 | //} | ||
87 | 95 | ||
88 | public bool AddXmlRPCHandler(string method, XmlRpcMethod handler) | 96 | public bool AddXmlRPCHandler(string method, XmlRpcMethod handler) |
89 | { | 97 | { |
@@ -119,40 +127,40 @@ namespace OpenSim.Framework.Servers | |||
119 | return XmlRpcResponseSerializer.Singleton.Serialize(response); | 127 | return XmlRpcResponseSerializer.Singleton.Serialize(response); |
120 | } | 128 | } |
121 | 129 | ||
122 | protected virtual string ParseREST(string request, string path, string method) | 130 | //protected virtual string ParseREST(string request, string path, string method) |
123 | { | 131 | //{ |
124 | string response; | 132 | // string response; |
125 | 133 | ||
126 | string requestKey = String.Format("{0}: {1}", method, path); | 134 | // string requestKey = String.Format("{0}: {1}", method, path); |
127 | 135 | ||
128 | string bestMatch = String.Empty; | 136 | // string bestMatch = String.Empty; |
129 | foreach (string currentKey in m_restHandlers.Keys) | 137 | // foreach (string currentKey in m_restHandlers.Keys) |
130 | { | 138 | // { |
131 | if (requestKey.StartsWith(currentKey)) | 139 | // if (requestKey.StartsWith(currentKey)) |
132 | { | 140 | // { |
133 | if (currentKey.Length > bestMatch.Length) | 141 | // if (currentKey.Length > bestMatch.Length) |
134 | { | 142 | // { |
135 | bestMatch = currentKey; | 143 | // bestMatch = currentKey; |
136 | } | 144 | // } |
137 | } | 145 | // } |
138 | } | 146 | // } |
139 | 147 | ||
140 | RestMethodEntry restMethodEntry; | 148 | // RestMethodEntry restMethodEntry; |
141 | if (m_restHandlers.TryGetValue(bestMatch, out restMethodEntry)) | 149 | // if (m_restHandlers.TryGetValue(bestMatch, out restMethodEntry)) |
142 | { | 150 | // { |
143 | RestMethod restMethod = restMethodEntry.RestMethod; | 151 | // RestMethod restMethod = restMethodEntry.RestMethod; |
144 | 152 | ||
145 | string param = path.Substring(restMethodEntry.Path.Length); | 153 | // string param = path.Substring(restMethodEntry.Path.Length); |
146 | response = restMethod(request, path, param); | 154 | // response = restMethod(request, path, param); |
147 | 155 | ||
148 | } | 156 | // } |
149 | else | 157 | // else |
150 | { | 158 | // { |
151 | response = String.Empty; | 159 | // response = String.Empty; |
152 | } | 160 | // } |
153 | 161 | ||
154 | return response; | 162 | // return response; |
155 | } | 163 | //} |
156 | 164 | ||
157 | 165 | ||
158 | protected virtual string ParseXMLRPC(string requestBody) | 166 | protected virtual string ParseXMLRPC(string requestBody) |
@@ -179,13 +187,13 @@ namespace OpenSim.Framework.Servers | |||
179 | response.SendChunked = false; | 187 | response.SendChunked = false; |
180 | 188 | ||
181 | string path = request.RawUrl; | 189 | string path = request.RawUrl; |
182 | string handlerKey = request.HttpMethod + ":" + path; | 190 | string handlerKey = GetHandlerKey( request.HttpMethod, path ); |
183 | 191 | ||
184 | IStreamHandler streamHandler; | 192 | IStreamHandler streamHandler; |
185 | 193 | ||
186 | if (TryGetStreamHandler( handlerKey, out streamHandler)) | 194 | if (TryGetStreamHandler( handlerKey, out streamHandler)) |
187 | { | 195 | { |
188 | byte[] buffer = streamHandler.Handle(path, request.InputStream ); | 196 | byte[] buffer = streamHandler.Handle(path, request.InputStream); |
189 | request.InputStream.Close(); | 197 | request.InputStream.Close(); |
190 | 198 | ||
191 | response.ContentType = streamHandler.ContentType; | 199 | response.ContentType = streamHandler.ContentType; |
@@ -253,25 +261,25 @@ namespace OpenSim.Framework.Servers | |||
253 | response.AddHeader("Content-type", "text/xml"); | 261 | response.AddHeader("Content-type", "text/xml"); |
254 | break; | 262 | break; |
255 | 263 | ||
256 | case "application/xml": | 264 | //case "application/xml": |
257 | case "application/octet-stream": | 265 | //case "application/octet-stream": |
258 | // probably LLSD we hope, otherwise it should be ignored by the parser | 266 | // // probably LLSD we hope, otherwise it should be ignored by the parser |
259 | // responseString = ParseLLSDXML(requestBody); | 267 | // // responseString = ParseLLSDXML(requestBody); |
260 | responseString = ParseREST(requestBody, request.RawUrl, request.HttpMethod); | 268 | // responseString = ParseREST(requestBody, request.RawUrl, request.HttpMethod); |
261 | response.AddHeader("Content-type", "application/xml"); | 269 | // response.AddHeader("Content-type", "application/xml"); |
262 | break; | 270 | // break; |
263 | 271 | ||
264 | case "application/x-www-form-urlencoded": | 272 | //case "application/x-www-form-urlencoded": |
265 | // a form data POST so send to the REST parser | 273 | // // a form data POST so send to the REST parser |
266 | responseString = ParseREST(requestBody, request.RawUrl, request.HttpMethod); | 274 | // responseString = ParseREST(requestBody, request.RawUrl, request.HttpMethod); |
267 | response.AddHeader("Content-type", "text/html"); | 275 | // response.AddHeader("Content-type", "text/html"); |
268 | break; | 276 | // break; |
269 | 277 | ||
270 | case null: | 278 | //case null: |
271 | // must be REST or invalid crap, so pass to the REST parser | 279 | // // must be REST or invalid crap, so pass to the REST parser |
272 | responseString = ParseREST(requestBody, request.RawUrl, request.HttpMethod); | 280 | // responseString = ParseREST(requestBody, request.RawUrl, request.HttpMethod); |
273 | response.AddHeader("Content-type", "text/html"); | 281 | // response.AddHeader("Content-type", "text/html"); |
274 | break; | 282 | // break; |
275 | 283 | ||
276 | } | 284 | } |
277 | 285 | ||
@@ -318,5 +326,10 @@ namespace OpenSim.Framework.Servers | |||
318 | } | 326 | } |
319 | } | 327 | } |
320 | 328 | ||
329 | |||
330 | public void RemoveStreamHandler(string httpMethod, string path) | ||
331 | { | ||
332 | m_streamHandlers.Remove(GetHandlerKey(httpMethod, path)); | ||
333 | } | ||
321 | } | 334 | } |
322 | } | 335 | } |
diff --git a/OpenSim/Framework/Servers/BaseStreamHandler.cs b/OpenSim/Framework/Servers/BaseStreamHandler.cs new file mode 100644 index 0000000..95e9707 --- /dev/null +++ b/OpenSim/Framework/Servers/BaseStreamHandler.cs | |||
@@ -0,0 +1,40 @@ | |||
1 | using System; | ||
2 | using System.Collections.Generic; | ||
3 | using System.Text; | ||
4 | using System.IO; | ||
5 | |||
6 | namespace OpenSim.Framework.Servers | ||
7 | { | ||
8 | public abstract class BaseStreamHandler : IStreamHandler | ||
9 | { | ||
10 | public string ContentType | ||
11 | { | ||
12 | get { return "application/xml"; } | ||
13 | } | ||
14 | |||
15 | private string m_httpMethod; | ||
16 | public string HttpMethod | ||
17 | { | ||
18 | get { return m_httpMethod; } | ||
19 | } | ||
20 | |||
21 | private string m_path; | ||
22 | public string Path | ||
23 | { | ||
24 | get { return m_path; } | ||
25 | } | ||
26 | |||
27 | protected string GetParam( string path ) | ||
28 | { | ||
29 | return path.Substring( m_path.Length ); | ||
30 | } | ||
31 | |||
32 | public abstract byte[] Handle(string path, Stream request); | ||
33 | |||
34 | protected BaseStreamHandler(string path, string httpMethod ) | ||
35 | { | ||
36 | m_httpMethod = httpMethod; | ||
37 | m_path = path; | ||
38 | } | ||
39 | } | ||
40 | } | ||
diff --git a/OpenSim/Framework/Servers/IStreamHandler.cs b/OpenSim/Framework/Servers/IStreamHandler.cs index bc76e9c..6cab40d 100644 --- a/OpenSim/Framework/Servers/IStreamHandler.cs +++ b/OpenSim/Framework/Servers/IStreamHandler.cs | |||
@@ -15,5 +15,8 @@ namespace OpenSim.Framework.Servers | |||
15 | 15 | ||
16 | // Return required http method | 16 | // Return required http method |
17 | string HttpMethod { get;} | 17 | string HttpMethod { get;} |
18 | |||
19 | // Return path | ||
20 | string Path { get; } | ||
18 | } | 21 | } |
19 | } | 22 | } |
diff --git a/OpenSim/Framework/Servers/OpenSim.Framework.Servers.csproj b/OpenSim/Framework/Servers/OpenSim.Framework.Servers.csproj index 555bd5d..4eb9844 100644 --- a/OpenSim/Framework/Servers/OpenSim.Framework.Servers.csproj +++ b/OpenSim/Framework/Servers/OpenSim.Framework.Servers.csproj | |||
@@ -93,6 +93,9 @@ | |||
93 | <Compile Include="BaseHttpServer.cs"> | 93 | <Compile Include="BaseHttpServer.cs"> |
94 | <SubType>Code</SubType> | 94 | <SubType>Code</SubType> |
95 | </Compile> | 95 | </Compile> |
96 | <Compile Include="BaseStreamHandler.cs"> | ||
97 | <SubType>Code</SubType> | ||
98 | </Compile> | ||
96 | <Compile Include="CheckSumServer.cs"> | 99 | <Compile Include="CheckSumServer.cs"> |
97 | <SubType>Code</SubType> | 100 | <SubType>Code</SubType> |
98 | </Compile> | 101 | </Compile> |
diff --git a/OpenSim/Framework/Servers/OpenSim.Framework.Servers.dll.build b/OpenSim/Framework/Servers/OpenSim.Framework.Servers.dll.build index a3d140f..5e96ef1 100644 --- a/OpenSim/Framework/Servers/OpenSim.Framework.Servers.dll.build +++ b/OpenSim/Framework/Servers/OpenSim.Framework.Servers.dll.build | |||
@@ -12,6 +12,7 @@ | |||
12 | </resources> | 12 | </resources> |
13 | <sources failonempty="true"> | 13 | <sources failonempty="true"> |
14 | <include name="BaseHttpServer.cs" /> | 14 | <include name="BaseHttpServer.cs" /> |
15 | <include name="BaseStreamHandler.cs" /> | ||
15 | <include name="CheckSumServer.cs" /> | 16 | <include name="CheckSumServer.cs" /> |
16 | <include name="ILlsdMethodHandler.cs" /> | 17 | <include name="ILlsdMethodHandler.cs" /> |
17 | <include name="IStreamHandler.cs" /> | 18 | <include name="IStreamHandler.cs" /> |
diff --git a/OpenSim/Framework/Servers/RestStreamHandler.cs b/OpenSim/Framework/Servers/RestStreamHandler.cs index 64d6ea3..7ca369d 100644 --- a/OpenSim/Framework/Servers/RestStreamHandler.cs +++ b/OpenSim/Framework/Servers/RestStreamHandler.cs | |||
@@ -5,41 +5,27 @@ using System.IO; | |||
5 | 5 | ||
6 | namespace OpenSim.Framework.Servers | 6 | namespace OpenSim.Framework.Servers |
7 | { | 7 | { |
8 | public class RestStreamHandler : IStreamHandler | 8 | public class RestStreamHandler : BaseStreamHandler |
9 | { | 9 | { |
10 | RestMethod m_restMethod; | 10 | RestMethod m_restMethod; |
11 | 11 | ||
12 | private string m_contentType; | 12 | override public byte[] Handle(string path, Stream request ) |
13 | public string ContentType | ||
14 | { | ||
15 | get { return m_contentType; } | ||
16 | } | ||
17 | |||
18 | private string m_httpMethod; | ||
19 | public string HttpMethod | ||
20 | { | ||
21 | get { return m_httpMethod; } | ||
22 | } | ||
23 | |||
24 | |||
25 | public byte[] Handle(string path, Stream request ) | ||
26 | { | 13 | { |
27 | Encoding encoding = Encoding.UTF8; | 14 | Encoding encoding = Encoding.UTF8; |
28 | StreamReader reader = new StreamReader(request, encoding); | 15 | StreamReader streamReader = new StreamReader(request, encoding); |
29 | 16 | ||
30 | string requestBody = reader.ReadToEnd(); | 17 | string requestBody = streamReader.ReadToEnd(); |
31 | reader.Close(); | 18 | streamReader.Close(); |
32 | 19 | ||
33 | string responseString = m_restMethod(requestBody, path, m_httpMethod); | 20 | string param = GetParam(path); |
21 | string responseString = m_restMethod(requestBody, path, param ); | ||
34 | 22 | ||
35 | return Encoding.UTF8.GetBytes(responseString); | 23 | return Encoding.UTF8.GetBytes(responseString); |
36 | } | 24 | } |
37 | 25 | ||
38 | public RestStreamHandler(RestMethod restMethod, string httpMethod, string contentType) | 26 | public RestStreamHandler(string httpMethod, string path, RestMethod restMethod) : base( path, httpMethod ) |
39 | { | 27 | { |
40 | m_restMethod = restMethod; | 28 | m_restMethod = restMethod; |
41 | m_httpMethod = httpMethod; | ||
42 | m_contentType = contentType; | ||
43 | } | 29 | } |
44 | } | 30 | } |
45 | } | 31 | } |
diff --git a/OpenSim/Grid/AssetServer/AssetHttpServer.cs b/OpenSim/Grid/AssetServer/AssetHttpServer.cs deleted file mode 100644 index 9546891..0000000 --- a/OpenSim/Grid/AssetServer/AssetHttpServer.cs +++ /dev/null | |||
@@ -1,125 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSim Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | * | ||
27 | */ | ||
28 | using System; | ||
29 | using System.IO; | ||
30 | using System.Net; | ||
31 | using System.Text; | ||
32 | using System.Text.RegularExpressions; | ||
33 | using OpenSim.Framework.Servers; | ||
34 | |||
35 | namespace OpenSim.Grid.AssetServer | ||
36 | { | ||
37 | /// <summary> | ||
38 | /// An HTTP server for sending assets | ||
39 | /// </summary> | ||
40 | public class AssetHttpServer :BaseHttpServer | ||
41 | { | ||
42 | /// <summary> | ||
43 | /// Creates the new asset server | ||
44 | /// </summary> | ||
45 | /// <param name="port">Port to initalise on</param> | ||
46 | public AssetHttpServer(int port) | ||
47 | : base(port) | ||
48 | { | ||
49 | } | ||
50 | |||
51 | /// <summary> | ||
52 | /// Handles an HTTP request | ||
53 | /// </summary> | ||
54 | /// <param name="stateinfo">HTTP State Info</param> | ||
55 | public override void HandleRequest(Object stateinfo) | ||
56 | { | ||
57 | try | ||
58 | { | ||
59 | HttpListenerContext context = (HttpListenerContext)stateinfo; | ||
60 | |||
61 | HttpListenerRequest request = context.Request; | ||
62 | HttpListenerResponse response = context.Response; | ||
63 | |||
64 | response.KeepAlive = false; | ||
65 | response.SendChunked = false; | ||
66 | |||
67 | Stream body = request.InputStream; | ||
68 | Encoding encoding = Encoding.UTF8; | ||
69 | StreamReader reader = new StreamReader(body, encoding); | ||
70 | |||
71 | string requestBody = reader.ReadToEnd(); | ||
72 | body.Close(); | ||
73 | reader.Close(); | ||
74 | |||
75 | //Console.WriteLine(request.HttpMethod + " " + request.RawUrl + " Http/" + request.ProtocolVersion.ToString() + " content type: " + request.ContentType); | ||
76 | //Console.WriteLine(requestBody); | ||
77 | |||
78 | string responseString = ""; | ||
79 | switch (request.ContentType) | ||
80 | { | ||
81 | case "text/xml": | ||
82 | // must be XML-RPC, so pass to the XML-RPC parser | ||
83 | |||
84 | responseString = ParseXMLRPC(requestBody); | ||
85 | responseString = Regex.Replace(responseString, "utf-16", "utf-8"); | ||
86 | |||
87 | response.AddHeader("Content-type", "text/xml"); | ||
88 | break; | ||
89 | |||
90 | case "application/xml": | ||
91 | // probably LLSD we hope, otherwise it should be ignored by the parser | ||
92 | responseString = ParseREST(requestBody, request.RawUrl, request.HttpMethod); | ||
93 | response.AddHeader("Content-type", "application/xml"); | ||
94 | break; | ||
95 | |||
96 | case "application/x-www-form-urlencoded": | ||
97 | // a form data POST so send to the REST parser | ||
98 | responseString = ParseREST(requestBody, request.RawUrl, request.HttpMethod); | ||
99 | response.AddHeader("Content-type", "text/plain"); | ||
100 | break; | ||
101 | |||
102 | case null: | ||
103 | // must be REST or invalid crap, so pass to the REST parser | ||
104 | responseString = ParseREST(requestBody, request.RawUrl, request.HttpMethod); | ||
105 | response.AddHeader("Content-type", "text/plain"); | ||
106 | break; | ||
107 | |||
108 | } | ||
109 | |||
110 | Encoding Windows1252Encoding = Encoding.GetEncoding(1252); | ||
111 | byte[] buffer = Windows1252Encoding.GetBytes(responseString); | ||
112 | Stream output = response.OutputStream; | ||
113 | response.SendChunked = false; | ||
114 | response.ContentLength64 = buffer.Length; | ||
115 | output.Write(buffer, 0, buffer.Length); | ||
116 | output.Close(); | ||
117 | } | ||
118 | catch (Exception e) | ||
119 | { | ||
120 | Console.WriteLine(e.ToString()); | ||
121 | } | ||
122 | } | ||
123 | |||
124 | } | ||
125 | } | ||
diff --git a/OpenSim/Grid/AssetServer/Main.cs b/OpenSim/Grid/AssetServer/Main.cs index 112d72f..3e302d8 100644 --- a/OpenSim/Grid/AssetServer/Main.cs +++ b/OpenSim/Grid/AssetServer/Main.cs | |||
@@ -33,13 +33,14 @@ using Db4objects.Db4o; | |||
33 | using libsecondlife; | 33 | using libsecondlife; |
34 | using OpenSim.Framework.Console; | 34 | using OpenSim.Framework.Console; |
35 | using OpenSim.Framework.Types; | 35 | using OpenSim.Framework.Types; |
36 | using OpenSim.Framework.Servers; | ||
36 | 37 | ||
37 | namespace OpenSim.Grid.AssetServer | 38 | namespace OpenSim.Grid.AssetServer |
38 | { | 39 | { |
39 | /// <summary> | 40 | /// <summary> |
40 | /// An asset server | 41 | /// An asset server |
41 | /// </summary> | 42 | /// </summary> |
42 | public class OpenAsset_Main : conscmd_callback | 43 | public class OpenAsset_Main : conscmd_callback |
43 | { | 44 | { |
44 | private IObjectContainer db; | 45 | private IObjectContainer db; |
45 | 46 | ||
@@ -76,58 +77,60 @@ namespace OpenSim.Grid.AssetServer | |||
76 | 77 | ||
77 | public void Startup() | 78 | public void Startup() |
78 | { | 79 | { |
79 | m_console.Verbose( "Main.cs:Startup() - Setting up asset DB"); | 80 | m_console.Verbose("Main.cs:Startup() - Setting up asset DB"); |
80 | setupDB(); | 81 | setupDB(); |
81 | 82 | ||
82 | m_console.Verbose( "Main.cs:Startup() - Starting HTTP process"); | 83 | m_console.Verbose("Main.cs:Startup() - Starting HTTP process"); |
83 | AssetHttpServer httpServer = new AssetHttpServer(8003); | 84 | BaseHttpServer httpServer = new BaseHttpServer(8003); |
84 | 85 | ||
86 | httpServer.AddStreamHandler( new GetAssetStreamHandler(this)); | ||
87 | httpServer.AddStreamHandler(new PostAssetStreamHandler( this )); | ||
85 | 88 | ||
86 | httpServer.AddRestHandler("GET", "/assets/", this.assetGetMethod); | 89 | //httpServer.AddRestHandler("GET", "/assets/", this.assetGetMethod); |
87 | httpServer.AddRestHandler("POST", "/assets/", this.assetPostMethod); | 90 | //httpServer.AddRestHandler("POST", "/assets/", this.assetPostMethod); |
88 | 91 | ||
89 | httpServer.Start(); | 92 | httpServer.Start(); |
90 | 93 | ||
91 | } | 94 | } |
92 | 95 | ||
93 | public string assetPostMethod(string requestBody, string path, string param) | 96 | //public string AssetPostMethod(string requestBody, string path, string param) |
94 | { | 97 | //{ |
95 | AssetBase asset = new AssetBase(); | 98 | // AssetBase asset = new AssetBase(); |
96 | asset.Name = ""; | 99 | // asset.Name = ""; |
97 | asset.FullID = new LLUUID(param); | 100 | // asset.FullID = new LLUUID(param); |
98 | Encoding Windows1252Encoding = Encoding.GetEncoding(1252); | 101 | // Encoding Windows1252Encoding = Encoding.GetEncoding(1252); |
99 | byte[] buffer = Windows1252Encoding.GetBytes(requestBody); | 102 | // byte[] buffer = Windows1252Encoding.GetBytes(requestBody); |
100 | asset.Data = buffer; | 103 | // asset.Data = buffer; |
101 | AssetStorage store = new AssetStorage(); | 104 | // AssetStorage store = new AssetStorage(); |
102 | store.Data = asset.Data; | 105 | // store.Data = asset.Data; |
103 | store.Name = asset.Name; | 106 | // store.Name = asset.Name; |
104 | store.UUID = asset.FullID; | 107 | // store.UUID = asset.FullID; |
105 | db.Set(store); | 108 | // db.Set(store); |
106 | db.Commit(); | 109 | // db.Commit(); |
107 | return ""; | 110 | // return ""; |
108 | } | 111 | //} |
109 | 112 | ||
110 | public string assetGetMethod(string request, string path, string param) | 113 | //public string AssetGetMethod(string request, string path, string param) |
111 | { | 114 | //{ |
112 | Console.WriteLine("got a request " + param); | 115 | // Console.WriteLine("got a request " + param); |
113 | byte[] assetdata = getAssetData(new LLUUID(param), false); | 116 | // byte[] assetdata = GetAssetData(new LLUUID(param), false); |
114 | if (assetdata != null) | 117 | // if (assetdata != null) |
115 | { | 118 | // { |
116 | Encoding Windows1252Encoding = Encoding.GetEncoding(1252); | 119 | // Encoding Windows1252Encoding = Encoding.GetEncoding(1252); |
117 | string ret = Windows1252Encoding.GetString(assetdata); | 120 | // string ret = Windows1252Encoding.GetString(assetdata); |
118 | //string ret = System.Text.Encoding.Unicode.GetString(assetdata); | 121 | // //string ret = System.Text.Encoding.Unicode.GetString(assetdata); |
119 | 122 | ||
120 | return ret; | 123 | // return ret; |
121 | 124 | ||
122 | } | 125 | // } |
123 | else | 126 | // else |
124 | { | 127 | // { |
125 | return ""; | 128 | // return ""; |
126 | } | 129 | // } |
127 | 130 | ||
128 | } | 131 | //} |
129 | 132 | ||
130 | public byte[] getAssetData(LLUUID assetID, bool isTexture) | 133 | public byte[] GetAssetData(LLUUID assetID, bool isTexture) |
131 | { | 134 | { |
132 | bool found = false; | 135 | bool found = false; |
133 | AssetStorage foundAsset = null; | 136 | AssetStorage foundAsset = null; |
@@ -155,7 +158,7 @@ namespace OpenSim.Grid.AssetServer | |||
155 | try | 158 | try |
156 | { | 159 | { |
157 | db = Db4oFactory.OpenFile("assets.yap"); | 160 | db = Db4oFactory.OpenFile("assets.yap"); |
158 | MainLog.Instance.Verbose( "Main.cs:setupDB() - creation"); | 161 | MainLog.Instance.Verbose("Main.cs:setupDB() - creation"); |
159 | } | 162 | } |
160 | catch (Exception e) | 163 | catch (Exception e) |
161 | { | 164 | { |
@@ -305,6 +308,21 @@ namespace OpenSim.Grid.AssetServer | |||
305 | return config; | 308 | return config; |
306 | }*/ | 309 | }*/ |
307 | 310 | ||
311 | public void CreateAsset(LLUUID assetId, byte[] assetData) | ||
312 | { | ||
313 | AssetBase asset = new AssetBase(); | ||
314 | asset.Name = ""; | ||
315 | asset.FullID = assetId; | ||
316 | asset.Data = assetData; | ||
317 | |||
318 | AssetStorage store = new AssetStorage(); | ||
319 | store.Data = asset.Data; | ||
320 | store.Name = asset.Name; | ||
321 | store.UUID = asset.FullID; | ||
322 | db.Set(store); | ||
323 | db.Commit(); | ||
324 | } | ||
325 | |||
308 | public void RunCmd(string cmd, string[] cmdparams) | 326 | public void RunCmd(string cmd, string[] cmdparams) |
309 | { | 327 | { |
310 | switch (cmd) | 328 | switch (cmd) |
@@ -324,4 +342,65 @@ namespace OpenSim.Grid.AssetServer | |||
324 | { | 342 | { |
325 | } | 343 | } |
326 | } | 344 | } |
345 | |||
346 | public class GetAssetStreamHandler : BaseStreamHandler | ||
347 | { | ||
348 | OpenAsset_Main m_assetManager; | ||
349 | |||
350 | override public byte[] Handle(string path, Stream request) | ||
351 | { | ||
352 | string param = GetParam(path); | ||
353 | |||
354 | byte[] assetdata = m_assetManager.GetAssetData(new LLUUID(param), false); | ||
355 | if (assetdata != null) | ||
356 | { | ||
357 | return assetdata; | ||
358 | } | ||
359 | else | ||
360 | { | ||
361 | return new byte[]{}; | ||
362 | } | ||
363 | } | ||
364 | |||
365 | public GetAssetStreamHandler(OpenAsset_Main assetManager):base( "/assets/", "GET") | ||
366 | { | ||
367 | m_assetManager = assetManager; | ||
368 | } | ||
369 | } | ||
370 | |||
371 | public class PostAssetStreamHandler : BaseStreamHandler | ||
372 | { | ||
373 | OpenAsset_Main m_assetManager; | ||
374 | |||
375 | override public byte[] Handle(string path, Stream request) | ||
376 | { | ||
377 | string param = GetParam(path); | ||
378 | LLUUID assetId = new LLUUID(param); | ||
379 | byte[] txBuffer = new byte[4096]; | ||
380 | |||
381 | using( BinaryReader binReader = new BinaryReader( request ) ) | ||
382 | { | ||
383 | using (MemoryStream memoryStream = new MemoryStream(4096)) | ||
384 | { | ||
385 | int count; | ||
386 | while ((count = binReader.Read(txBuffer, 0, 4096)) > 0) | ||
387 | { | ||
388 | memoryStream.Write(txBuffer, 0, count); | ||
389 | } | ||
390 | |||
391 | byte[] assetData = memoryStream.ToArray(); | ||
392 | |||
393 | m_assetManager.CreateAsset(assetId, assetData); | ||
394 | } | ||
395 | } | ||
396 | |||
397 | return new byte[]{}; | ||
398 | } | ||
399 | |||
400 | public PostAssetStreamHandler( OpenAsset_Main assetManager ) | ||
401 | : base("/assets/", "POST") | ||
402 | { | ||
403 | m_assetManager = assetManager; | ||
404 | } | ||
405 | } | ||
327 | } | 406 | } |
diff --git a/OpenSim/Grid/AssetServer/OpenSim.Grid.AssetServer.csproj b/OpenSim/Grid/AssetServer/OpenSim.Grid.AssetServer.csproj index caebca3..5ba4642 100644 --- a/OpenSim/Grid/AssetServer/OpenSim.Grid.AssetServer.csproj +++ b/OpenSim/Grid/AssetServer/OpenSim.Grid.AssetServer.csproj | |||
@@ -98,9 +98,6 @@ | |||
98 | <ItemGroup> | 98 | <ItemGroup> |
99 | </ItemGroup> | 99 | </ItemGroup> |
100 | <ItemGroup> | 100 | <ItemGroup> |
101 | <Compile Include="AssetHttpServer.cs"> | ||
102 | <SubType>Code</SubType> | ||
103 | </Compile> | ||
104 | <Compile Include="Main.cs"> | 101 | <Compile Include="Main.cs"> |
105 | <SubType>Code</SubType> | 102 | <SubType>Code</SubType> |
106 | </Compile> | 103 | </Compile> |
diff --git a/OpenSim/Grid/AssetServer/OpenSim.Grid.AssetServer.exe.build b/OpenSim/Grid/AssetServer/OpenSim.Grid.AssetServer.exe.build index 88724f6..a922fe7 100644 --- a/OpenSim/Grid/AssetServer/OpenSim.Grid.AssetServer.exe.build +++ b/OpenSim/Grid/AssetServer/OpenSim.Grid.AssetServer.exe.build | |||
@@ -11,7 +11,6 @@ | |||
11 | <resources prefix="OpenSim.Grid.AssetServer" dynamicprefix="true" > | 11 | <resources prefix="OpenSim.Grid.AssetServer" dynamicprefix="true" > |
12 | </resources> | 12 | </resources> |
13 | <sources failonempty="true"> | 13 | <sources failonempty="true"> |
14 | <include name="AssetHttpServer.cs" /> | ||
15 | <include name="Main.cs" /> | 14 | <include name="Main.cs" /> |
16 | <include name="Properties/AssemblyInfo.cs" /> | 15 | <include name="Properties/AssemblyInfo.cs" /> |
17 | </sources> | 16 | </sources> |
diff --git a/OpenSim/Grid/GridServer/Main.cs b/OpenSim/Grid/GridServer/Main.cs index 2e76cee..a990ff7 100644 --- a/OpenSim/Grid/GridServer/Main.cs +++ b/OpenSim/Grid/GridServer/Main.cs | |||
@@ -127,25 +127,16 @@ namespace OpenSim.Grid.GridServer | |||
127 | httpServer.AddXmlRPCHandler("simulator_login", m_gridManager.XmlRpcSimulatorLoginMethod); | 127 | httpServer.AddXmlRPCHandler("simulator_login", m_gridManager.XmlRpcSimulatorLoginMethod); |
128 | httpServer.AddXmlRPCHandler("map_block", m_gridManager.XmlRpcMapBlockMethod); | 128 | httpServer.AddXmlRPCHandler("map_block", m_gridManager.XmlRpcMapBlockMethod); |
129 | 129 | ||
130 | httpServer.AddRestHandler("GET", "/sims/", m_gridManager.RestGetSimMethod); | 130 | httpServer.AddStreamHandler(new RestStreamHandler("GET", "/sims/", m_gridManager.RestGetSimMethod )); |
131 | httpServer.AddRestHandler("POST", "/sims/", m_gridManager.RestSetSimMethod); | 131 | httpServer.AddStreamHandler(new RestStreamHandler("POST", "/sims/", m_gridManager.RestSetSimMethod )); |
132 | httpServer.AddRestHandler("GET", "/regions/", m_gridManager.RestGetRegionMethod); | 132 | |
133 | httpServer.AddRestHandler("POST", "/regions/", m_gridManager.RestSetRegionMethod); | 133 | httpServer.AddStreamHandler( new RestStreamHandler("GET", "/regions/", m_gridManager.RestGetRegionMethod )); |
134 | 134 | httpServer.AddStreamHandler( new RestStreamHandler("POST","/regions/", m_gridManager.RestSetRegionMethod )); | |
135 | 135 | ||
136 | // lbsa71 : This code snippet taken from old http server. | 136 | //httpServer.AddRestHandler("GET", "/sims/", m_gridManager.RestGetSimMethod); |
137 | // I have no idea what this was supposed to do - looks like an infinite recursion to me. | 137 | //httpServer.AddRestHandler("POST", "/sims/", m_gridManager.RestSetSimMethod); |
138 | // case "regions": | 138 | //httpServer.AddRestHandler("GET", "/regions/", m_gridManager.RestGetRegionMethod); |
139 | //// DIRTY HACK ALERT | 139 | //httpServer.AddRestHandler("POST", "/regions/", m_gridManager.RestSetRegionMethod); |
140 | //Console.Notice("/regions/ accessed"); | ||
141 | //TheSim = OpenGrid_Main.thegrid._regionmanager.GetProfileByHandle((ulong)Convert.ToUInt64(rest_params[1])); | ||
142 | //respstring = ParseREST("/regions/" + rest_params[1], requestBody, HTTPmethod); | ||
143 | //break; | ||
144 | |||
145 | // lbsa71 : I guess these were never used? | ||
146 | //Listener.Prefixes.Add("http://+:8001/gods/"); | ||
147 | //Listener.Prefixes.Add("http://+:8001/highestuuid/"); | ||
148 | //Listener.Prefixes.Add("http://+:8001/uuidblocks/"); | ||
149 | 140 | ||
150 | httpServer.Start(); | 141 | httpServer.Start(); |
151 | 142 | ||
diff --git a/OpenSim/Grid/UserServer/Main.cs b/OpenSim/Grid/UserServer/Main.cs index 5560e7d..30465a3 100644 --- a/OpenSim/Grid/UserServer/Main.cs +++ b/OpenSim/Grid/UserServer/Main.cs | |||
@@ -105,8 +105,8 @@ namespace OpenSim.Grid.UserServer | |||
105 | httpServer.AddXmlRPCHandler("get_user_by_name", m_userManager.XmlRPCGetUserMethodName); | 105 | httpServer.AddXmlRPCHandler("get_user_by_name", m_userManager.XmlRPCGetUserMethodName); |
106 | httpServer.AddXmlRPCHandler("get_user_by_uuid", m_userManager.XmlRPCGetUserMethodUUID); | 106 | httpServer.AddXmlRPCHandler("get_user_by_uuid", m_userManager.XmlRPCGetUserMethodUUID); |
107 | 107 | ||
108 | httpServer.AddRestHandler("DELETE", "/usersessions/", m_userManager.RestDeleteUserSessionMethod); | 108 | httpServer.AddStreamHandler( new RestStreamHandler("DELETE", "/usersessions/", m_userManager.RestDeleteUserSessionMethod )); |
109 | 109 | ||
110 | httpServer.Start(); | 110 | httpServer.Start(); |
111 | m_console.Status("Userserver 0.3 - Startup complete"); | 111 | m_console.Status("Userserver 0.3 - Startup complete"); |
112 | } | 112 | } |
diff --git a/OpenSim/Region/Application/OpenSimMain.cs b/OpenSim/Region/Application/OpenSimMain.cs index eaa067b..e2486bd 100644 --- a/OpenSim/Region/Application/OpenSimMain.cs +++ b/OpenSim/Region/Application/OpenSimMain.cs | |||
@@ -44,6 +44,7 @@ using OpenSim.Region.ClientStack; | |||
44 | using OpenSim.Region.Communications.Local; | 44 | using OpenSim.Region.Communications.Local; |
45 | using OpenSim.Region.Communications.OGS1; | 45 | using OpenSim.Region.Communications.OGS1; |
46 | using OpenSim.Region.Environment.Scenes; | 46 | using OpenSim.Region.Environment.Scenes; |
47 | using System.Text; | ||
47 | 48 | ||
48 | namespace OpenSim | 49 | namespace OpenSim |
49 | { | 50 | { |
@@ -51,7 +52,7 @@ namespace OpenSim | |||
51 | public class OpenSimMain : RegionApplicationBase, conscmd_callback | 52 | public class OpenSimMain : RegionApplicationBase, conscmd_callback |
52 | { | 53 | { |
53 | protected CommunicationsManager commsManager; | 54 | protected CommunicationsManager commsManager; |
54 | // private CheckSumServer checkServer; | 55 | // private CheckSumServer checkServer; |
55 | 56 | ||
56 | private bool m_silent; | 57 | private bool m_silent; |
57 | private string m_logFilename = "region-console-" + Guid.NewGuid().ToString() + ".log"; | 58 | private string m_logFilename = "region-console-" + Guid.NewGuid().ToString() + ".log"; |
@@ -84,10 +85,10 @@ namespace OpenSim | |||
84 | m_log = new LogBase(m_logFilename, "Region", this, m_silent); | 85 | m_log = new LogBase(m_logFilename, "Region", this, m_silent); |
85 | MainLog.Instance = m_log; | 86 | MainLog.Instance = m_log; |
86 | 87 | ||
87 | m_log.Verbose( "Main.cs:Startup() - Loading configuration"); | 88 | m_log.Verbose("Main.cs:Startup() - Loading configuration"); |
88 | this.serversData.InitConfig(this.m_sandbox, this.localConfig); | 89 | this.serversData.InitConfig(this.m_sandbox, this.localConfig); |
89 | this.localConfig.Close();//for now we can close it as no other classes read from it , but this should change | 90 | this.localConfig.Close();//for now we can close it as no other classes read from it , but this should change |
90 | 91 | ||
91 | ScenePresence.LoadTextureFile("avatar-texture.dat"); | 92 | ScenePresence.LoadTextureFile("avatar-texture.dat"); |
92 | 93 | ||
93 | ClientView.TerrainManager = new TerrainManager(new SecondLife()); | 94 | ClientView.TerrainManager = new TerrainManager(new SecondLife()); |
@@ -95,8 +96,8 @@ namespace OpenSim | |||
95 | if (m_sandbox) | 96 | if (m_sandbox) |
96 | { | 97 | { |
97 | this.SetupLocalGridServers(); | 98 | this.SetupLocalGridServers(); |
98 | // this.checkServer = new CheckSumServer(12036); | 99 | // this.checkServer = new CheckSumServer(12036); |
99 | // this.checkServer.ServerListener(); | 100 | // this.checkServer.ServerListener(); |
100 | this.commsManager = new CommunicationsLocal(this.serversData); | 101 | this.commsManager = new CommunicationsLocal(this.serversData); |
101 | } | 102 | } |
102 | else | 103 | else |
@@ -114,7 +115,7 @@ namespace OpenSim | |||
114 | 115 | ||
115 | this.SetupWorld(); | 116 | this.SetupWorld(); |
116 | 117 | ||
117 | m_log.Verbose( "Main.cs:Startup() - Initialising HTTP server"); | 118 | m_log.Verbose("Main.cs:Startup() - Initialising HTTP server"); |
118 | 119 | ||
119 | 120 | ||
120 | 121 | ||
@@ -124,7 +125,7 @@ namespace OpenSim | |||
124 | } | 125 | } |
125 | 126 | ||
126 | //Start http server | 127 | //Start http server |
127 | m_log.Verbose( "Main.cs:Startup() - Starting HTTP server"); | 128 | m_log.Verbose("Main.cs:Startup() - Starting HTTP server"); |
128 | httpServer.Start(); | 129 | httpServer.Start(); |
129 | 130 | ||
130 | // Start UDP servers | 131 | // Start UDP servers |
@@ -145,7 +146,7 @@ namespace OpenSim | |||
145 | } | 146 | } |
146 | catch (Exception e) | 147 | catch (Exception e) |
147 | { | 148 | { |
148 | m_log.Error( e.Message + "\nSorry, could not setup local cache"); | 149 | m_log.Error(e.Message + "\nSorry, could not setup local cache"); |
149 | Environment.Exit(1); | 150 | Environment.Exit(1); |
150 | } | 151 | } |
151 | 152 | ||
@@ -160,7 +161,7 @@ namespace OpenSim | |||
160 | } | 161 | } |
161 | catch (Exception e) | 162 | catch (Exception e) |
162 | { | 163 | { |
163 | m_log.Error( e.Message + "\nSorry, could not setup remote cache"); | 164 | m_log.Error(e.Message + "\nSorry, could not setup remote cache"); |
164 | Environment.Exit(1); | 165 | Environment.Exit(1); |
165 | } | 166 | } |
166 | } | 167 | } |
@@ -226,7 +227,7 @@ namespace OpenSim | |||
226 | LocalWorld.LoadStorageDLL("OpenSim.Region.Storage.LocalStorageDb4o.dll"); //all these dll names shouldn't be hard coded. | 227 | LocalWorld.LoadStorageDLL("OpenSim.Region.Storage.LocalStorageDb4o.dll"); //all these dll names shouldn't be hard coded. |
227 | LocalWorld.LoadWorldMap(); | 228 | LocalWorld.LoadWorldMap(); |
228 | 229 | ||
229 | m_log.Verbose( "Main.cs:Startup() - Starting up messaging system"); | 230 | m_log.Verbose("Main.cs:Startup() - Starting up messaging system"); |
230 | LocalWorld.PhysScene = this.physManager.GetPhysicsScene(this.m_physicsEngine); | 231 | LocalWorld.PhysScene = this.physManager.GetPhysicsScene(this.m_physicsEngine); |
231 | LocalWorld.PhysScene.SetTerrain(LocalWorld.Terrain.getHeights1D()); | 232 | LocalWorld.PhysScene.SetTerrain(LocalWorld.Terrain.getHeights1D()); |
232 | LocalWorld.LoadPrimsFromStorage(); | 233 | LocalWorld.LoadPrimsFromStorage(); |
@@ -244,21 +245,36 @@ namespace OpenSim | |||
244 | } | 245 | } |
245 | } | 246 | } |
246 | 247 | ||
247 | protected override void SetupHttpListener() | 248 | private class SimStatusHandler : IStreamHandler |
248 | { | 249 | { |
249 | httpServer = new BaseHttpServer(this.serversData.HttpListenerPort); //regionData[0].IPListenPort); | 250 | public byte[] Handle(string path, Stream request) |
251 | { | ||
252 | return Encoding.UTF8.GetBytes("OK"); | ||
253 | } | ||
250 | 254 | ||
251 | if (!this.m_sandbox) | 255 | public string ContentType |
252 | { | 256 | { |
257 | get { return "text/plain"; } | ||
258 | } | ||
253 | 259 | ||
254 | // we are in Grid mode so set a XmlRpc handler to handle "expect_user" calls from the user server | 260 | public string HttpMethod |
261 | { | ||
262 | get { return "GET"; } | ||
263 | } | ||
264 | |||
265 | public string Path | ||
266 | { | ||
267 | get { return "/simstatus/"; } | ||
268 | } | ||
269 | } | ||
255 | 270 | ||
271 | protected override void SetupHttpListener() | ||
272 | { | ||
273 | httpServer = new BaseHttpServer(this.serversData.HttpListenerPort); //regionData[0].IPListenPort); | ||
256 | 274 | ||
257 | httpServer.AddRestHandler("GET", "/simstatus/", | 275 | if (!this.m_sandbox) |
258 | delegate(string request, string path, string param) | 276 | { |
259 | { | 277 | httpServer.AddStreamHandler( new SimStatusHandler() ); |
260 | return "OK"; | ||
261 | }); | ||
262 | } | 278 | } |
263 | } | 279 | } |
264 | 280 | ||
@@ -340,7 +356,7 @@ namespace OpenSim | |||
340 | switch (attri) | 356 | switch (attri) |
341 | { | 357 | { |
342 | default: | 358 | default: |
343 | m_log.Warn( "Main.cs: SetupFromConfig() - Invalid value for PhysicsEngine attribute, terminating"); | 359 | m_log.Warn("Main.cs: SetupFromConfig() - Invalid value for PhysicsEngine attribute, terminating"); |
344 | Environment.Exit(1); | 360 | Environment.Exit(1); |
345 | break; | 361 | break; |
346 | 362 | ||
@@ -376,11 +392,11 @@ namespace OpenSim | |||
376 | /// </summary> | 392 | /// </summary> |
377 | public virtual void Shutdown() | 393 | public virtual void Shutdown() |
378 | { | 394 | { |
379 | m_log.Verbose( "Main.cs:Shutdown() - Closing all threads"); | 395 | m_log.Verbose("Main.cs:Shutdown() - Closing all threads"); |
380 | m_log.Verbose( "Main.cs:Shutdown() - Killing listener thread"); | 396 | m_log.Verbose("Main.cs:Shutdown() - Killing listener thread"); |
381 | m_log.Verbose( "Main.cs:Shutdown() - Killing clients"); | 397 | m_log.Verbose("Main.cs:Shutdown() - Killing clients"); |
382 | // IMPLEMENT THIS | 398 | // IMPLEMENT THIS |
383 | m_log.Verbose( "Main.cs:Shutdown() - Closing console and terminating"); | 399 | m_log.Verbose("Main.cs:Shutdown() - Closing console and terminating"); |
384 | for (int i = 0; i < m_localWorld.Count; i++) | 400 | for (int i = 0; i < m_localWorld.Count; i++) |
385 | { | 401 | { |
386 | ((Scene)m_localWorld[i]).Close(); | 402 | ((Scene)m_localWorld[i]).Close(); |
@@ -400,8 +416,8 @@ namespace OpenSim | |||
400 | switch (command) | 416 | switch (command) |
401 | { | 417 | { |
402 | case "help": | 418 | case "help": |
403 | m_log.Error( "show users - show info about connected users"); | 419 | m_log.Error("show users - show info about connected users"); |
404 | m_log.Error( "shutdown - disconnect all clients and shutdown"); | 420 | m_log.Error("shutdown - disconnect all clients and shutdown"); |
405 | break; | 421 | break; |
406 | 422 | ||
407 | case "show": | 423 | case "show": |
@@ -415,7 +431,7 @@ namespace OpenSim | |||
415 | string result = ""; | 431 | string result = ""; |
416 | for (int i = 0; i < m_localWorld.Count; i++) | 432 | for (int i = 0; i < m_localWorld.Count; i++) |
417 | { | 433 | { |
418 | if (!((Scene)m_localWorld[i]).Terrain.RunTerrainCmd(cmdparams, ref result,m_localWorld[i].RegionInfo.RegionName)) | 434 | if (!((Scene)m_localWorld[i]).Terrain.RunTerrainCmd(cmdparams, ref result, m_localWorld[i].RegionInfo.RegionName)) |
419 | { | 435 | { |
420 | m_log.Error(result); | 436 | m_log.Error(result); |
421 | } | 437 | } |
@@ -427,7 +443,7 @@ namespace OpenSim | |||
427 | break; | 443 | break; |
428 | 444 | ||
429 | default: | 445 | default: |
430 | m_log.Error( "Unknown command"); | 446 | m_log.Error("Unknown command"); |
431 | break; | 447 | break; |
432 | } | 448 | } |
433 | } | 449 | } |
@@ -441,22 +457,22 @@ namespace OpenSim | |||
441 | switch (ShowWhat) | 457 | switch (ShowWhat) |
442 | { | 458 | { |
443 | case "uptime": | 459 | case "uptime": |
444 | m_log.Error( "OpenSim has been running since " + startuptime.ToString()); | 460 | m_log.Error("OpenSim has been running since " + startuptime.ToString()); |
445 | m_log.Error( "That is " + (DateTime.Now - startuptime).ToString()); | 461 | m_log.Error("That is " + (DateTime.Now - startuptime).ToString()); |
446 | break; | 462 | break; |
447 | case "users": | 463 | case "users": |
448 | ScenePresence TempAv; | 464 | ScenePresence TempAv; |
449 | m_log.Error( String.Format("{0,-16}{1,-16}{2,-25}{3,-25}{4,-16}{5,-16}{6,-16}", "Firstname", "Lastname", "Agent ID", "Session ID", "Circuit", "IP","World")); | 465 | m_log.Error(String.Format("{0,-16}{1,-16}{2,-25}{3,-25}{4,-16}{5,-16}{6,-16}", "Firstname", "Lastname", "Agent ID", "Session ID", "Circuit", "IP", "World")); |
450 | for (int i = 0; i < m_localWorld.Count; i++) | 466 | for (int i = 0; i < m_localWorld.Count; i++) |
451 | { | 467 | { |
452 | foreach (libsecondlife.LLUUID UUID in ((Scene)m_localWorld[i]).Entities.Keys) | 468 | foreach (libsecondlife.LLUUID UUID in ((Scene)m_localWorld[i]).Entities.Keys) |
453 | { | 469 | { |
454 | if (((Scene)m_localWorld[i]).Entities[UUID].ToString() == "OpenSim.world.Avatar") | 470 | if (((Scene)m_localWorld[i]).Entities[UUID].ToString() == "OpenSim.world.Avatar") |
455 | { | 471 | { |
456 | TempAv = (ScenePresence)((Scene)m_localWorld[i]).Entities[UUID]; | 472 | TempAv = (ScenePresence)((Scene)m_localWorld[i]).Entities[UUID]; |
457 | m_log.Error(String.Format("{0,-16}{1,-16}{2,-25}{3,-25}{4,-16},{5,-16}{6,-16}", TempAv.firstname, TempAv.lastname, UUID, TempAv.ControllingClient.AgentId, "Unknown", "Unknown"), ((Scene)m_localWorld[i]).RegionInfo.RegionName); | 473 | m_log.Error(String.Format("{0,-16}{1,-16}{2,-25}{3,-25}{4,-16},{5,-16}{6,-16}", TempAv.firstname, TempAv.lastname, UUID, TempAv.ControllingClient.AgentId, "Unknown", "Unknown"), ((Scene)m_localWorld[i]).RegionInfo.RegionName); |
458 | } | 474 | } |
459 | } | 475 | } |
460 | } | 476 | } |
461 | break; | 477 | break; |
462 | } | 478 | } |
diff --git a/OpenSim/Region/Capabilities/Caps.cs b/OpenSim/Region/Capabilities/Caps.cs index 0f6c471..1d07683 100644 --- a/OpenSim/Region/Capabilities/Caps.cs +++ b/OpenSim/Region/Capabilities/Caps.cs | |||
@@ -82,7 +82,7 @@ namespace OpenSim.Region.Capabilities | |||
82 | private void AddCapsHandler( BaseHttpServer httpListener, string path, RestMethod restMethod ) | 82 | private void AddCapsHandler( BaseHttpServer httpListener, string path, RestMethod restMethod ) |
83 | { | 83 | { |
84 | string capsBase = "/CAPS/" + m_capsObjectPath; | 84 | string capsBase = "/CAPS/" + m_capsObjectPath; |
85 | httpListener.AddStreamHandler(capsBase + path, new RestStreamHandler(restMethod, "POST", "application/xml")); | 85 | httpListener.AddStreamHandler(new RestStreamHandler("POST", capsBase + path, restMethod)); |
86 | } | 86 | } |
87 | 87 | ||
88 | /// <summary> | 88 | /// <summary> |
@@ -211,9 +211,11 @@ namespace OpenSim.Region.Capabilities | |||
211 | string res = ""; | 211 | string res = ""; |
212 | LLUUID newAsset = LLUUID.Random(); | 212 | LLUUID newAsset = LLUUID.Random(); |
213 | LLUUID newInvItem = LLUUID.Random(); | 213 | LLUUID newInvItem = LLUUID.Random(); |
214 | string uploaderPath = m_capsObjectPath + Util.RandomClass.Next(5000, 8000).ToString("0000"); | 214 | string uploaderPath = Util.RandomClass.Next(5000, 8000).ToString("0000"); |
215 | AssetUploader uploader = new AssetUploader(newAsset, newInvItem, uploaderPath, this.httpListener); | 215 | AssetUploader uploader = new AssetUploader(newAsset, newInvItem, uploaderPath, this.httpListener); |
216 | httpListener.AddRestHandler("POST", "/CAPS/" + uploaderPath, uploader.uploaderCaps); | 216 | |
217 | AddCapsHandler( httpListener, uploaderPath, uploader.uploaderCaps); | ||
218 | |||
217 | string uploaderURL = "http://" + m_httpListenerHostName + ":" + m_httpListenPort.ToString() + "/CAPS/" + uploaderPath; | 219 | string uploaderURL = "http://" + m_httpListenerHostName + ":" + m_httpListenPort.ToString() + "/CAPS/" + uploaderPath; |
218 | //Console.WriteLine("uploader url is " + uploaderURL); | 220 | //Console.WriteLine("uploader url is " + uploaderURL); |
219 | res += "<llsd><map>"; | 221 | res += "<llsd><map>"; |
@@ -269,7 +271,8 @@ namespace OpenSim.Region.Capabilities | |||
269 | res += "</map></llsd>"; | 271 | res += "</map></llsd>"; |
270 | 272 | ||
271 | // Console.WriteLine("asset " + newAssetID.ToStringHyphenated() + " , inventory item " + inv.ToStringHyphenated()); | 273 | // Console.WriteLine("asset " + newAssetID.ToStringHyphenated() + " , inventory item " + inv.ToStringHyphenated()); |
272 | httpListener.RemoveRestHandler("POST", "/CAPS/" + uploaderPath); | 274 | httpListener.RemoveStreamHandler("POST", "/CAPS/" + uploaderPath); |
275 | |||
273 | if (OnUpLoad != null) | 276 | if (OnUpLoad != null) |
274 | { | 277 | { |
275 | OnUpLoad(newAssetID, inv, data); | 278 | OnUpLoad(newAssetID, inv, data); |