goffset old_offset = dest->len;
if (content_tag) {
- if (content_tag->content_offset == 0) {
+ if (content_tag->content_length == 0) {
content_tag->content_offset = old_offset;
}
}
len = p - c;
if (content_tag) {
- if (content_tag->content_offset == 0) {
+ if (content_tag->content_length == 0) {
content_tag->content_offset = dest->len;
}
!g_ascii_isspace (dest->data[dest->len - 1])) {
g_byte_array_append (dest, " ", 1);
if (content_tag) {
- content_tag->content_length ++;
+ if (content_tag->content_length == 0) {
+ /*
+ * Special case
+ * we have a space at the beginning but
+ * we have no set content_offset
+ * so we need to do it here
+ */
+ content_tag->content_offset = dest->len;
+ }
+ else {
+ content_tag->content_length++;
+ }
}
}
save_space = FALSE;
goffset old_offset = dest->len;
if (content_tag) {
- if (content_tag->content_offset == 0) {
+ if (content_tag->content_length == 0) {
content_tag->content_offset = dest->len;
}
}
len = p - c;
if (content_tag) {
- if (content_tag->content_offset == 0) {
+ if (content_tag->content_length == 0) {
content_tag->content_offset = dest->len;
}
g_byte_array_append (dest, "\r\n", 2);
if (content_tag) {
- content_tag->content_length += 2;
+ if (content_tag->content_length == 0) {
+ /*
+ * Special case
+ * we have a \r\n at the beginning but
+ * we have no set content_offset
+ * so we need to do it here
+ */
+ content_tag->content_offset = dest->len;
+ }
+ else {
+ content_tag->content_length += 2;
+ }
}
}
save_space = FALSE;
g_byte_array_append (dest, "\r\n", 2);
if (content_tag) {
- content_tag->content_length += 2;
+ if (content_tag->content_length == 0) {
+ /*
+ * Special case
+ * we have a \r\n at the beginning but
+ * we have no set content_offset
+ * so we need to get it here
+ */
+ content_tag->content_offset = dest->len;
+ }
+ else {
+ content_tag->content_length += 2;
+ }
}
}
save_space = FALSE;
struct rspamd_lua_text *t;
if (ltag) {
- if (ltag->html && ltag->tag->content_offset && ltag->tag->content_length &&
+ if (ltag->html && ltag->tag->content_length &&
ltag->html->parsed->len >= ltag->tag->content_offset + ltag->tag->content_length) {
t = lua_newuserdata (L, sizeof (*t));
rspamd_lua_setclass (L, "rspamd{text}", -1);