Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
ccan
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
mirror
ccan
Commits
4c5f970e
Commit
4c5f970e
authored
Sep 10, 2012
by
Rusty Russell
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of ozlabs.org:ccan
parents
87c679ff
00b26784
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
3216 additions
and
13 deletions
+3216
-13
ccan/rfc822/rfc5322.txt
ccan/rfc822/rfc5322.txt
+3195
-0
ccan/rfc822/rfc822.c
ccan/rfc822/rfc822.c
+14
-10
ccan/rfc822/test/run-hdr-and-body.c
ccan/rfc822/test/run-hdr-and-body.c
+1
-1
ccan/rfc822/test/run-unfold.c
ccan/rfc822/test/run-unfold.c
+1
-1
ccan/rfc822/test/testdata.h
ccan/rfc822/test/testdata.h
+5
-1
No files found.
ccan/rfc822/rfc5322.txt
0 → 100644
View file @
4c5f970e
This source diff could not be displayed because it is too large. You can
view the blob
instead.
ccan/rfc822/rfc822.c
View file @
4c5f970e
...
...
@@ -150,29 +150,33 @@ static struct rfc822_header *next_header_parse(struct rfc822_msg *msg)
if
(
msg
->
body
&&
(
msg
->
remainder
>=
msg
->
body
))
return
NULL
;
eh
=
h
=
msg
->
remainder
;
do
{
eh
=
next_line
(
eh
,
msg
->
end
);
}
while
((
eh
<
msg
->
end
)
&&
rfc822_iswsp
(
*
eh
));
if
(
eh
>=
msg
->
end
)
msg
->
remainder
=
NULL
;
else
msg
->
remainder
=
eh
;
h
=
msg
->
remainder
;
eh
=
next_line
(
h
,
msg
->
end
);
ev
=
eh
;
if
((
ev
>
h
)
&&
(
ev
[
-
1
]
==
'\n'
))
ev
--
;
if
((
ev
>
h
)
&&
(
ev
[
-
1
]
==
'\r'
))
ev
--
;
if
(
ev
==
h
)
{
/* Found the end of the headers */
assert
(
!
msg
->
body
||
(
msg
->
body
==
eh
));
if
(
eh
<
msg
->
end
)
msg
->
body
=
eh
;
return
NULL
;
}
while
((
eh
<
msg
->
end
)
&&
rfc822_iswsp
(
*
eh
))
eh
=
next_line
(
eh
,
msg
->
end
);
if
(
eh
>=
msg
->
end
)
msg
->
remainder
=
NULL
;
else
msg
->
remainder
=
eh
;
hi
=
talloc_zero
(
msg
,
struct
rfc822_header
);
ALLOC_CHECK
(
hi
,
NULL
);
...
...
ccan/rfc822/test/run-hdr-and-body.c
View file @
4c5f970e
...
...
@@ -45,7 +45,7 @@ static void check_header(struct rfc822_msg *msg,
allocation_failure_check
();
ok
(
hname
.
ptr
&&
bytestring_eq
(
hname
,
bytestring_from_string
(
name
)),
"Header name
\"
%.*s
\"
"
,
hname
.
len
,
hname
.
ptr
);
"Header name
\"
%.*s
\"
"
,
(
int
)
hname
.
len
,
hname
.
ptr
);
hvalue
=
rfc822_header_raw_value
(
msg
,
h
);
allocation_failure_check
();
...
...
ccan/rfc822/test/run-unfold.c
View file @
4c5f970e
...
...
@@ -89,7 +89,7 @@ static void check_folded_header(const char *buf, size_t len)
hunfold
=
rfc822_header_unfolded_value
(
msg
,
hdr
);
allocation_failure_check
();
ok
(
hunfold
.
len
==
strlen
(
UNFOLDED
),
"Unfolded length %
d, should be %
d"
,
ok
(
hunfold
.
len
==
strlen
(
UNFOLDED
),
"Unfolded length %
zd, should be %z
d"
,
hunfold
.
len
,
strlen
(
UNFOLDED
));
ok1
(
memcmp
(
hunfold
.
ptr
,
UNFOLDED
,
hunfold
.
len
)
==
0
);
...
...
ccan/rfc822/test/testdata.h
View file @
4c5f970e
...
...
@@ -53,11 +53,15 @@ AEXAMPLE(test_msg_nlnl_crlf);
const
char
test_msg_nlnl_mixed_body
[]
=
"Message containing both
\n\n
and
\r\n\r\n
inside body
\n\r\n
"
;
AEXAMPLE
(
test_msg_nlnl_mixed
);
#define test_msg_space_body_hdrs test_msg_1_hdrs
const
char
test_msg_space_body_body
[]
=
" Message with LWS at start of body
\n
"
;
AEXAMPLE
(
test_msg_space_body
);
#define for_each_aexample(_e) \
foreach_ptr((_e), &test_msg_1, &test_msg_empty_body, \
&test_msg_nlnl_lf, &test_msg_nlnl_crlf, \
&test_msg_nlnl_mixed)
&test_msg_nlnl_mixed, \
&test_msg_space_body)
#define for_each_aexample_buf(_e, _buf, _len) \
for_each_aexample((_e)) \
...
...
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