Skip to content

Instantly share code, notes, and snippets.

@ctaggart
Last active August 29, 2015 14:08
Show Gist options
  • Save ctaggart/8a2853bf3faec5044dfd to your computer and use it in GitHub Desktop.
Save ctaggart/8a2853bf3faec5044dfd to your computer and use it in GitHub Desktop.
GET http://s7:27413/octokit/octokit.net/d0fffd4f7ccc5b72b46b4774df4f2c53a04930ef/Octokit/Http/ProductHeaderValue.cs HTTP/1.1
Accept-Encoding: gzip
User-Agent: Microsoft-Symbol-Server/6.3.9600.17095
Host: s7:27413
Connection: Keep-Alive
Pragma: no-cache
HTTP/1.1 401 Unauthorized
Content-Length: 0
Server: Microsoft-HTTPAPI/2.0
WWW-Authenticate: Basic realm="WallyWorld"
Date: Sun, 09 Nov 2014 00:21:09 GMT
Windows Security
devenv.exe
The server s7 is asking for your user name and password. The server reports that it is from WallyWorld.
Warning: Your user name and password will be sent using basic authentication on a connection that isn't secure.
User name
Password
Remember my credentials
GET http://s7:27413/octokit/octokit.net/d0fffd4f7ccc5b72b46b4774df4f2c53a04930ef/Octokit/Http/ProductHeaderValue.cs HTTP/1.1
Accept-Encoding: gzip
User-Agent: Microsoft-Symbol-Server/6.3.9600.17095
Host: s7:27413
Connection: Keep-Alive
Pragma: no-cache
Authorization: Basic dGhldXNlcjp0aGVwYXNzd29yZA==
using Microsoft.AspNet.Builder;
using System.Diagnostics;
namespace WebApplication1
{
public class Startup
{
public void Configure(IApplicationBuilder app)
{
app.Run(async context =>
{
await System.Threading.Tasks.Task.FromResult(0); // suppress CS1998 warnings
var path = context.Request.Path.Value;
Trace.WriteLine("path: " + path);
if (path.StartsWith("/octokit")){
context.Response.StatusCode = 401; // unauthorized
context.Response.Headers.Add("WWW-Authenticate", new[] { "Basic realm=\"WallyWorld\"" }); // yes
//context.Response.Headers.Add("WWW-Authenticate", new[] { "Digest realm=\"WallyWorld\"" }); // no
return;
}
context.Response.StatusCode = 404; // not found
});
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment