Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
P
Pcap-Net
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
Pcap-Net
Commits
cc0fd15f
Commit
cc0fd15f
authored
Sep 01, 2010
by
Brickner_cp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
HTTP
parent
fffd905c
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
210 additions
and
25 deletions
+210
-25
IEnumerableExtensions.cs
PcapDotNet/src/PcapDotNet.Base/IEnumerableExtensions.cs
+5
-0
WiresharkCompareTests.cs
PcapDotNet/src/PcapDotNet.Core.Test/WiresharkCompareTests.cs
+172
-4
XElementExtensions.cs
PcapDotNet/src/PcapDotNet.Core.Test/XElementExtensions.cs
+6
-1
HttpField.cs
PcapDotNet/src/PcapDotNet.Packets/Http/HttpField.cs
+8
-6
HttpHeader.cs
PcapDotNet/src/PcapDotNet.Packets/Http/HttpHeader.cs
+13
-8
HttpTransferEncodingField.cs
.../src/PcapDotNet.Packets/Http/HttpTransferEncodingField.cs
+4
-4
MoreAssert.cs
PcapDotNet/src/PcapDotNet.TestUtils/MoreAssert.cs
+2
-2
No files found.
PcapDotNet/src/PcapDotNet.Base/IEnumerableExtensions.cs
View file @
cc0fd15f
...
...
@@ -90,6 +90,11 @@ namespace PcapDotNet.Base
return
sequence
.
SequenceToString
(
separator
,
string
.
Empty
);
}
public
static
string
SequenceToString
<
T
>(
this
IEnumerable
<
T
>
sequence
,
char
separator
)
{
return
sequence
.
SequenceToString
(
separator
.
ToString
());
}
/// <summary>
/// Converts a sequence to a string by converting each element to a string.
/// </summary>
...
...
PcapDotNet/src/PcapDotNet.Core.Test/WiresharkCompareTests.cs
View file @
cc0fd15f
This diff is collapsed.
Click to expand it.
PcapDotNet/src/PcapDotNet.Core.Test/XElementExtensions.cs
View file @
cc0fd15f
...
...
@@ -47,6 +47,11 @@ namespace PcapDotNet.Core.Test
Assert
.
AreEqual
(
element
.
Name
(),
expectedName
);
}
public
static
void
AssertNoShow
(
this
XElement
element
)
{
Assert
.
IsNull
(
element
.
Attribute
(
"show"
));
}
public
static
void
AssertShow
(
this
XElement
element
,
string
expectedValue
,
string
message
=
null
)
{
Assert
.
AreEqual
(
expectedValue
,
element
.
Show
(),
message
??
element
.
Name
());
...
...
@@ -134,7 +139,7 @@ namespace PcapDotNet.Core.Test
public
static
void
AssertValue
(
this
XElement
element
,
string
expectedValue
,
string
message
=
null
)
{
Assert
.
AreEqual
(
e
lement
.
Value
(),
expectedValue
,
message
??
element
.
Name
());
Assert
.
AreEqual
(
e
xpectedValue
,
element
.
Value
()
,
message
??
element
.
Name
());
}
public
static
void
AssertValue
(
this
XElement
element
,
IEnumerable
<
byte
>
expectedValue
,
string
message
=
null
)
...
...
PcapDotNet/src/PcapDotNet.Packets/Http/HttpField.cs
View file @
cc0fd15f
...
...
@@ -73,6 +73,13 @@ namespace PcapDotNet.Packets.Http
public
string
Name
{
get
;
private
set
;
}
public
ReadOnlyCollection
<
byte
>
Value
{
get
;
private
set
;
}
public
string
ValueString
{
get
{
return
_defaultEncoding
.
GetString
(
Value
.
ToArray
());
}
}
public
virtual
bool
Equals
(
HttpField
other
)
{
...
...
@@ -86,12 +93,7 @@ namespace PcapDotNet.Packets.Http
public
override
string
ToString
()
{
return
string
.
Format
(
"{0}: {1}"
,
Name
,
ValueToString
());
}
protected
virtual
string
ValueToString
()
{
return
_defaultEncoding
.
GetString
(
Value
.
ToArray
());
return
string
.
Format
(
"{0}: {1}"
,
Name
,
ValueString
);
}
private
static
readonly
Encoding
_defaultEncoding
=
Encoding
.
GetEncoding
(
28591
);
...
...
PcapDotNet/src/PcapDotNet.Packets/Http/HttpHeader.cs
View file @
cc0fd15f
...
...
@@ -20,6 +20,11 @@ namespace PcapDotNet.Packets.Http
{
}
public
HttpField
this
[
string
fieldName
]
{
get
{
return
GetField
<
HttpField
>(
fieldName
);
}
}
public
HttpTransferEncodingField
TransferEncoding
{
get
...
...
@@ -28,14 +33,6 @@ namespace PcapDotNet.Packets.Http
}
}
private
T
GetField
<
T
>(
string
fieldName
)
where
T
:
HttpField
{
HttpField
field
;
if
(!
_fields
.
TryGetValue
(
fieldName
,
out
field
))
return
null
;
return
(
T
)
field
;
}
public
HttpContentLengthField
ContentLength
{
get
...
...
@@ -97,6 +94,14 @@ namespace PcapDotNet.Packets.Http
_fields
=
mergedFields
.
ToDictionary
(
field
=>
field
.
Key
,
field
=>
HttpField
.
CreateField
(
field
.
Key
,
field
.
Value
.
ToArray
()),
StringComparer
.
InvariantCultureIgnoreCase
);
}
private
T
GetField
<
T
>(
string
fieldName
)
where
T
:
HttpField
{
HttpField
field
;
if
(!
_fields
.
TryGetValue
(
fieldName
,
out
field
))
return
null
;
return
(
T
)
field
;
}
private
static
readonly
HttpHeader
_empty
=
new
HttpHeader
();
private
readonly
Dictionary
<
string
,
HttpField
>
_fields
=
new
Dictionary
<
string
,
HttpField
>(
StringComparer
.
InvariantCultureIgnoreCase
);
}
...
...
PcapDotNet/src/PcapDotNet.Packets/Http/HttpTransferEncodingField.cs
View file @
cc0fd15f
...
...
@@ -59,10 +59,10 @@ namespace PcapDotNet.Packets.Http
SetTransferCodings
(
match
.
GroupCapturesValues
(
RegexTransferCodingGroupName
).
ToArray
());
}
protected
override
string
ValueToString
()
{
return
TransferCodings
==
null
?
string
.
Empty
:
TransferCodings
.
SequenceToString
(
","
);
}
//
protected override string ValueToString()
//
{
//
return TransferCodings == null ? string.Empty : TransferCodings.SequenceToString(",");
//
}
private
ReadOnlyCollection
<
string
>
_transferCodings
;
...
...
PcapDotNet/src/PcapDotNet.TestUtils/MoreAssert.cs
View file @
cc0fd15f
...
...
@@ -29,9 +29,9 @@ namespace PcapDotNet.TestUtils
"> Actual: <"
+
actual
+
">. "
+
message
);
}
public
static
void
IsBiggerOrEqual
<
T
>(
T
expectedM
ax
imum
,
T
actual
)
where
T
:
IComparable
<
T
>
public
static
void
IsBiggerOrEqual
<
T
>(
T
expectedM
in
imum
,
T
actual
)
where
T
:
IComparable
<
T
>
{
IsBiggerOrEqual
(
expectedM
ax
imum
,
actual
,
string
.
Empty
);
IsBiggerOrEqual
(
expectedM
in
imum
,
actual
,
string
.
Empty
);
}
public
static
void
IsSmallerOrEqual
<
T
>(
T
expectedMaximum
,
T
actual
,
string
message
)
where
T
:
IComparable
<
T
>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment