Changeset 185 for SimpleHttpServer
- Timestamp:
- 07/29/07 03:36:04 (18 months ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
SimpleHttpServer/SimpleHttpServer/SimpleHttpServer.cs
r184 r185 1 // $Id$ 2 #region LICENSE 3 /* 4 * The MIT License 5 * 6 * Copyright © 2007 Mayuki Sawatari <mayuki@misuzilla.org> 7 * 8 * Permission is hereby granted, free of charge, to any person obtaining a copy 9 * of this software and associated documentation files (the "Software"), to deal 10 * in the Software without restriction, including without limitation the rights 11 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 * copies of the Software, and to permit persons to whom the Software is 13 * furnished to do so, subject to the following conditions: 14 * 15 * The above copyright notice and this permission notice shall be included in 16 * all copies or substantial portions of the Software. 17 * 18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 * THE SOFTWARE. 25 */ 26 #endregion 1 27 using System; 2 28 using System.Collections.Generic; … … 94 120 else 95 121 { 96 // XXX: �܂������122 // XXX: 折り返し非対応 97 123 String[] headerField = line.Split(new Char[] { ':' }, 2); 98 124 if (headerField.Length != 2) … … 120 146 121 147 122 #region IDisposable �����o148 #region IDisposable メンバ 123 149 124 150 public void Dispose() … … 230 256 } 231 257 232 #region IDisposable �����o258 #region IDisposable メンバ 233 259 234 260 public void Dispose() … … 243 269 } 244 270 245 #region HTTP �T�[�o�N���X271 #region HTTP サーバクラス 246 272 public delegate void RequestEventHandler(Context ctx); 247 273 public class SimpleHttpServer … … 332 358 if (IPAddress.IsLoopback(((IPEndPoint)Context.Current.TcpClient.Client.RemoteEndPoint).Address)) 333 359 { 334 sw.WriteLine("<h2> ��</h2>");360 sw.WriteLine("<h2>例外</h2>"); 335 361 sw.WriteLine("<pre>{0}</pre>", HttpUtility.HtmlEncode(he.ToString())); 336 362 } … … 378 404 sw.WriteLine("<title>500 Internal Server Error</title>"); 379 405 sw.WriteLine("<h1>500 Internal Server Error</h1>"); 380 sw.WriteLine("<p> �T�[�o�ŏ�����s���ɃG���[���������܂����B</p>");406 sw.WriteLine("<p>サーバで処理を実行中にエラーが発生しました。</p>"); 381 407 if (IPAddress.IsLoopback(((IPEndPoint)tcpClient.Client.RemoteEndPoint).Address)) 382 408 { 383 sw.WriteLine("<h2> ��</h2>");409 sw.WriteLine("<h2>例外</h2>"); 384 410 sw.WriteLine("<pre>{0}</pre>", HttpUtility.HtmlEncode(e.ToString())); 385 411 } … … 478 504 #endregion 479 505 480 #region HttpStream �N���X506 #region HttpStream クラス 481 507 public class HttpStream : Stream 482 508 {
