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
bb960354
Commit
bb960354
authored
Aug 27, 2010
by
Brickner_cp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
HTTP
parent
40180aa4
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
26 additions
and
74 deletions
+26
-74
HttpTests.cs
PcapDotNet/src/PcapDotNet.Packets.Test/HttpTests.cs
+14
-10
ByteExtensions.cs
PcapDotNet/src/PcapDotNet.Packets/Http/ByteExtensions.cs
+12
-12
HttpParser.cs
PcapDotNet/src/PcapDotNet.Packets/Http/HttpParser.cs
+0
-52
No files found.
PcapDotNet/src/PcapDotNet.Packets.Test/HttpTests.cs
View file @
bb960354
...
...
@@ -155,22 +155,22 @@ namespace PcapDotNet.Packets.Test
"\r\n"
+
"5\r\n"
+
"This \r\n"
+
"3\r\n"
+
"3
;Extension
\r\n"
+
"is \r\n"
+
"
4
\r\n"
+
"the \r\n"
+
"
4
\r\n"
+
"body\r\n"
+
"
a;Extension=Value
\r\n"
+
"the
123456
\r\n"
+
"
A;Extension=\"Quoted \\\" Value\"
\r\n"
+
"body
12345
\r\n"
+
"0\r\n"
,
HttpVersion
.
Version11
,
200
,
"OK"
,
new
HttpHeader
(
new
HttpTransferEncodingField
(
"chunked"
)),
"5\r\n"
+
"This \r\n"
+
"3\r\n"
+
"3
;Extension
\r\n"
+
"is \r\n"
+
"
4
\r\n"
+
"the \r\n"
+
"
4
\r\n"
+
"body\r\n"
+
"
a;Extension=Value
\r\n"
+
"the
123456
\r\n"
+
"
A;Extension=\"Quoted \\\" Value\"
\r\n"
+
"body
12345
\r\n"
+
"0\r\n"
);
TestHttpResponse
(
"HTTP/1.1 200 OK\r\n"
+
...
...
@@ -227,6 +227,8 @@ namespace PcapDotNet.Packets.Test
Assert
.
IsFalse
(
http
.
IsResponse
,
"IsResponse "
+
httpString
);
Assert
.
AreEqual
(
expectedVersion
,
http
.
Version
,
"Version "
+
httpString
);
Assert
.
AreEqual
(
expectedHeader
,
http
.
Header
,
"Header "
+
httpString
);
if
(
expectedHeader
!=
null
)
Assert
.
AreEqual
(
expectedHeader
.
ToString
(),
http
.
Header
.
ToString
(),
"Header "
+
httpString
);
HttpRequestDatagram
request
=
(
HttpRequestDatagram
)
http
;
Assert
.
AreEqual
(
expectedMethod
,
request
.
Method
,
"Method "
+
httpString
);
...
...
@@ -246,6 +248,8 @@ namespace PcapDotNet.Packets.Test
Assert
.
IsTrue
(
http
.
IsResponse
,
"IsResponse "
+
httpString
);
Assert
.
AreEqual
(
expectedVersion
,
http
.
Version
,
"Version "
+
httpString
);
Assert
.
AreEqual
(
expectedHeader
,
http
.
Header
,
"Header "
+
httpString
);
if
(
expectedHeader
!=
null
)
Assert
.
IsNotNull
(
http
.
Header
.
ToString
());
HttpResponseDatagram
response
=
(
HttpResponseDatagram
)
http
;
Assert
.
AreEqual
(
expectedStatusCode
,
response
.
StatusCode
,
"StatusCode "
+
httpString
);
...
...
PcapDotNet/src/PcapDotNet.Packets/Http/ByteExtensions.cs
View file @
bb960354
...
...
@@ -11,22 +11,22 @@ namespace PcapDotNet.Packets.Http
}
// UPALPHA
public
static
bool
IsUpAlpha
(
this
byte
value
)
{
return
value
>=
AsciiBytes
.
UpperA
&&
value
<=
AsciiBytes
.
UpperZ
;
}
//
public static bool IsUpAlpha(this byte value)
//
{
//
return value >= AsciiBytes.UpperA && value <= AsciiBytes.UpperZ;
//
}
// LOALPHA
public
static
bool
IsLowerAlpha
(
this
byte
value
)
{
return
value
>=
AsciiBytes
.
LowerA
&&
value
<=
AsciiBytes
.
LowerZ
;
}
//
public static bool IsLowerAlpha(this byte value)
//
{
//
return value >= AsciiBytes.LowerA && value <= AsciiBytes.LowerZ;
//
}
// ALPHA
public
static
bool
IsAlpha
(
this
byte
value
)
{
return
value
.
IsUpAlpha
()
||
value
.
IsLowerAlpha
();
}
//
public static bool IsAlpha(this byte value)
//
{
//
return value.IsUpAlpha() || value.IsLowerAlpha();
//
}
// DIGIT
public
static
bool
IsDigit
(
this
byte
value
)
...
...
PcapDotNet/src/PcapDotNet.Packets/Http/HttpParser.cs
View file @
bb960354
...
...
@@ -297,58 +297,6 @@ namespace PcapDotNet.Packets.Http
return
this
;
}
public
HttpParser
CommaSeparated
<
T
>(
Func
<
T
>
commaSeparatedParsing
,
out
List
<
T
>
commaSeparated
)
{
commaSeparated
=
new
List
<
T
>();
bool
more
=
true
;
while
(
Success
&&
more
)
{
commaSeparated
.
Add
(
commaSeparatedParsing
());
SkipLws
();
more
=
false
;
while
(
IsNext
(
AsciiBytes
.
Comma
))
{
++
_offset
;
more
=
true
;
SkipLws
();
}
}
if
(!
Success
)
commaSeparated
=
null
;
return
this
;
}
public
HttpTransferCoding
TransferCoding
()
{
string
codingName
;
Token
(
out
codingName
);
List
<
HttpParameter
>
parameters
=
new
List
<
HttpParameter
>();
while
(
Success
&&
IsNext
(
AsciiBytes
.
Semicolon
))
{
++
_offset
;
HttpParameter
parameter
;
Parameter
(
out
parameter
);
}
return
Success
?
new
HttpTransferCoding
(
codingName
,
parameters
.
AsReadOnly
())
:
null
;
}
public
HttpParser
Parameter
(
out
HttpParameter
parameter
)
{
string
attribute
;
Token
(
out
attribute
).
Bytes
(
AsciiBytes
.
EqualsSign
);
Datagram
value
;
if
(
IsNext
(
AsciiBytes
.
DoubleQuotationMark
))
QuotedString
(
out
value
);
else
Token
(
out
value
);
parameter
=
Success
?
new
HttpParameter
(
attribute
,
value
)
:
null
;
return
this
;
}
public
HttpParser
QuotedString
(
out
Datagram
quotedString
)
{
quotedString
=
null
;
...
...
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