aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorTeravus Ovares2008-09-14 23:39:35 +0000
committerTeravus Ovares2008-09-14 23:39:35 +0000
commitcdced699fb497ebf3ecbbd306269dbbda337aadc (patch)
tree52090ec782b916dcf048becf8103d6a2e51a9f0e
parent* This update makes configuring SSL a little easier on Windows XP. It also m... (diff)
downloadopensim-SC_OLD-cdced699fb497ebf3ecbbd306269dbbda337aadc.zip
opensim-SC_OLD-cdced699fb497ebf3ecbbd306269dbbda337aadc.tar.gz
opensim-SC_OLD-cdced699fb497ebf3ecbbd306269dbbda337aadc.tar.bz2
opensim-SC_OLD-cdced699fb497ebf3ecbbd306269dbbda337aadc.tar.xz
* Made Seed CAP response respect the SSL setting.
-rw-r--r--OpenSim/Framework/Communications/Capabilities/Caps.cs44
-rw-r--r--OpenSim/Framework/Communications/Capabilities/CapsHandlers.cs28
-rw-r--r--OpenSim/Framework/Servers/BaseHttpServer.cs15
3 files changed, 82 insertions, 5 deletions
diff --git a/OpenSim/Framework/Communications/Capabilities/Caps.cs b/OpenSim/Framework/Communications/Capabilities/Caps.cs
index e82a5e9..a0c59ad 100644
--- a/OpenSim/Framework/Communications/Capabilities/Caps.cs
+++ b/OpenSim/Framework/Communications/Capabilities/Caps.cs
@@ -104,6 +104,15 @@ namespace OpenSim.Framework.Communications.Capabilities
104 private bool m_dumpAssetsToFile; 104 private bool m_dumpAssetsToFile;
105 private string m_regionName; 105 private string m_regionName;
106 106
107 public bool SSLCaps
108 {
109 get { return m_httpListener.UseSSL; }
110 }
111 public string SSLCommonName
112 {
113 get { return m_httpListener.SSLCommonName; }
114 }
115
107 // These are callbacks which will be setup by the scene so that we can update scene data when we 116 // These are callbacks which will be setup by the scene so that we can update scene data when we
108 // receive capability calls 117 // receive capability calls
109 public NewInventoryItem AddNewInventoryItem = null; 118 public NewInventoryItem AddNewInventoryItem = null;
@@ -119,10 +128,19 @@ namespace OpenSim.Framework.Communications.Capabilities
119 m_capsObjectPath = capsPath; 128 m_capsObjectPath = capsPath;
120 m_httpListener = httpServer; 129 m_httpListener = httpServer;
121 m_httpListenerHostName = httpListen; 130 m_httpListenerHostName = httpListen;
131
122 m_httpListenPort = httpPort; 132 m_httpListenPort = httpPort;
133
134 if (httpServer.UseSSL)
135 {
136 m_httpListenPort = httpServer.SSLPort;
137 httpListen = httpServer.SSLCommonName;
138 httpPort = httpServer.SSLPort;
139 }
140
123 m_agentID = agent; 141 m_agentID = agent;
124 m_dumpAssetsToFile = dumpAssetsToFile; 142 m_dumpAssetsToFile = dumpAssetsToFile;
125 m_capsHandlers = new CapsHandlers(httpServer, httpListen, httpPort); 143 m_capsHandlers = new CapsHandlers(httpServer, httpListen, httpPort, httpServer.UseSSL);
126 m_regionName = regionName; 144 m_regionName = regionName;
127 } 145 }
128 146
@@ -541,7 +559,13 @@ namespace OpenSim.Framework.Communications.Capabilities
541 559
542 m_httpListener.AddStreamHandler( 560 m_httpListener.AddStreamHandler(
543 new BinaryStreamHandler("POST", capsBase + uploaderPath, uploader.uploaderCaps)); 561 new BinaryStreamHandler("POST", capsBase + uploaderPath, uploader.uploaderCaps));
544 string uploaderURL = "http://" + m_httpListenerHostName + ":" + m_httpListenPort.ToString() + capsBase + 562
563 string protocol = "http://";
564
565 if (m_httpListener.UseSSL)
566 protocol = "https://";
567
568 string uploaderURL = protocol + m_httpListenerHostName + ":" + m_httpListenPort.ToString() + capsBase +
545 uploaderPath; 569 uploaderPath;
546 570
547 LLSDAssetUploadResponse uploadResponse = new LLSDAssetUploadResponse(); 571 LLSDAssetUploadResponse uploadResponse = new LLSDAssetUploadResponse();
@@ -587,7 +611,13 @@ namespace OpenSim.Framework.Communications.Capabilities
587 611
588 m_httpListener.AddStreamHandler( 612 m_httpListener.AddStreamHandler(
589 new BinaryStreamHandler("POST", capsBase + uploaderPath, uploader.uploaderCaps)); 613 new BinaryStreamHandler("POST", capsBase + uploaderPath, uploader.uploaderCaps));
590 string uploaderURL = "http://" + m_httpListenerHostName + ":" + m_httpListenPort.ToString() + capsBase + 614
615 string protocol = "http://";
616
617 if (m_httpListener.UseSSL)
618 protocol = "https://";
619
620 string uploaderURL = protocol + m_httpListenerHostName + ":" + m_httpListenPort.ToString() + capsBase +
591 uploaderPath; 621 uploaderPath;
592 622
593 LLSDAssetUploadResponse uploadResponse = new LLSDAssetUploadResponse(); 623 LLSDAssetUploadResponse uploadResponse = new LLSDAssetUploadResponse();
@@ -646,7 +676,13 @@ namespace OpenSim.Framework.Communications.Capabilities
646 llsdRequest.asset_type, capsBase + uploaderPath, m_httpListener, m_dumpAssetsToFile); 676 llsdRequest.asset_type, capsBase + uploaderPath, m_httpListener, m_dumpAssetsToFile);
647 m_httpListener.AddStreamHandler( 677 m_httpListener.AddStreamHandler(
648 new BinaryStreamHandler("POST", capsBase + uploaderPath, uploader.uploaderCaps)); 678 new BinaryStreamHandler("POST", capsBase + uploaderPath, uploader.uploaderCaps));
649 string uploaderURL = "http://" + m_httpListenerHostName + ":" + m_httpListenPort.ToString() + capsBase + 679
680 string protocol = "http://";
681
682 if (m_httpListener.UseSSL)
683 protocol = "https://";
684
685 string uploaderURL = protocol + m_httpListenerHostName + ":" + m_httpListenPort.ToString() + capsBase +
650 uploaderPath; 686 uploaderPath;
651 687
652 LLSDAssetUploadResponse uploadResponse = new LLSDAssetUploadResponse(); 688 LLSDAssetUploadResponse uploadResponse = new LLSDAssetUploadResponse();
diff --git a/OpenSim/Framework/Communications/Capabilities/CapsHandlers.cs b/OpenSim/Framework/Communications/Capabilities/CapsHandlers.cs
index 4a3d00f..ed31c45 100644
--- a/OpenSim/Framework/Communications/Capabilities/CapsHandlers.cs
+++ b/OpenSim/Framework/Communications/Capabilities/CapsHandlers.cs
@@ -42,6 +42,7 @@ namespace OpenSim.Framework.Communications.Capabilities
42 private BaseHttpServer m_httpListener; 42 private BaseHttpServer m_httpListener;
43 private string m_httpListenerHostName; 43 private string m_httpListenerHostName;
44 private uint m_httpListenerPort; 44 private uint m_httpListenerPort;
45 private bool m_useSSL = false;
45 46
46 /// <summary></summary> 47 /// <summary></summary>
47 /// CapsHandlers is a cap handler container but also takes 48 /// CapsHandlers is a cap handler container but also takes
@@ -53,10 +54,30 @@ namespace OpenSim.Framework.Communications.Capabilities
53 /// server</param> 54 /// server</param>
54 /// <param name="httpListenerPort">HTTP port</param> 55 /// <param name="httpListenerPort">HTTP port</param>
55 public CapsHandlers(BaseHttpServer httpListener, string httpListenerHostname, uint httpListenerPort) 56 public CapsHandlers(BaseHttpServer httpListener, string httpListenerHostname, uint httpListenerPort)
57 : this (httpListener,httpListenerHostname,httpListenerPort, false)
58 {
59 }
60
61 /// <summary></summary>
62 /// CapsHandlers is a cap handler container but also takes
63 /// care of adding and removing cap handlers to and from the
64 /// supplied BaseHttpServer.
65 /// </summary>
66 /// <param name="httpListener">base HTTP server</param>
67 /// <param name="httpListenerHostname">host name of the HTTP
68 /// server</param>
69 /// <param name="httpListenerPort">HTTP port</param>
70 public CapsHandlers(BaseHttpServer httpListener, string httpListenerHostname, uint httpListenerPort, bool https)
56 { 71 {
57 m_httpListener = httpListener; 72 m_httpListener = httpListener;
58 m_httpListenerHostName = httpListenerHostname; 73 m_httpListenerHostName = httpListenerHostname;
59 m_httpListenerPort = httpListenerPort; 74 m_httpListenerPort = httpListenerPort;
75 m_useSSL = https;
76 if (m_useSSL)
77 {
78 m_httpListenerHostName = httpListener.SSLCommonName;
79 m_httpListenerPort = httpListener.SSLPort;
80 }
60 } 81 }
61 82
62 /// <summary> 83 /// <summary>
@@ -130,7 +151,12 @@ namespace OpenSim.Framework.Communications.Capabilities
130 get 151 get
131 { 152 {
132 Hashtable caps = new Hashtable(); 153 Hashtable caps = new Hashtable();
133 string baseUrl = "http://" + m_httpListenerHostName + ":" + m_httpListenerPort.ToString(); 154 string protocol = "http://";
155
156 if (m_useSSL)
157 protocol = "https://";
158
159 string baseUrl = protocol + m_httpListenerHostName + ":" + m_httpListenerPort.ToString();
134 foreach (string capsName in m_capsHandlers.Keys) 160 foreach (string capsName in m_capsHandlers.Keys)
135 { 161 {
136 // skip SEED cap 162 // skip SEED cap
diff --git a/OpenSim/Framework/Servers/BaseHttpServer.cs b/OpenSim/Framework/Servers/BaseHttpServer.cs
index 6cf6744..bde1f7e 100644
--- a/OpenSim/Framework/Servers/BaseHttpServer.cs
+++ b/OpenSim/Framework/Servers/BaseHttpServer.cs
@@ -61,16 +61,28 @@ namespace OpenSim.Framework.Servers
61 protected uint m_sslport; 61 protected uint m_sslport;
62 protected bool m_ssl = false; 62 protected bool m_ssl = false;
63 protected bool m_firstcaps = true; 63 protected bool m_firstcaps = true;
64 protected string m_SSLCommonName = "";
64 65
65 public uint SSLPort 66 public uint SSLPort
66 { 67 {
67 get { return m_sslport; } 68 get { return m_sslport; }
68 } 69 }
70
71 public string SSLCommonName
72 {
73 get { return m_SSLCommonName; }
74 }
75
69 public uint Port 76 public uint Port
70 { 77 {
71 get { return m_port; } 78 get { return m_port; }
72 } 79 }
73 80
81 public bool UseSSL
82 {
83 get { return m_ssl; }
84 }
85
74 public BaseHttpServer(uint port) 86 public BaseHttpServer(uint port)
75 { 87 {
76 m_port = port; 88 m_port = port;
@@ -83,6 +95,7 @@ namespace OpenSim.Framework.Servers
83 95
84 } 96 }
85 97
98
86 public BaseHttpServer(uint port, bool ssl, uint sslport, string CN) 99 public BaseHttpServer(uint port, bool ssl, uint sslport, string CN)
87 { 100 {
88 m_ssl = ssl; 101 m_ssl = ssl;
@@ -103,6 +116,8 @@ namespace OpenSim.Framework.Servers
103 if (CN.Length > 0) 116 if (CN.Length > 0)
104 searchCN = CN.ToUpper(); 117 searchCN = CN.ToUpper();
105 118
119 m_SSLCommonName = searchCN;
120
106 Type t = Type.GetType("Mono.Runtime"); 121 Type t = Type.GetType("Mono.Runtime");
107 if (t != null) 122 if (t != null)
108 { 123 {