Created
July 3, 2013 10:13
-
-
Save gregoryyoung/5916838 to your computer and use it in GitHub Desktop.
from httplistener.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| else { | |
| throw new ArgumentException(SR.GetString(SR.net_listener_scheme), "uriPrefix"); | |
| } | |
| bool inSquareBrakets = false; | |
| int j = i; | |
| while (j<uriprefix.length &&="" uriprefix[j]!="/" (uriprefix[j]!=":" ||="" insquarebrakets))="" {="" if="" (uriprefix[j]="='[')" (insquarebrakets)="" j="i;" break;="" }="" insquarebrakets="true;" (insquarebrakets="" uriprefix[j]="=']')" j++;="" (i="=j)" throw="" new="" argumentexception(sr.getstring(sr.net_listener_host),="" "uriprefix");="" (uriprefix[uriprefix.length-1]!="/" )="" argumentexception(sr.getstring(sr.net_listener_slash),="" registeredprefix="uriPrefix[j]==':'" ?="" string.copy(uriprefix)="" :="" uriprefix.substring(0,="" j)="" +="" ":80"="" ":443")="" uriprefix.substring(j);="" fixed="" (char*="" pchar="registeredPrefix)" i="0;" while="" (pchar[i]!=":" pchar[i]="(char)CaseInsensitiveAscii.AsciiToLower[(byte)pChar[i]];" i++;="" globallog.print("httplistener#"="" validationhelper.hashstring(this)="" "::addprefix()="" mapped="" uriprefix:"="" uriprefix="" "="" to="" registeredprefix:"="" registeredprefix);="" (m_state="=State.Started)" calling="" unsafenclnativemethods.httpapi.httpaddurl[tourlgroup]");="" uint="" statuscode="InternalAddPrefix(registeredPrefix);" (statuscode!="UnsafeNclNativeMethods.ErrorCodes.ERROR_SUCCESS)" (statuscode="=" unsafenclnativemethods.errorcodes.error_already_exists)="" httplistenerexception((int)statuscode,="" sr.getstring(sr.net_listener_already,="" registeredprefix));="" else="" httplistenerexception((int)statuscode);="" m_uriprefixes[uriprefix]="registeredPrefix;" m_defaultservicenames.add(uriprefix);="" catch="" (exception="" exception)="" if(logging.on)logging.exception(logging.httplistener,="" this,="" "addprefix",="" exception);="" throw;="" finally="" if(logging.on)logging.exit(logging.httplistener,="" "prefix:"="" public="" httplistenerprefixcollection="" prefixes="" get="" if(logging.on)logging.enter(logging.httplistener,="" "prefixes_get",="" "");="" checkdisposed();="" (m_prefixes="=null)" m_prefixes="new" httplistenerprefixcollection(this);="" return="" m_prefixes;="" internal="" bool="" removeprefix(string="" uriprefix)="" "removeprefix",="" "uriprefix:"="" uriprefix);="" try="" "::removeprefix()="" (uriprefix="=null)" argumentnullexception("uriprefix");="" if(!m_uriprefixes.contains(uriprefix)){="" false;="" internalremoveprefix((string)m_uriprefixes[uriprefix]);="" m_uriprefixes.remove(uriprefix);="" m_defaultservicenames.remove(uriprefix);="" true;="" void="" removeall(bool="" clear)="" "removeall",="" go="" through="" the="" uri="" list="" and="" unregister="" for="" each="" one="" of="" them="" (m_uriprefixes.count="">0) { | |
| if (m_State==State.Started) { | |
| foreach (string registeredPrefix in m_UriPrefixes.Values) { | |
| // ignore possible failures | |
| InternalRemovePrefix(registeredPrefix); | |
| } | |
| } | |
| if (clear) { | |
| m_UriPrefixes.Clear(); | |
| m_DefaultServiceNames.Clear(); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment

should be clear from this http://www.dotnetframework.org/default.aspx/4@0/4@0/untmp/DEVDIV_TFS/Dev10/Releases/RTMRel/ndp/fx/src/Net/System/Net/HttpListener@cs/1305376/HttpListener@cs version of the source. This code obviously wont compile ;-)