Skip to content

Commit 3933dc5

Browse files
committed
Minor configuration updates to ensure PUT is not hijacked by WebDAV module
1 parent d997741 commit 3933dc5

3 files changed

Lines changed: 16 additions & 4 deletions

File tree

src/NuGet.Server/Core/Helpers.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ public static string GetRepositoryUrl(Uri currentUrl, string applicationPath)
1414

1515
public static string GetPushUrl(Uri currentUrl, string applicationPath)
1616
{
17-
return GetBaseUrl(currentUrl, applicationPath) + "nuget";
17+
return GetBaseUrl(currentUrl, applicationPath) + "api/v2/package";
1818
}
1919

2020
public static string GetBaseUrl(Uri currentUrl, string applicationPath)

src/NuGet.Server/Default.aspx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,12 @@
2424
<strong><%= Helpers.GetRepositoryUrl(Request.Url, Request.ApplicationPath) %></strong>
2525
</blockquote>
2626
<% if (string.IsNullOrEmpty(ConfigurationManager.AppSettings["apiKey"])) { %>
27-
To enable pushing packages to this feed using the nuget command line tool (nuget.exe). Set the api key appSetting in web.config.
27+
To enable pushing packages to this feed using the <a href="https://www.nuget.org/downloads">NuGet command line tool</a> (nuget.exe), set the api key appSetting in web.config.
2828
<% } else { %>
29-
Use the command below to push packages to this feed using the nuget command line tool (nuget.exe).
29+
Use the command below to push packages to this feed using the <a href="https://www.nuget.org/downloads">NuGet command line tool</a> (nuget.exe).
3030
<% } %>
3131
<blockquote>
32-
<strong>nuget push {package file} -s <%= Helpers.GetPushUrl(Request.Url, Request.ApplicationPath) %> {apikey}</strong>
32+
<strong>nuget.exe push {package file} {apikey} -Source <%= Helpers.GetPushUrl(Request.Url, Request.ApplicationPath) %></strong>
3333
</blockquote>
3434
</fieldset>
3535

src/NuGet.Server/Web.config

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,18 @@
6969
<mimeMap fileExtension=".nupkg" mimeType="application/zip" />
7070
</staticContent>
7171
<modules runAllManagedModulesForAllRequests="true">
72+
<remove name="WebDAVModule" />
7273
</modules>
74+
<handlers>
75+
<remove name="WebDAV" />
76+
77+
<remove name="ExtensionlessUrlHandler-Integrated-4.0" />
78+
<add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="GET,HEAD,POST,PUT,DEBUG" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" />
79+
</handlers>
80+
<security>
81+
<requestFiltering>
82+
<requestLimits maxAllowedContentLength="31457280" />
83+
</requestFiltering>
84+
</security>
7385
</system.webServer>
7486
</configuration>

0 commit comments

Comments
 (0)