Skip to content

Shallow copy instead of deep copy used for prefix list in WebRequest.Create() #241

@adrian-klein

Description

@adrian-klein

Hi, I was just reading through System.Net.WebRequest.cs and I stumbled over the following section in Create(Uri requestUri, bool useUriBase):

         // Copy the prefix list so that if it is updated it will
         // not affect us on this thread.

         ArrayList prefixList = PrefixList;

Maybe I misunderstood the intention, but I think this does not really prevent a concurrent modification.

Both
RegisterPrefix(string prefix, IWebRequestCreate creator)
and
UnregisterPrefix(string prefix)
in that same file use a PrefixList.Clone() instead, which really does make sure that it's not modified externally.

Kind regards
Adrian

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions