20,6 → 20,7 |
// - do not store intermediate info, just row packets and the parsed fragments to display |
// - make the text fragment store switchable |
// - set locks during log writing (?) |
// - show '100 (Continue)' response info |
namespace TCPproxy |
{ |
public class MainForm : Form |
1429,17 → 1430,17 |
string title = http.ToString(); |
if(httpData.Node.Text != title) httpData.Node.Text = title; |
|
if(!httpData.RequestXmlShown && http.RequestXml != null) |
if(!httpData.RequestXmlShown && http.Request.Xml != null) |
{ |
httpData.RequestXmlShown = true; |
AddXmlNode(httpData.Node, "Request XML", http.RequestXml); |
AddXmlNode(httpData.Node, "Request XML", http.Request.Xml); |
if(autoExpand) httpData.Node.Expand(); |
} |
|
if(!httpData.ResponseXmlShown && http.ResponseXml != null) |
if(!httpData.ResponseXmlShown && http.Response.Xml != null) |
{ |
httpData.ResponseXmlShown = true; |
AddXmlNode(httpData.Node, "Response XML", http.ResponseXml); |
AddXmlNode(httpData.Node, "Response XML", http.Response.Xml); |
if(autoExpand) httpData.Node.Expand(); |
} |
|
1758,34 → 1759,30 |
|
private class HttpNodeData : TreeNodeData |
{ |
private class MarkerSet |
{ |
public object start; |
public object method; |
public object uri; |
public object version; |
public object status; |
public object transferEncoding; |
public object length; |
public object contentEncoding; |
public object contentType; |
public object charset; |
public object headers; |
public object body; |
public IEnumerator headersEnum; |
} |
|
private HttpMessage http; |
private bool requestXmlShown = false; |
private bool responseXmlShown = false; |
|
private object stateMarker = null; |
private object requestStartMarker = null; |
private object requestMethodMarker = null; |
private object requestUriMarker = null; |
private object requestVersionMarker = null; |
private object requestTransferEncodingMarker = null; |
private object requestLengthMarker = null; |
private object requestContentEncodingMarker = null; |
private object requestContentTypeMarker = null; |
private object requestCharsetMarker = null; |
private object requestHeadersMarker = null; |
private object responseStartMarker = null; |
private object responseVersionMarker = null; |
private object responseStatusMarker = null; |
private object responseTransferEncodingMarker = null; |
private object responseLengthMarker = null; |
private object responseContentEncodingMarker = null; |
private object responseContentTypeMarker = null; |
private object responseCharsetMarker = null; |
private object responseHeadersMarker = null; |
private object requestBodyMarker = null; |
private object responseBodyMarker = null; |
private IEnumerator requestHeadersEnum = null; |
private IEnumerator responseHeadersEnum = null; |
private MarkerSet requestMarkers = new MarkerSet(); |
private MarkerSet responseMarkers = new MarkerSet(); |
|
public HttpMessage Http |
{ |
1836,196 → 1833,185 |
} |
} |
|
protected override void InitView() |
private string VersionToString(HttpVersion version) |
{ |
try |
switch(version) |
{ |
lock(http) |
case HttpVersion.V0_9: return "HTTP/0.9"; |
case HttpVersion.V1_0: return "HTTP/1.0"; |
default: return "HTTP/1.1"; |
} |
} |
|
private void InitHttpHalfView(HttpHalfMessage half, MarkerSet markers, string title) |
{ |
owner.messagesBox.Clear(); |
string padding = ""; |
|
owner.messagesBox.AppendNewLine(); |
owner.messagesBox.AppendText("Complete: ", |
owner.messagesBox.AppendText(title + " Start: " + padding, |
Color.DarkRed, Color.Transparent, false, false, 0, 0); |
stateMarker = owner.messagesBox.BeginMark(); |
owner.messagesBox.AppendText(http.RequestComplete && http.ResponseComplete ? "YES" : "NO", |
markers.start = owner.messagesBox.BeginMark(); |
owner.messagesBox.AppendText(half.StartTimestamp == DateTime.MinValue |
? "<unknown>" : half.StartTimestamp.ToString("HH:mm:ss.ffff"), |
Color.DarkRed, Color.LightGray, false, false, 0, 27); |
owner.messagesBox.EndMark(stateMarker); |
owner.messagesBox.EndMark(markers.start); |
owner.messagesBox.AppendNewLine(); |
owner.messagesBox.AppendNewLine(); |
|
// request info |
owner.messagesBox.AppendText("Request Start: ", |
if(half.IsRequest) |
{ |
owner.messagesBox.AppendText(title + " Method: " + padding, |
Color.DarkRed, Color.Transparent, false, false, 0, 0); |
requestStartMarker = owner.messagesBox.BeginMark(); |
owner.messagesBox.AppendText(http.RequestStartTimestamp == DateTime.MinValue |
? "<unknown>" : http.RequestStartTimestamp.ToString("HH:mm:ss.ffff"), |
markers.method = owner.messagesBox.BeginMark(); |
owner.messagesBox.AppendText((half as HttpRequest).Method, |
Color.DarkRed, Color.LightGray, false, false, 0, 27); |
owner.messagesBox.EndMark(requestStartMarker); |
owner.messagesBox.EndMark(markers.method); |
owner.messagesBox.AppendNewLine(); |
|
owner.messagesBox.AppendText("Request Method: ", |
owner.messagesBox.AppendText(title + " URI: " + padding, |
Color.DarkRed, Color.Transparent, false, false, 0, 0); |
requestMethodMarker = owner.messagesBox.BeginMark(); |
owner.messagesBox.AppendText(http.RequestMethod, |
markers.uri = owner.messagesBox.BeginMark(); |
owner.messagesBox.AppendText((half as HttpRequest).Uri, |
Color.DarkRed, Color.LightGray, false, false, 0, 27); |
owner.messagesBox.EndMark(requestMethodMarker); |
owner.messagesBox.EndMark(markers.uri); |
owner.messagesBox.AppendNewLine(); |
|
owner.messagesBox.AppendText("Request URI: ", |
} |
else |
{ |
owner.messagesBox.AppendText(title + " Status: " + padding, |
Color.DarkRed, Color.Transparent, false, false, 0, 0); |
requestUriMarker = owner.messagesBox.BeginMark(); |
owner.messagesBox.AppendText(http.RequestUri, |
markers.status = owner.messagesBox.BeginMark(); |
owner.messagesBox.AppendText((half as HttpResponse).StatusCode |
+ " " + (half as HttpResponse).StatusMessage, |
Color.DarkRed, Color.LightGray, false, false, 0, 27); |
owner.messagesBox.EndMark(requestUriMarker); |
owner.messagesBox.EndMark(markers.status); |
owner.messagesBox.AppendNewLine(); |
} |
|
owner.messagesBox.AppendText("Request Version: ", |
owner.messagesBox.AppendText(title + " Version: " + padding, |
Color.DarkRed, Color.Transparent, false, false, 0, 0); |
requestVersionMarker = owner.messagesBox.BeginMark(); |
owner.messagesBox.AppendText(http.RequestVersion == HttpVersion.V0_9 ? "HTTP/0.9" |
: http.RequestVersion == HttpVersion.V1_0 ? "HTTP/1.0" : "HTTP/1.1", |
markers.version = owner.messagesBox.BeginMark(); |
owner.messagesBox.AppendText(VersionToString(half.Version), |
Color.DarkRed, Color.LightGray, false, false, 0, 27); |
owner.messagesBox.EndMark(requestVersionMarker); |
owner.messagesBox.EndMark(markers.version); |
owner.messagesBox.AppendNewLine(); |
|
owner.messagesBox.AppendText("Request Transfer Encoding: ", |
owner.messagesBox.AppendText(title + " Transfer Encoding: " + padding, |
Color.DarkRed, Color.Transparent, false, false, 0, 0); |
requestTransferEncodingMarker = owner.messagesBox.BeginMark(); |
owner.messagesBox.AppendText(EncodingToString(http.RequestTransferEncoding), |
markers.transferEncoding = owner.messagesBox.BeginMark(); |
owner.messagesBox.AppendText(EncodingToString(half.TransferEncoding), |
Color.DarkRed, Color.LightGray, false, false, 0, 27); |
owner.messagesBox.EndMark(requestTransferEncodingMarker); |
owner.messagesBox.EndMark(markers.transferEncoding); |
owner.messagesBox.AppendNewLine(); |
|
owner.messagesBox.AppendText("Request Content Length: ", |
owner.messagesBox.AppendText(title + " Content Length: " + padding, |
Color.DarkRed, Color.Transparent, false, false, 0, 0); |
requestLengthMarker = owner.messagesBox.BeginMark(); |
owner.messagesBox.AppendText(http.RequestLength < 0 ? "<unknown>" : http.RequestLength.ToString(), |
markers.length = owner.messagesBox.BeginMark(); |
owner.messagesBox.AppendText(half.Length < 0 ? "<unknown>" : half.Length.ToString(), |
Color.DarkRed, Color.LightGray, false, false, 0, 27); |
owner.messagesBox.EndMark(requestLengthMarker); |
owner.messagesBox.EndMark(markers.length); |
owner.messagesBox.AppendNewLine(); |
|
owner.messagesBox.AppendText("Request Content Encoding: ", |
owner.messagesBox.AppendText(title + " Content Encoding: " + padding, |
Color.DarkRed, Color.Transparent, false, false, 0, 0); |
requestContentEncodingMarker = owner.messagesBox.BeginMark(); |
owner.messagesBox.AppendText(EncodingToString(http.RequestContentEncoding), |
markers.contentEncoding = owner.messagesBox.BeginMark(); |
owner.messagesBox.AppendText(EncodingToString(half.ContentEncoding), |
Color.DarkRed, Color.LightGray, false, false, 0, 27); |
owner.messagesBox.EndMark(requestContentEncodingMarker); |
owner.messagesBox.EndMark(markers.contentEncoding); |
owner.messagesBox.AppendNewLine(); |
|
owner.messagesBox.AppendText("Request Content Type: ", |
owner.messagesBox.AppendText(title + " Content Type: " + padding, |
Color.DarkRed, Color.Transparent, false, false, 0, 0); |
requestContentTypeMarker = owner.messagesBox.BeginMark(); |
owner.messagesBox.AppendText(http.RequestContentType == null ? "<unknown>" |
: http.RequestContentType + "/" + http.RequestContentSubtype, |
markers.contentType = owner.messagesBox.BeginMark(); |
owner.messagesBox.AppendText(half.ContentType == null ? "<unknown>" |
: half.ContentType + "/" + half.ContentSubtype, |
Color.DarkRed, Color.LightGray, false, false, 0, 27); |
owner.messagesBox.EndMark(requestContentTypeMarker); |
owner.messagesBox.EndMark(markers.contentType); |
owner.messagesBox.AppendNewLine(); |
|
owner.messagesBox.AppendText("Request Content Charset: ", |
owner.messagesBox.AppendText(title + " Content Charset: " + padding, |
Color.DarkRed, Color.Transparent, false, false, 0, 0); |
requestCharsetMarker = owner.messagesBox.BeginMark(); |
owner.messagesBox.AppendText(http.RequestCharset == null ? "<unknown>" : http.RequestCharset, |
markers.charset = owner.messagesBox.BeginMark(); |
owner.messagesBox.AppendText(half.Charset == null ? "<unknown>" : half.Charset, |
Color.DarkRed, Color.LightGray, false, false, 0, 27); |
owner.messagesBox.EndMark(requestCharsetMarker); |
owner.messagesBox.EndMark(markers.charset); |
owner.messagesBox.AppendNewLine(); |
|
owner.messagesBox.AppendText("Request Headers:", |
owner.messagesBox.AppendText(title + " Headers:", |
Color.DarkRed, Color.Transparent, false, false, 0, 0); |
owner.messagesBox.AppendNewLine(); |
requestHeadersMarker = owner.messagesBox.BeginMark(); |
owner.messagesBox.EndMark(requestHeadersMarker); |
markers.headers = owner.messagesBox.BeginMark(); |
owner.messagesBox.EndMark(markers.headers); |
|
requestHeadersEnum = http.RequestHeaders.GetEnumerator(); |
ShowHeaders(requestHeadersEnum, requestHeadersMarker); |
markers.headersEnum = half.Headers.GetEnumerator(); |
ShowHeaders(markers.headersEnum, markers.headers); |
} |
|
// response info |
owner.messagesBox.AppendNewLine(); |
owner.messagesBox.AppendText("Response Start: ", |
Color.DarkRed, Color.Transparent, false, false, 0, 0); |
responseStartMarker = owner.messagesBox.BeginMark(); |
owner.messagesBox.AppendText(http.ResponseStartTimestamp == DateTime.MinValue |
? "<unknown>" : http.ResponseStartTimestamp.ToString("HH:mm:ss.ffff"), |
private void UpdateHttpHalfView(HttpHalfMessage half, MarkerSet markers) |
{ |
if(half.IsRequest) |
{ |
owner.messagesBox.ChangeText(markers.method, (half as HttpRequest).Method, |
Color.DarkRed, Color.LightGray, false, false, 0, 27); |
owner.messagesBox.EndMark(responseStartMarker); |
owner.messagesBox.AppendNewLine(); |
|
owner.messagesBox.AppendText("Response Version: ", |
Color.DarkRed, Color.Transparent, false, false, 0, 0); |
responseVersionMarker = owner.messagesBox.BeginMark(); |
owner.messagesBox.AppendText(http.ResponseVersion == HttpVersion.V0_9 |
? "HTTP/0.9" : http.ResponseVersion == HttpVersion.V1_0 ? "HTTP/1.0" : "HTTP/1.1", |
owner.messagesBox.ChangeText(markers.uri, (half as HttpRequest).Uri, |
Color.DarkRed, Color.LightGray, false, false, 0, 27); |
owner.messagesBox.EndMark(responseVersionMarker); |
owner.messagesBox.AppendNewLine(); |
|
owner.messagesBox.AppendText("Response Status: ", |
Color.DarkRed, Color.Transparent, false, false, 0, 0); |
responseStatusMarker = owner.messagesBox.BeginMark(); |
owner.messagesBox.AppendText(http.ResponseStatusCode + " " + http.ResponseStatusMessage, |
} |
else |
{ |
owner.messagesBox.ChangeText(markers.status, (half as HttpResponse).StatusCode + " " + (half as HttpResponse).StatusMessage, |
Color.DarkRed, Color.LightGray, false, false, 0, 27); |
owner.messagesBox.EndMark(responseStatusMarker); |
owner.messagesBox.AppendNewLine(); |
} |
|
owner.messagesBox.AppendText("Response Transfer Encoding: ", |
Color.DarkRed, Color.Transparent, false, false, 0, 0); |
responseTransferEncodingMarker = owner.messagesBox.BeginMark(); |
owner.messagesBox.AppendText(EncodingToString(http.ResponseTransferEncoding), |
owner.messagesBox.ChangeText(markers.version, VersionToString(half.Version), |
Color.DarkRed, Color.LightGray, false, false, 0, 27); |
owner.messagesBox.EndMark(responseTransferEncodingMarker); |
owner.messagesBox.AppendNewLine(); |
|
owner.messagesBox.AppendText("Response Content Length: ", |
Color.DarkRed, Color.Transparent, false, false, 0, 0); |
responseLengthMarker = owner.messagesBox.BeginMark(); |
owner.messagesBox.AppendText(http.ResponseLength < 0 ? "<unknown>" : http.ResponseLength.ToString(), |
owner.messagesBox.ChangeText(markers.transferEncoding, EncodingToString(half.TransferEncoding), |
Color.DarkRed, Color.LightGray, false, false, 0, 27); |
owner.messagesBox.EndMark(responseLengthMarker); |
owner.messagesBox.AppendNewLine(); |
|
owner.messagesBox.AppendText("Response Content Encoding: ", |
Color.DarkRed, Color.Transparent, false, false, 0, 0); |
responseContentEncodingMarker = owner.messagesBox.BeginMark(); |
owner.messagesBox.AppendText(EncodingToString(http.ResponseContentEncoding), |
owner.messagesBox.ChangeText(markers.length, half.Length < 0 |
? "<unknown>" : half.Length.ToString(), |
Color.DarkRed, Color.LightGray, false, false, 0, 27); |
owner.messagesBox.EndMark(responseContentEncodingMarker); |
owner.messagesBox.AppendNewLine(); |
owner.messagesBox.ChangeText(markers.contentEncoding, EncodingToString(half.ContentEncoding), |
Color.DarkRed, Color.LightGray, false, false, 0, 27); |
owner.messagesBox.ChangeText(markers.contentType, half.ContentType == null ? "<unknown>" |
: half.ContentType + "/" + half.ContentSubtype, |
Color.DarkRed, Color.LightGray, false, false, 0, 27); |
owner.messagesBox.ChangeText(markers.charset, half.Charset == null |
? "<unknown>" : half.Charset, |
Color.DarkRed, Color.LightGray, false, false, 0, 27); |
|
owner.messagesBox.AppendText("Response Content Type: ", |
Color.DarkRed, Color.Transparent, false, false, 0, 0); |
responseContentTypeMarker = owner.messagesBox.BeginMark(); |
owner.messagesBox.AppendText(http.ResponseContentType == null ? "<unknown>" |
: http.ResponseContentType + "/" + http.ResponseContentSubtype, |
Color.DarkRed, Color.LightGray, false, false, 0, 27); |
owner.messagesBox.EndMark(responseContentTypeMarker); |
ShowHeaders(markers.headersEnum, markers.headers); |
} |
|
protected override void InitView() |
{ |
try |
{ |
lock(http) |
{ |
owner.messagesBox.Clear(); |
|
// state |
owner.messagesBox.AppendNewLine(); |
|
owner.messagesBox.AppendText("Response Content Charset: ", |
owner.messagesBox.AppendText("Complete: ", |
Color.DarkRed, Color.Transparent, false, false, 0, 0); |
responseCharsetMarker = owner.messagesBox.BeginMark(); |
owner.messagesBox.AppendText(http.ResponseCharset == null ? "<unknown>" : http.ResponseCharset, |
stateMarker = owner.messagesBox.BeginMark(); |
owner.messagesBox.AppendText(http.Request.Complete && http.Response.Complete ? "YES" : "NO", |
Color.DarkRed, Color.LightGray, false, false, 0, 27); |
owner.messagesBox.EndMark(responseCharsetMarker); |
owner.messagesBox.EndMark(stateMarker); |
owner.messagesBox.AppendNewLine(); |
|
owner.messagesBox.AppendText("Response Headers:", |
Color.DarkRed, Color.Transparent, false, false, 0, 0); |
owner.messagesBox.AppendNewLine(); |
responseHeadersMarker = owner.messagesBox.BeginMark(); |
owner.messagesBox.EndMark(responseHeadersMarker); |
|
responseHeadersEnum = http.ResponseHeaders.GetEnumerator(); |
ShowHeaders(responseHeadersEnum, responseHeadersMarker); |
// general info |
InitHttpHalfView(http.Request, requestMarkers, "Request"); |
InitHttpHalfView(http.Response, responseMarkers, "Response"); |
|
// bodies |
owner.messagesBox.AppendNewLine(); |
requestBodyMarker = owner.messagesBox.BeginMark(); |
owner.messagesBox.EndMark(requestBodyMarker); |
ShowBody(requestBodyMarker, http.RequestBody, http.RequestLength, http.RequestText, Color.Green); |
requestMarkers.body = owner.messagesBox.BeginMark(); |
owner.messagesBox.EndMark(requestMarkers.body); |
ShowBody(requestMarkers, http.Request, Color.Green); |
|
owner.messagesBox.AppendNewLine(); |
responseBodyMarker = owner.messagesBox.BeginMark(); |
owner.messagesBox.EndMark(responseBodyMarker); |
ShowBody(responseBodyMarker, http.ResponseBody, http.ResponseLength, http.ResponseText, Color.Blue); |
responseMarkers.body = owner.messagesBox.BeginMark(); |
owner.messagesBox.EndMark(responseMarkers.body); |
ShowBody(responseMarkers, http.Response, Color.Blue); |
} |
} |
finally |
2042,56 → 2028,19 |
|
lock(http) |
{ |
owner.messagesBox.ChangeText(stateMarker, http.RequestComplete && http.ResponseComplete ? "YES" : "NO", |
// state |
owner.messagesBox.ChangeText(stateMarker, http.Request.Complete && http.Response.Complete ? "YES" : "NO", |
Color.DarkRed, Color.LightGray, false, false, 0, 27); |
owner.messagesBox.ChangeText(requestMethodMarker, http.RequestMethod, |
Color.DarkRed, Color.LightGray, false, false, 0, 27); |
owner.messagesBox.ChangeText(requestUriMarker, http.RequestUri, |
Color.DarkRed, Color.LightGray, false, false, 0, 27); |
owner.messagesBox.ChangeText(requestVersionMarker, http.RequestVersion == HttpVersion.V0_9 ? "HTTP/0.9" |
: http.RequestVersion == HttpVersion.V1_0 ? "HTTP/1.0" : "HTTP/1.1", |
Color.DarkRed, Color.LightGray, false, false, 0, 27); |
owner.messagesBox.ChangeText(requestTransferEncodingMarker, EncodingToString(http.RequestTransferEncoding), |
Color.DarkRed, Color.LightGray, false, false, 0, 27); |
owner.messagesBox.ChangeText(requestLengthMarker, http.RequestLength < 0 |
? "<unknown>" : http.RequestLength.ToString(), |
Color.DarkRed, Color.LightGray, false, false, 0, 27); |
owner.messagesBox.ChangeText(requestContentEncodingMarker, EncodingToString(http.RequestContentEncoding), |
Color.DarkRed, Color.LightGray, false, false, 0, 27); |
owner.messagesBox.ChangeText(requestContentTypeMarker, http.RequestContentType == null ? "<unknown>" |
: http.RequestContentType + "/" + http.RequestContentSubtype, |
Color.DarkRed, Color.LightGray, false, false, 0, 27); |
owner.messagesBox.ChangeText(requestCharsetMarker, http.RequestCharset == null |
? "<unknown>" : http.RequestCharset, |
Color.DarkRed, Color.LightGray, false, false, 0, 27); |
|
ShowHeaders(requestHeadersEnum, requestHeadersMarker); |
// general info |
UpdateHttpHalfView(http.Request, requestMarkers); |
UpdateHttpHalfView(http.Response, responseMarkers); |
|
owner.messagesBox.ChangeText(responseVersionMarker, http.ResponseVersion == HttpVersion.V0_9 |
? "HTTP/0.9" : http.ResponseVersion == HttpVersion.V1_0 ? "HTTP/1.0" : "HTTP/1.1", |
Color.DarkRed, Color.LightGray, false, false, 0, 27); |
owner.messagesBox.ChangeText(responseStatusMarker, http.ResponseStatusCode + " " + http.ResponseStatusMessage, |
Color.DarkRed, Color.LightGray, false, false, 0, 27); |
owner.messagesBox.ChangeText(responseTransferEncodingMarker, EncodingToString(http.ResponseTransferEncoding), |
Color.DarkRed, Color.LightGray, false, false, 0, 27); |
owner.messagesBox.ChangeText(responseLengthMarker, http.ResponseLength < 0 |
? "<unknown>" : http.ResponseLength.ToString(), |
Color.DarkRed, Color.LightGray, false, false, 0, 27); |
owner.messagesBox.ChangeText(responseContentEncodingMarker, EncodingToString(http.ResponseContentEncoding), |
Color.DarkRed, Color.LightGray, false, false, 0, 27); |
owner.messagesBox.ChangeText(responseContentTypeMarker, http.ResponseContentType == null ? "<unknown>" |
: http.ResponseContentType + "/" + http.ResponseContentSubtype, |
Color.DarkRed, Color.LightGray, false, false, 0, 27); |
owner.messagesBox.ChangeText(responseCharsetMarker, http.ResponseCharset == null |
? "<unknown>" : http.ResponseCharset, |
Color.DarkRed, Color.LightGray, false, false, 0, 27); |
|
ShowHeaders(responseHeadersEnum, responseHeadersMarker); |
|
owner.messagesBox.DeleteText(requestBodyMarker); |
ShowBody(requestBodyMarker, http.RequestBody, http.RequestLength, http.RequestText, Color.Green); |
owner.messagesBox.DeleteText(responseBodyMarker); |
ShowBody(responseBodyMarker, http.ResponseBody, http.ResponseLength, http.ResponseText, Color.Blue); |
// bodies |
owner.messagesBox.DeleteText(requestMarkers.body); |
ShowBody(requestMarkers, http.Request, Color.Green); |
owner.messagesBox.DeleteText(responseMarkers.body); |
ShowBody(responseMarkers, http.Response, Color.Blue); |
} |
} |
finally |
2129,24 → 2078,24 |
} |
} |
|
private void ShowBody(object marker, byte[] body, int len, string text, Color color) |
private void ShowBody(MarkerSet markers, HttpHalfMessage half, Color color) |
{ |
if(text != null) |
if(half.Text != null) |
{ |
ArrayList lines = Utils.SplitLine(text); |
ArrayList lines = Utils.SplitLine(half.Text); |
for(int i = 0; i < lines.Count; i++) |
{ |
owner.messagesBox.InsertText(marker, (string)lines[i], color, Color.LightGray, false, false, 0, 0); |
owner.messagesBox.InsertNewLine(marker); |
owner.messagesBox.InsertText(markers.body, (string)lines[i], color, Color.LightGray, false, false, 0, 0); |
owner.messagesBox.InsertNewLine(markers.body); |
} |
} |
else if(body != null) |
else if(half.Body != null) |
{ |
ArrayList lines = Utils.SplitLine(Utils.BytesToString(body, len)); |
ArrayList lines = Utils.SplitLine(Utils.BytesToString(half.Body, half.Length)); |
for(int i = 0; i < lines.Count; i++) |
{ |
owner.messagesBox.InsertText(marker, (string)lines[i], color, Color.LightGray, false, false, 0, 0); |
owner.messagesBox.InsertNewLine(marker); |
owner.messagesBox.InsertText(markers.body, (string)lines[i], color, Color.LightGray, false, false, 0, 0); |
owner.messagesBox.InsertNewLine(markers.body); |
} |
} |
} |
2155,20 → 2104,20 |
{ |
// request info |
writer.WriteLine( |
"Complete: " + (http.RequestComplete && http.ResponseComplete ? "YES" : "NO") + "\r\n" |
+ "\r\nRequest Method: " + http.RequestMethod |
+ "\r\nRequest URI: " + http.RequestUri |
+ "\r\nRequest Version: " + (http.RequestVersion == HttpVersion.V0_9 ? "HTTP/0.9" |
: http.RequestVersion == HttpVersion.V1_0 ? "HTTP/1.0" : "HTTP/1.1") |
+ "\r\nRequest Transfer Encoding: " + EncodingToString(http.RequestTransferEncoding) |
+ "\r\nRequest Content Length: " + (http.RequestLength < 0 ? "<unknown>" : http.RequestLength.ToString()) |
+ "\r\nRequest Content Encoding: " + EncodingToString(http.RequestContentEncoding) |
+ "\r\nRequest Content Type: " + (http.RequestContentType == null ? "<unknown>" |
: http.RequestContentType + "/" + http.RequestContentSubtype) |
+ "\r\nRequest Content Charset: " + (http.RequestCharset == null ? "<unknown>" : http.RequestCharset) |
"Complete: " + (http.Request.Complete && http.Response.Complete ? "YES" : "NO") + "\r\n" |
+ "\r\nRequest Method: " + http.Request.Method |
+ "\r\nRequest URI: " + http.Request.Uri |
+ "\r\nRequest Version: " + (http.Request.Version == HttpVersion.V0_9 ? "HTTP/0.9" |
: http.Request.Version == HttpVersion.V1_0 ? "HTTP/1.0" : "HTTP/1.1") |
+ "\r\nRequest Transfer Encoding: " + EncodingToString(http.Request.TransferEncoding) |
+ "\r\nRequest Content Length: " + (http.Request.Length < 0 ? "<unknown>" : http.Request.Length.ToString()) |
+ "\r\nRequest Content Encoding: " + EncodingToString(http.Request.ContentEncoding) |
+ "\r\nRequest Content Type: " + (http.Request.ContentType == null ? "<unknown>" |
: http.Request.ContentType + "/" + http.Request.ContentSubtype) |
+ "\r\nRequest Content Charset: " + (http.Request.Charset == null ? "<unknown>" : http.Request.Charset) |
+ "\r\nRequest Headers:"); |
|
foreach(HttpHeader h in http.RequestHeaders) |
foreach(HttpHeader h in http.Request.Headers) |
{ |
int indent = 0; |
foreach(string val in h.Values) |
2187,19 → 2136,19 |
|
// response info |
writer.WriteLine( |
"\r\nResponse Version: " + (http.ResponseVersion == HttpVersion.V0_9 |
? "HTTP/0.9" : http.ResponseVersion == HttpVersion.V1_0 ? "HTTP/1.0" : "HTTP/1.1") |
+ "\r\nResponse Status: " + http.ResponseStatusCode + " " + http.ResponseStatusMessage |
+ "\r\nResponse Transfer Encoding: " + EncodingToString(http.ResponseTransferEncoding) |
+ "\r\nResponse Content Length: " + (http.ResponseLength < 0 |
? "<unknown>" : http.ResponseLength.ToString()) |
+ "\r\nResponse Content Encoding: " + EncodingToString(http.ResponseContentEncoding) |
+ "\r\nResponse Content Type: " + (http.ResponseContentType == null ? "<unknown>" |
: http.ResponseContentType + "/" + http.ResponseContentSubtype) |
+ "\r\nResponse Content Charset: " + (http.ResponseCharset == null ? "<unknown>" : http.ResponseCharset) |
"\r\nResponse Version: " + (http.Response.Version == HttpVersion.V0_9 |
? "HTTP/0.9" : http.Response.Version == HttpVersion.V1_0 ? "HTTP/1.0" : "HTTP/1.1") |
+ "\r\nResponse Status: " + http.Response.StatusCode + " " + http.Response.StatusMessage |
+ "\r\nResponse Transfer Encoding: " + EncodingToString(http.Response.TransferEncoding) |
+ "\r\nResponse Content Length: " + (http.Response.Length < 0 |
? "<unknown>" : http.Response.Length.ToString()) |
+ "\r\nResponse Content Encoding: " + EncodingToString(http.Response.ContentEncoding) |
+ "\r\nResponse Content Type: " + (http.Response.ContentType == null ? "<unknown>" |
: http.Response.ContentType + "/" + http.Response.ContentSubtype) |
+ "\r\nResponse Content Charset: " + (http.Response.Charset == null ? "<unknown>" : http.Response.Charset) |
+ "\r\nResponse Headers:"); |
|
foreach(HttpHeader h in http.ResponseHeaders) |
foreach(HttpHeader h in http.Response.Headers) |
{ |
int indent = 0; |
foreach(string val in h.Values) |
2218,23 → 2167,23 |
writer.WriteLine(); |
|
// request body |
if(http.RequestText != null) |
if(http.Request.Text != null) |
{ |
writer.WriteLine(http.RequestText); |
writer.WriteLine(http.Request.Text); |
} |
else if(http.RequestBody != null) |
else if(http.Request.Body != null) |
{ |
writer.WriteLine(Utils.BytesToString(http.RequestBody, http.RequestLength)); |
writer.WriteLine(Utils.BytesToString(http.Request.Body, http.Request.Length)); |
} |
|
// response body |
if(http.ResponseText != null) |
if(http.Response.Text != null) |
{ |
writer.WriteLine(http.ResponseText); |
writer.WriteLine(http.Response.Text); |
} |
else if(http.ResponseBody != null) |
else if(http.Response.Body != null) |
{ |
writer.WriteLine(Utils.BytesToString(http.ResponseBody, http.ResponseLength)); |
writer.WriteLine(Utils.BytesToString(http.Response.Body, http.Response.Length)); |
} |
|
writer.WriteLine("==============================================================="); |