1 //------------------------------------------------------------------------------ 2 // <copyright file="HttpPostServerProtocol.cs" company="Microsoft"> 3 // Copyright (c) Microsoft Corporation. All rights reserved. 4 // </copyright> 5 //------------------------------------------------------------------------------ 6 7 namespace System.Web.Services.Protocols { 8 9 using System.Net; 10 11 internal class HttpPostLocalhostServerProtocolFactory : ServerProtocolFactory { CreateIfRequestCompatible(HttpRequest request)12 protected override ServerProtocol CreateIfRequestCompatible(HttpRequest request) { 13 if (request.PathInfo.Length < 2) 14 return null; 15 if (request.HttpMethod != "POST") 16 // MethodNotAllowed = 405, 17 return new UnsupportedRequestProtocol(405); 18 19 bool isLocal = request.Url.IsLoopback || request.IsLocal; 20 if (!isLocal) 21 return null; 22 23 return new HttpPostServerProtocol(); 24 } 25 } 26 } 27