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
9dc319a6
Commit
9dc319a6
authored
Sep 09, 2010
by
Brickner_cp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
HTTP
parent
f7b62ff8
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
21 additions
and
53 deletions
+21
-53
WiresharkCompareTests.cs
PcapDotNet/src/PcapDotNet.Core.Test/WiresharkCompareTests.cs
+1
-1
HttpTests.cs
PcapDotNet/src/PcapDotNet.Packets.Test/HttpTests.cs
+2
-0
HttpContentTypeField.cs
...otNet/src/PcapDotNet.Packets/Http/HttpContentTypeField.cs
+8
-7
HttpField.cs
PcapDotNet/src/PcapDotNet.Packets/Http/HttpField.cs
+0
-25
HttpRegex.cs
PcapDotNet/src/PcapDotNet.Packets/Http/HttpRegex.cs
+4
-9
HttpTransferEncodingField.cs
.../src/PcapDotNet.Packets/Http/HttpTransferEncodingField.cs
+6
-11
No files found.
PcapDotNet/src/PcapDotNet.Core.Test/WiresharkCompareTests.cs
View file @
9dc319a6
...
...
@@ -68,7 +68,7 @@ namespace PcapDotNet.Core.Test
[
TestMethod
]
public
void
ComparePacketsToWiresharkTest
()
{
for
(
int
i
=
0
;
i
!=
10
0
;
++
i
)
for
(
int
i
=
0
;
i
!=
10
;
++
i
)
{
// Create packets
List
<
Packet
>
packets
=
new
List
<
Packet
>(
CreateRandomPackets
(
200
));
...
...
PcapDotNet/src/PcapDotNet.Packets.Test/HttpTests.cs
View file @
9dc319a6
...
...
@@ -74,6 +74,8 @@ namespace PcapDotNet.Packets.Test
HttpRequestLayer
httpRequestLayer
=
(
HttpRequestLayer
)
httpLayer
;
HttpRequestDatagram
httpRequestDatagram
=
(
HttpRequestDatagram
)
httpDatagram
;
Assert
.
AreEqual
(
httpRequestLayer
.
Method
,
httpRequestDatagram
.
Method
);
if
(
httpRequestLayer
.
Method
!=
null
)
Assert
.
AreEqual
(
httpRequestLayer
.
Method
.
KnownMethod
,
httpRequestDatagram
.
Method
.
KnownMethod
);
Assert
.
AreEqual
(
httpRequestLayer
.
Uri
,
httpRequestDatagram
.
Uri
);
}
else
...
...
PcapDotNet/src/PcapDotNet.Packets/Http/HttpContentTypeField.cs
View file @
9dc319a6
...
...
@@ -42,14 +42,15 @@ namespace PcapDotNet.Packets.Http
string
fieldValueString
=
HttpRegex
.
GetString
(
fieldValue
);
Match
match
=
_regex
.
Match
(
fieldValueString
);
if
(!
match
.
Success
)
{
while
(!
match
.
Success
&&
fieldValueString
.
Length
>
0
)
{
fieldValueString
=
fieldValueString
.
Substring
(
0
,
fieldValueString
.
Length
-
1
);
match
=
_regex
.
Match
(
fieldValueString
);
}
return
;
}
// {
// while (!match.Success && fieldValueString.Length > 0)
// {
// fieldValueString = fieldValueString.Substring(0, fieldValueString.Length - 1);
// match = _regex.Match(fieldValueString);
// }
// return;
// }
MediaType
=
match
.
Groups
[
MediaTypeGroupName
].
Captures
.
Cast
<
Capture
>().
First
().
Value
;
MediaSubType
=
match
.
Groups
[
MediaSubTypeGroupName
].
Captures
.
Cast
<
Capture
>().
First
().
Value
;
...
...
PcapDotNet/src/PcapDotNet.Packets/Http/HttpField.cs
View file @
9dc319a6
...
...
@@ -74,11 +74,6 @@ namespace PcapDotNet.Packets.Http
return
stringBuilder
.
ToString
();
}
public
HttpField
(
string
name
,
IEnumerable
<
byte
>
value
)
:
this
(
name
,
value
.
ToArray
())
{
}
public
HttpField
(
string
name
,
IList
<
byte
>
value
)
:
this
(
name
,
value
.
AsReadOnly
())
{
...
...
@@ -89,26 +84,6 @@ namespace PcapDotNet.Packets.Http
Name
=
name
;
Value
=
value
;
}
// public static HttpField Create(string name, byte[] value)
// {
// switch (name)
// {
// general-header
// case "Cache-Control":
// return new HttpCommaSeparatedField(name, value);
// case "Connection":
// case "Date":
// case "Pragma":
// case "Trailer":
// case "Transfer-Encoding":
// case "Upgrade":
// case "Via":
// case "Warning":
// break;
// }
//
// return new HttpField(name);
// }
public
string
Name
{
get
;
private
set
;
}
public
ReadOnlyCollection
<
byte
>
Value
{
get
;
private
set
;
}
...
...
PcapDotNet/src/PcapDotNet.Packets/Http/HttpRegex.cs
View file @
9dc319a6
...
...
@@ -44,10 +44,10 @@ namespace PcapDotNet.Packets.Http
return
GetString
(
buffer
,
0
,
buffer
.
Length
);
}
public
static
byte
[]
GetBytes
(
string
pattern
)
{
return
_encoding
.
GetBytes
(
pattern
);
}
//
public static byte[] GetBytes(string pattern)
//
{
//
return _encoding.GetBytes(pattern);
//
}
public
static
Regex
Build
(
string
pattern
)
{
...
...
@@ -106,11 +106,6 @@ namespace PcapDotNet.Packets.Http
return
Build
(
string
.
Format
(
"(?<{0}>{1})"
,
captureName
,
regex
));
}
public
static
Regex
MatchStart
(
Regex
regex
)
{
return
Build
(
string
.
Format
(
"^{0}"
,
regex
));
}
public
static
Regex
MatchEntire
(
Regex
regex
)
{
return
Build
(
string
.
Format
(
"^{0}$"
,
regex
));
...
...
PcapDotNet/src/PcapDotNet.Packets/Http/HttpTransferEncodingField.cs
View file @
9dc319a6
...
...
@@ -25,7 +25,6 @@ namespace PcapDotNet.Packets.Http
{
}
public
bool
Equals
(
HttpTransferEncodingField
other
)
{
return
other
!=
null
&&
...
...
@@ -51,21 +50,17 @@ namespace PcapDotNet.Packets.Http
internal
HttpTransferEncodingField
(
byte
[]
fieldValue
)
:
base
(
Name
,
fieldValue
)
{
// string str = "\"h2ÇõX{âDv¼¯Ñ)ËX?´ÈÔ\"";
// string str = "\"h2ÇõX{âDv¼¯Ñ)\"";
// Match tmpMatch = HttpRegex.QuotedString.Match(str);
// Console.WriteLine(tmpMatch.Success);
string
fieldValueString
=
HttpRegex
.
GetString
(
fieldValue
);
Match
match
=
_regex
.
Match
(
fieldValueString
);
if
(!
match
.
Success
)
{
while
(!
match
.
Success
&&
fieldValueString
.
Length
>
0
)
{
fieldValueString
=
fieldValueString
.
Substring
(
0
,
fieldValueString
.
Length
-
1
);
match
=
_regex
.
Match
(
fieldValueString
);
}
return
;
// while (!match.Success && fieldValueString.Length > 0)
// {
// fieldValueString = fieldValueString.Substring(0, fieldValueString.Length - 1);
// match = _regex.Match(fieldValueString);
// }
// return;
}
SetTransferCodings
(
match
.
GroupCapturesValues
(
RegexTransferCodingGroupName
).
ToArray
());
...
...
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