Skip to content

Commit f224498

Browse files
committed
Proffer file extensions and show DNS resolves
1 parent e7c31ef commit f224498

File tree

3 files changed

+35
-23
lines changed

3 files changed

+35
-23
lines changed

FiddlerImportNetlog/FiddlerInterface.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,10 @@
88

99
namespace FiddlerImportNetlog
1010
{
11-
[ProfferFormat("NetLog JSON", "Chromium's JSON-based event log format (v1.3.2.1). See https://dev.chromium.org/for-testers/providing-network-details for more details.")]
11+
[ProfferFormat("NetLog JSON",
12+
"Chromium's JSON-based event log format (v1.3.2.2). See https://dev.chromium.org/for-testers/providing-network-details for more details.",
13+
".json;.gz" // We handle import of JSON files.
14+
)]
1215
public class HTTPArchiveFormatImport : ISessionImporter
1316
{
1417
public Session[] ImportSessions(string sFormat, Dictionary<string, object> dictOptions, EventHandler<Fiddler.ProgressCallbackEventArgs> evtProgressNotifications)

FiddlerImportNetlog/Importer.cs

Lines changed: 27 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -836,44 +836,50 @@ private void GenerateSocketListSession(Dictionary<int, List<Hashtable>> dictSock
836836

837837
private void GenerateDNSResolutionListSession(Dictionary<int, List<Hashtable>> dictDNSResolutions)
838838
{
839+
if (dictDNSResolutions.Count < 1) return;
839840
try
840841
{
841-
// if (htAllSockets.Count > 0)
842+
Hashtable htAllResolutions = new Hashtable();
843+
foreach (KeyValuePair<int, List<Hashtable>> kvpResolution in dictDNSResolutions)
842844
{
843-
Hashtable htAllResolutions = new Hashtable();
844-
foreach (KeyValuePair<int, List<Hashtable>> kvpResolution in dictDNSResolutions)
845+
string sHost = String.Empty;
846+
Hashtable htData = new Hashtable();
847+
foreach (Hashtable htEvent in kvpResolution.Value)
845848
{
846-
string sHost = String.Empty;
847-
Hashtable htData = new Hashtable();
848-
foreach (Hashtable htEvent in kvpResolution.Value)
849-
{
850-
int iType = getIntValue(htEvent["type"], -1);
851-
var htParams = (Hashtable)htEvent["params"];
849+
int iType = getIntValue(htEvent["type"], -1);
850+
var htParams = (Hashtable)htEvent["params"];
852851

853-
if (iType == NetLogMagics.HOST_RESOLVER_IMPL_JOB)
854-
{
855-
sHost = (htParams["host"] as String) ?? "(missing)";
856-
continue;
857-
}
858-
if (iType == NetLogMagics.HOST_RESOLVER_IMPL_PROC_TASK)
852+
// TODO: HOST_RESOLVER_IMPL_JOB_REQUEST_ATTACH has a list of all of the sslconnectjobs
853+
// that attached to this resolution looking for an address to use.
854+
855+
if (iType == NetLogMagics.HOST_RESOLVER_IMPL_JOB)
856+
{
857+
sHost = (htParams["host"] as String) ?? "(missing)";
858+
continue;
859+
}
860+
if (iType == NetLogMagics.HOST_RESOLVER_IMPL_PROC_TASK)
861+
{
862+
// TODO: What if there's more than one?
863+
if (htParams.ContainsKey("canonical_name") && ((htParams["canonical_name"] as String) == String.Empty))
859864
{
860-
htData = htParams;
861-
continue;
865+
htParams.Remove("canonical_name");
862866
}
863-
867+
htData = htParams;
868+
continue;
864869
}
865-
htAllResolutions.Add(sHost, htData);
866870

867871
}
868-
_listSessions.Add(Session.BuildFromData(false,
872+
htAllResolutions.Add(sHost, htData);
873+
}
874+
875+
_listSessions.Add(Session.BuildFromData(false,
869876
new HTTPRequestHeaders(
870877
String.Format("/DNS_LOOKUPS"), // TODO: Add Machine name?
871878
new[] { "Host: NETLOG" }),
872879
Utilities.emptyByteArray,
873880
new HTTPResponseHeaders(200, "Analyzed Data", new[] { "Content-Type: application/json; charset=utf-8" }),
874881
Encoding.UTF8.GetBytes(JSON.JsonEncode(htAllResolutions)),
875882
SessionFlags.ImportedFromOtherTool | SessionFlags.RequestGeneratedByFiddler | SessionFlags.ResponseGeneratedByFiddler | SessionFlags.ServedFromCache));
876-
}
877883
}
878884
catch (Exception e) { FiddlerApplication.Log.LogFormat("GenerateDNSResolutionListSession failed: " + DescribeExceptionWithStack(e)); }
879885
}

FiddlerImportNetlog/Properties/AssemblyInfo.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
[assembly: AssemblyCopyright("Copyright ©2021 Eric Lawrence")]
77
[assembly: System.Resources.NeutralResourcesLanguage("en-US")]
88
[assembly: ComVisible(false)]
9-
[assembly: AssemblyVersion("1.3.2.1")] // ALWAYS UPDATE THE VERSION in the [ProfferFormat] attribute in FiddlerInterface.cs to match!
9+
[assembly: AssemblyVersion("1.3.2.2")] // ALWAYS UPDATE THE VERSION in the [ProfferFormat] attribute in FiddlerInterface.cs to match!
1010
[assembly: Fiddler.RequiredVersion("4.6.0.0")]
1111

1212

@@ -20,6 +20,9 @@ HTTP_STREAM_JOB has a binding between the request and the socket. Hook them up s
2020
--> source_dependency = 1701 (URL_REQUEST)
2121
*/
2222

23+
// v1.3.2.2
24+
// Add ".json;.gz" hint to ProfferFormat registration
25+
2326
// v1.3.2.1
2427
// Add DNS entries to log
2528
// Add READ_EARLY_HINTS_RESPONSE_HEADERS - _X-NetLog-Found-Early-Hint - https://www.fastly.com/blog/beyond-server-push-experimenting-with-the-103-early-hints-status-code

0 commit comments

Comments
 (0)