From df057edf09f242a45f5e38e0e2678c4e914725bf Mon Sep 17 00:00:00 2001 From: Cameron Little Date: Wed, 14 Jan 2026 16:18:34 -0700 Subject: [PATCH] Fix broken receive header date parsing when tab is used in long header syntax (#130) * Add example tests for broken received parsing in shapelib email This comes from http://lists.maptools.org/pipermail/shapelib.mbox/shapelib.mbox, where several of the emails received headers are incorrectly parsed. The bad parsing looks like this: Original header value: ``` from [217.146.183.184] by nm2.bullet.mail.ukl.yahoo.com with NNFMP; 09 Mar 2011 11:19:46 -0000 ``` ```json "date": { "year": 1911, "month": 219, "day": 3, "hour": 19, "minute": 46, "second": 0, "tz_before_gmt": true, "tz_hour": 0, "tz_minute": 0 } ``` Where the year should be 2011 and the month 3. Weirdly, this reproduces in full message parsing, but not in the individual `received.json` tests. This looks like it's similar to https://learn.microsoft.com/en-us/answers/questions/2737324/windows-live-mail-has-received-date-set-well-into * Fix * Add test case from https://github.com/stalwartlabs/mail-parser/issues/81 --- resources/eml/thirdparty/014.crlf.json | 633 +++++++++++++++++++++++++ resources/eml/thirdparty/014.eml | 68 +++ resources/eml/thirdparty/014.json | 633 +++++++++++++++++++++++++ resources/received.json | 160 ++++++- src/parsers/fields/received.rs | 2 +- 5 files changed, 1494 insertions(+), 2 deletions(-) create mode 100644 resources/eml/thirdparty/014.crlf.json create mode 100644 resources/eml/thirdparty/014.eml create mode 100644 resources/eml/thirdparty/014.json diff --git a/resources/eml/thirdparty/014.crlf.json b/resources/eml/thirdparty/014.crlf.json new file mode 100644 index 0000000..94e27d6 --- /dev/null +++ b/resources/eml/thirdparty/014.crlf.json @@ -0,0 +1,633 @@ +{ + "html_body": [ + 2 + ], + "text_body": [ + 1 + ], + "attachments": [], + "parts": [ + { + "headers": [ + { + "name": "return_path", + "value": { + "Text": "calpas2007@yahoo.fr" + }, + "offset_field": 0, + "offset_start": 12, + "offset_end": 36 + }, + { + "name": "message_id", + "value": { + "Text": "325993.29502.qm@web28416.mail.ukl.yahoo.com" + }, + "offset_field": 36, + "offset_start": 47, + "offset_end": 95 + }, + { + "name": "received", + "value": { + "Received": { + "from": { + "Name": "nm2-vm1.bullet.mail.ukl.yahoo.com" + }, + "from_ip": "217.146.183.227", + "from_iprev": "nm2-vm1.bullet.mail.ukl.yahoo.com", + "by": { + "Name": "lists.maptools.org" + }, + "for_": "shapelib@lists.maptools.org", + "with": "SMTP", + "tls_version": null, + "tls_cipher": null, + "id": "BC0C186A2A", + "ident": null, + "helo": null, + "helo_cmd": null, + "via": null, + "date": { + "year": 2011, + "month": 3, + "day": 9, + "hour": 6, + "minute": 19, + "second": 47, + "tz_before_gmt": true, + "tz_hour": 5, + "tz_minute": 0 + } + } + }, + "offset_field": 95, + "offset_start": 104, + "offset_end": 334 + }, + { + "name": "received", + "value": { + "Received": { + "from": { + "IpAddr": "217.146.183.184" + }, + "from_ip": null, + "from_iprev": null, + "by": { + "Name": "nm2.bullet.mail.ukl.yahoo.com" + }, + "for_": null, + "with": null, + "tls_version": null, + "tls_cipher": null, + "ident": null, + "helo": null, + "helo_cmd": null, + "via": null, + "date": { + "year": 2011, + "month": 3, + "day": 9, + "hour": 11, + "minute": 19, + "second": 46, + "tz_before_gmt": false, + "tz_hour": 0, + "tz_minute": 0 + } + } + }, + "offset_field": 334, + "offset_start": 343, + "offset_end": 442 + }, + { + "name": "received", + "value": { + "Received": { + "from": { + "IpAddr": "217.146.183.162" + }, + "from_ip": null, + "from_iprev": null, + "by": { + "Name": "tm15.bullet.mail.ukl.yahoo.com" + }, + "for_": null, + "with": null, + "tls_version": null, + "tls_cipher": null, + "ident": null, + "helo": null, + "helo_cmd": null, + "via": null, + "date": { + "year": 2011, + "month": 3, + "day": 9, + "hour": 11, + "minute": 19, + "second": 46, + "tz_before_gmt": false, + "tz_hour": 0, + "tz_minute": 0 + } + } + }, + "offset_field": 442, + "offset_start": 451, + "offset_end": 551 + }, + { + "name": "received", + "value": { + "Received": { + "from": { + "IpAddr": "127.0.0.1" + }, + "from_ip": null, + "from_iprev": null, + "by": { + "Name": "omp1003.mail.ukl.yahoo.com" + }, + "for_": null, + "with": null, + "tls_version": null, + "tls_cipher": null, + "ident": null, + "helo": null, + "helo_cmd": null, + "via": null, + "date": { + "year": 2011, + "month": 3, + "day": 9, + "hour": 11, + "minute": 19, + "second": 46, + "tz_before_gmt": false, + "tz_hour": 0, + "tz_minute": 0 + } + } + }, + "offset_field": 551, + "offset_start": 560, + "offset_end": 650 + }, + { + "name": "received", + "value": { + "Received": { + "from": null, + "from_ip": null, + "from_iprev": null, + "by": null, + "for_": null, + "with": null, + "tls_version": null, + "tls_cipher": null, + "ident": null, + "helo": null, + "helo_cmd": null, + "via": null, + "date": { + "year": 2011, + "month": 3, + "day": 9, + "hour": 11, + "minute": 19, + "second": 46, + "tz_before_gmt": false, + "tz_hour": 0, + "tz_minute": 0 + } + } + }, + "offset_field": 650, + "offset_start": 659, + "offset_end": 723 + }, + { + "name": "received", + "value": { + "Received": { + "from": { + "IpAddr": "93.48.39.139" + }, + "from_ip": null, + "from_iprev": null, + "by": { + "Name": "web28416.mail.ukl.yahoo.com" + }, + "for_": null, + "with": null, + "tls_version": null, + "tls_cipher": null, + "ident": null, + "helo": null, + "helo_cmd": null, + "via": "HTTP", + "date": { + "year": 2011, + "month": 3, + "day": 9, + "hour": 11, + "minute": 19, + "second": 45, + "tz_before_gmt": true, + "tz_hour": 0, + "tz_minute": 0 + } + } + }, + "offset_field": 723, + "offset_start": 732, + "offset_end": 827 + }, + { + "name": { + "other": "X-YMail-OSG" + }, + "value": { + "Text": "xF6vL5gVM1nJDIpUac8HXQgtzEKILWMleuWXpnKhS4zjeWk\r\n\tAzOMT9R5FsxhNIfJowfwIoeDe4kCWtluFsT5_o6NqzymePDH8x1m9dBMI_r.\r\n\tyNT1aac5Z.dK2GS8Nsuks7LrwYx0Y0SV45wWRzmK8ExyNKvPh.VzTeJQBn6T\r\n\tmEWJDI82qsbKIqLwl7PQPf79.DT_AthBEa72VUqZ5bOIjxyd9xP36T9KbbBv z8rA-" + }, + "offset_field": 827, + "offset_start": 839, + "offset_end": 1084 + }, + { + "name": { + "other": "X-Yahoo-Newman-Property" + }, + "value": { + "Text": "ymail-5" + }, + "offset_field": 1084, + "offset_start": 1108, + "offset_end": 1118 + }, + { + "name": { + "other": "X-Yahoo-Newman-Id" + }, + "value": { + "Text": "895263.62503.bm@omp1003.mail.ukl.yahoo.com" + }, + "offset_field": 1118, + "offset_start": 1136, + "offset_end": 1181 + }, + { + "name": { + "other": "X-Mailer" + }, + "value": { + "Text": "YahooMailRC/559 YahooMailWebService/0.8.109.292656" + }, + "offset_field": 1181, + "offset_start": 1190, + "offset_end": 1243 + }, + { + "name": "date", + "value": { + "DateTime": { + "year": 2011, + "month": 3, + "day": 9, + "hour": 11, + "minute": 19, + "second": 45, + "tz_before_gmt": false, + "tz_hour": 0, + "tz_minute": 0 + } + }, + "offset_field": 1243, + "offset_start": 1248, + "offset_end": 1287 + }, + { + "name": "from", + "value": { + "Address": { + "List": [ + { + "name": "calpas calpas", + "address": "calpas2007@yahoo.fr" + } + ] + } + }, + "offset_field": 1287, + "offset_start": 1292, + "offset_end": 1330 + }, + { + "name": "to", + "value": { + "Address": { + "List": [ + { + "name": null, + "address": "shapelib@lists.maptools.org" + } + ] + } + }, + "offset_field": 1330, + "offset_start": 1333, + "offset_end": 1363 + }, + { + "name": "mime_version", + "value": { + "Text": "1.0" + }, + "offset_field": 1363, + "offset_start": 1376, + "offset_end": 1382 + }, + { + "name": "content_type", + "value": { + "ContentType": { + "c_type": "multipart", + "c_subtype": "alternative", + "attributes": [ + { + "name": "boundary", + "value": "0-1188948659-1299669585=:29502" + } + ] + } + }, + "offset_field": 1382, + "offset_start": 1395, + "offset_end": 1462 + }, + { + "name": "subject", + "value": { + "Text": "[Shapelib] need some help" + }, + "offset_field": 1462, + "offset_start": 1470, + "offset_end": 1498 + }, + { + "name": { + "other": "X-BeenThere" + }, + "value": { + "Text": "shapelib@lists.maptools.org" + }, + "offset_field": 1498, + "offset_start": 1510, + "offset_end": 1540 + }, + { + "name": { + "other": "X-Mailman-Version" + }, + "value": { + "Text": "2.1.9" + }, + "offset_field": 1540, + "offset_start": 1558, + "offset_end": 1566 + }, + { + "name": { + "other": "Precedence" + }, + "value": { + "Text": "list" + }, + "offset_field": 1566, + "offset_start": 1577, + "offset_end": 1584 + }, + { + "name": "reply_to", + "value": { + "Address": { + "List": [ + { + "name": "Shapelib Development", + "address": "shapelib@lists.maptools.org" + } + ] + } + }, + "offset_field": 1584, + "offset_start": 1593, + "offset_end": 1646 + }, + { + "name": "list_id", + "value": { + "Address": { + "List": [ + { + "name": "Shapelib Development", + "address": "shapelib.lists.maptools.org" + } + ] + } + }, + "offset_field": 1646, + "offset_start": 1654, + "offset_end": 1707 + }, + { + "name": "list_unsubscribe", + "value": { + "Address": { + "List": [ + { + "name": null, + "address": "http://lists.maptools.org/mailman/listinfo/shapelib" + }, + { + "name": null, + "address": "mailto:shapelib-request@lists.maptools.org?subject=unsubscribe" + } + ] + } + }, + "offset_field": 1707, + "offset_start": 1724, + "offset_end": 1848 + }, + { + "name": "list_archive", + "value": { + "Address": { + "List": [ + { + "name": null, + "address": "http://lists.maptools.org/pipermail/shapelib" + } + ] + } + }, + "offset_field": 1848, + "offset_start": 1861, + "offset_end": 1910 + }, + { + "name": "list_post", + "value": { + "Address": { + "List": [ + { + "name": null, + "address": "mailto:shapelib@lists.maptools.org" + } + ] + } + }, + "offset_field": 1910, + "offset_start": 1920, + "offset_end": 1959 + }, + { + "name": "list_help", + "value": { + "Address": { + "List": [ + { + "name": null, + "address": "mailto:shapelib-request@lists.maptools.org?subject=help" + } + ] + } + }, + "offset_field": 1959, + "offset_start": 1969, + "offset_end": 2029 + }, + { + "name": "list_subscribe", + "value": { + "Address": { + "List": [ + { + "name": null, + "address": "http://lists.maptools.org/mailman/listinfo/shapelib" + }, + { + "name": null, + "address": "mailto:shapelib-request@lists.maptools.org?subject=subscribe" + } + ] + } + }, + "offset_field": 2029, + "offset_start": 2044, + "offset_end": 2166 + }, + { + "name": { + "other": "X-List-Received-Date" + }, + "value": { + "Text": "Wed, 09 Mar 2011 11:20:10 -0000" + }, + "offset_field": 2166, + "offset_start": 2187, + "offset_end": 2221 + } + ], + "is_encoding_problem": false, + "body": { + "Multipart": [ + 1, + 2 + ] + }, + "offset_header": 0, + "offset_body": 2223, + "offset_end": 3808 + }, + { + "headers": [ + { + "name": "content_type", + "value": { + "ContentType": { + "c_type": "text", + "c_subtype": "plain", + "attributes": [ + { + "name": "charset", + "value": "utf-8" + } + ] + } + }, + "offset_field": 2257, + "offset_start": 2270, + "offset_end": 2298 + }, + { + "name": "content_transfer_encoding", + "value": { + "Text": "quoted-printable" + }, + "offset_field": 2298, + "offset_start": 2324, + "offset_end": 2343 + } + ], + "is_encoding_problem": false, + "body": { + "Text": "Dear all,\n\nI am writting my first C application to access the shapefile and retrieve some \ndata. I'm trying to use the shapelib to achieve that unfortunately I'm keeping \non having the following errors: \n\n /home/geotema/valatest/src/readshapetest.c:19: undefined reference to \n`SHPOpen'\n /home/geotema/valatest/src/readshapetest.c:21: undefined reference to \n`SHPGetInfo'\n\nI cannot figure out what is missing. could anyone help me to sort out this \nissue???\n\nCheers\n\n\n" + }, + "offset_header": 2257, + "offset_body": 2345, + "offset_end": 2871 + }, + { + "headers": [ + { + "name": "content_type", + "value": { + "ContentType": { + "c_type": "text", + "c_subtype": "html", + "attributes": [ + { + "name": "charset", + "value": "utf-8" + } + ] + } + }, + "offset_field": 2907, + "offset_start": 2920, + "offset_end": 2947 + }, + { + "name": "content_transfer_encoding", + "value": { + "Text": "quoted-printable" + }, + "offset_field": 2947, + "offset_start": 2973, + "offset_end": 2992 + } + ], + "is_encoding_problem": false, + "body": { + "Html": "
Dear all,

I am writting my first C application to access the shapefile and retrieve some data. I'm trying to use the shapelib to achieve that unfortunately I'm keeping on having the following errors:
    /home/geotema/valatest/src/readshapetest.c:19: undefined reference to `SHPOpen'
    /home/geotema/valatest/src/readshapetest.c:21: undefined reference to `SHPGetInfo'

I cannot figure out what is missing. could anyone help me to sort out this issue???

Cheers

\n

\n\n\n\n\n " + }, + "offset_header": 2907, + "offset_body": 2994, + "offset_end": 3770 + } + ] +} \ No newline at end of file diff --git a/resources/eml/thirdparty/014.eml b/resources/eml/thirdparty/014.eml new file mode 100644 index 0000000..2a6881b --- /dev/null +++ b/resources/eml/thirdparty/014.eml @@ -0,0 +1,68 @@ +Return-Path: +Message-ID: <325993.29502.qm@web28416.mail.ukl.yahoo.com> +Received: from nm2-vm1.bullet.mail.ukl.yahoo.com + (nm2-vm1.bullet.mail.ukl.yahoo.com [217.146.183.227]) + by lists.maptools.org (Postfix) with SMTP id BC0C186A2A + for ; Wed, 9 Mar 2011 06:19:47 -0500 (EST) +Received: from [217.146.183.184] by nm2.bullet.mail.ukl.yahoo.com with NNFMP; + 09 Mar 2011 11:19:46 -0000 +Received: from [217.146.183.162] by tm15.bullet.mail.ukl.yahoo.com with NNFMP; + 09 Mar 2011 11:19:46 -0000 +Received: from [127.0.0.1] by omp1003.mail.ukl.yahoo.com with NNFMP; + 09 Mar 2011 11:19:46 -0000 +Received: (qmail 31873 invoked by uid 60001); 9 Mar 2011 11:19:46 -0000 +Received: from [93.48.39.139] by web28416.mail.ukl.yahoo.com via HTTP; + Wed, 09 Mar 2011 11:19:45 GMT +X-YMail-OSG: xF6vL5gVM1nJDIpUac8HXQgtzEKILWMleuWXpnKhS4zjeWk + AzOMT9R5FsxhNIfJowfwIoeDe4kCWtluFsT5_o6NqzymePDH8x1m9dBMI_r. + yNT1aac5Z.dK2GS8Nsuks7LrwYx0Y0SV45wWRzmK8ExyNKvPh.VzTeJQBn6T + mEWJDI82qsbKIqLwl7PQPf79.DT_AthBEa72VUqZ5bOIjxyd9xP36T9KbbBv z8rA- +X-Yahoo-Newman-Property: ymail-5 +X-Yahoo-Newman-Id: 895263.62503.bm@omp1003.mail.ukl.yahoo.com +X-Mailer: YahooMailRC/559 YahooMailWebService/0.8.109.292656 +Date: Wed, 9 Mar 2011 11:19:45 +0000 (GMT) +From: calpas calpas +To: shapelib@lists.maptools.org +MIME-Version: 1.0 +Content-Type: multipart/alternative; boundary="0-1188948659-1299669585=:29502" +Subject: [Shapelib] need some help +X-BeenThere: shapelib@lists.maptools.org +X-Mailman-Version: 2.1.9 +Precedence: list +Reply-To: Shapelib Development +List-Id: Shapelib Development +List-Unsubscribe: , + +List-Archive: +List-Post: +List-Help: +List-Subscribe: , + +X-List-Received-Date: Wed, 09 Mar 2011 11:20:10 -0000 + +--0-1188948659-1299669585=:29502 +Content-Type: text/plain; charset=utf-8 +Content-Transfer-Encoding: quoted-printable + +Dear all,=0A=0AI am writting my first C application to access the shapefile= + and retrieve some =0Adata. I'm trying to use the shapelib to achieve that = +unfortunately I'm keeping =0Aon having the following errors: =0A=0A /hom= +e/geotema/valatest/src/readshapetest.c:19: undefined reference to =0A`SHPOp= +en'=0A /home/geotema/valatest/src/readshapetest.c:21: undefined referenc= +e to =0A`SHPGetInfo'=0A=0AI cannot figure out what is missing. could anyone= + help me to sort out this =0Aissue???=0A=0ACheers=0A=0A=0A +--0-1188948659-1299669585=:29502 +Content-Type: text/html; charset=utf-8 +Content-Transfer-Encoding: quoted-printable + +
Dear all,

I am writting my first C application to = +access the shapefile and retrieve some data. I'm trying to use the shapelib= + to achieve that unfortunately I'm keeping on having the following errors: = +
    /home/geotema/valatest/src/readshapetest.c:19: undef= +ined reference to `SHPOpen'
    /home/geotema/valatest/sr= +c/readshapetest.c:21: undefined reference to `SHPGetInfo'

I cannot f= +igure out what is missing. could anyone help me to sort out this issue???
Cheers

=0A

=0A=0A=0A=0A=0A +--0-1188948659-1299669585=:29502-- diff --git a/resources/eml/thirdparty/014.json b/resources/eml/thirdparty/014.json new file mode 100644 index 0000000..b6c519f --- /dev/null +++ b/resources/eml/thirdparty/014.json @@ -0,0 +1,633 @@ +{ + "html_body": [ + 2 + ], + "text_body": [ + 1 + ], + "attachments": [], + "parts": [ + { + "headers": [ + { + "name": "return_path", + "value": { + "Text": "calpas2007@yahoo.fr" + }, + "offset_field": 0, + "offset_start": 12, + "offset_end": 35 + }, + { + "name": "message_id", + "value": { + "Text": "325993.29502.qm@web28416.mail.ukl.yahoo.com" + }, + "offset_field": 35, + "offset_start": 46, + "offset_end": 93 + }, + { + "name": "received", + "value": { + "Received": { + "from": { + "Name": "nm2-vm1.bullet.mail.ukl.yahoo.com\n" + }, + "from_ip": "217.146.183.227", + "from_iprev": "nm2-vm1.bullet.mail.ukl.yahoo.com", + "by": { + "Name": "lists.maptools.org" + }, + "for_": "shapelib@lists.maptools.org", + "with": "SMTP", + "tls_version": null, + "tls_cipher": null, + "id": "BC0C186A2A\n", + "ident": null, + "helo": null, + "helo_cmd": null, + "via": null, + "date": { + "year": 2011, + "month": 3, + "day": 9, + "hour": 6, + "minute": 19, + "second": 47, + "tz_before_gmt": true, + "tz_hour": 5, + "tz_minute": 0 + } + } + }, + "offset_field": 93, + "offset_start": 102, + "offset_end": 328 + }, + { + "name": "received", + "value": { + "Received": { + "from": { + "IpAddr": "217.146.183.184" + }, + "from_ip": null, + "from_iprev": null, + "by": { + "Name": "nm2.bullet.mail.ukl.yahoo.com" + }, + "for_": null, + "with": null, + "tls_version": null, + "tls_cipher": null, + "ident": null, + "helo": null, + "helo_cmd": null, + "via": null, + "date": { + "year": 2011, + "month": 3, + "day": 9, + "hour": 11, + "minute": 19, + "second": 46, + "tz_before_gmt": false, + "tz_hour": 0, + "tz_minute": 0 + } + } + }, + "offset_field": 328, + "offset_start": 337, + "offset_end": 434 + }, + { + "name": "received", + "value": { + "Received": { + "from": { + "IpAddr": "217.146.183.162" + }, + "from_ip": null, + "from_iprev": null, + "by": { + "Name": "tm15.bullet.mail.ukl.yahoo.com" + }, + "for_": null, + "with": null, + "tls_version": null, + "tls_cipher": null, + "ident": null, + "helo": null, + "helo_cmd": null, + "via": null, + "date": { + "year": 2011, + "month": 3, + "day": 9, + "hour": 11, + "minute": 19, + "second": 46, + "tz_before_gmt": false, + "tz_hour": 0, + "tz_minute": 0 + } + } + }, + "offset_field": 434, + "offset_start": 443, + "offset_end": 541 + }, + { + "name": "received", + "value": { + "Received": { + "from": { + "IpAddr": "127.0.0.1" + }, + "from_ip": null, + "from_iprev": null, + "by": { + "Name": "omp1003.mail.ukl.yahoo.com" + }, + "for_": null, + "with": null, + "tls_version": null, + "tls_cipher": null, + "ident": null, + "helo": null, + "helo_cmd": null, + "via": null, + "date": { + "year": 2011, + "month": 3, + "day": 9, + "hour": 11, + "minute": 19, + "second": 46, + "tz_before_gmt": false, + "tz_hour": 0, + "tz_minute": 0 + } + } + }, + "offset_field": 541, + "offset_start": 550, + "offset_end": 638 + }, + { + "name": "received", + "value": { + "Received": { + "from": null, + "from_ip": null, + "from_iprev": null, + "by": null, + "for_": null, + "with": null, + "tls_version": null, + "tls_cipher": null, + "ident": null, + "helo": null, + "helo_cmd": null, + "via": null, + "date": { + "year": 2011, + "month": 3, + "day": 9, + "hour": 11, + "minute": 19, + "second": 46, + "tz_before_gmt": false, + "tz_hour": 0, + "tz_minute": 0 + } + } + }, + "offset_field": 638, + "offset_start": 647, + "offset_end": 710 + }, + { + "name": "received", + "value": { + "Received": { + "from": { + "IpAddr": "93.48.39.139" + }, + "from_ip": null, + "from_iprev": null, + "by": { + "Name": "web28416.mail.ukl.yahoo.com" + }, + "for_": null, + "with": null, + "tls_version": null, + "tls_cipher": null, + "ident": null, + "helo": null, + "helo_cmd": null, + "via": "HTTP", + "date": { + "year": 2011, + "month": 3, + "day": 9, + "hour": 11, + "minute": 19, + "second": 45, + "tz_before_gmt": true, + "tz_hour": 0, + "tz_minute": 0 + } + } + }, + "offset_field": 710, + "offset_start": 719, + "offset_end": 812 + }, + { + "name": { + "other": "X-YMail-OSG" + }, + "value": { + "Text": "xF6vL5gVM1nJDIpUac8HXQgtzEKILWMleuWXpnKhS4zjeWk\n\tAzOMT9R5FsxhNIfJowfwIoeDe4kCWtluFsT5_o6NqzymePDH8x1m9dBMI_r.\n\tyNT1aac5Z.dK2GS8Nsuks7LrwYx0Y0SV45wWRzmK8ExyNKvPh.VzTeJQBn6T\n\tmEWJDI82qsbKIqLwl7PQPf79.DT_AthBEa72VUqZ5bOIjxyd9xP36T9KbbBv z8rA-" + }, + "offset_field": 812, + "offset_start": 824, + "offset_end": 1065 + }, + { + "name": { + "other": "X-Yahoo-Newman-Property" + }, + "value": { + "Text": "ymail-5" + }, + "offset_field": 1065, + "offset_start": 1089, + "offset_end": 1098 + }, + { + "name": { + "other": "X-Yahoo-Newman-Id" + }, + "value": { + "Text": "895263.62503.bm@omp1003.mail.ukl.yahoo.com" + }, + "offset_field": 1098, + "offset_start": 1116, + "offset_end": 1160 + }, + { + "name": { + "other": "X-Mailer" + }, + "value": { + "Text": "YahooMailRC/559 YahooMailWebService/0.8.109.292656" + }, + "offset_field": 1160, + "offset_start": 1169, + "offset_end": 1221 + }, + { + "name": "date", + "value": { + "DateTime": { + "year": 2011, + "month": 3, + "day": 9, + "hour": 11, + "minute": 19, + "second": 45, + "tz_before_gmt": false, + "tz_hour": 0, + "tz_minute": 0 + } + }, + "offset_field": 1221, + "offset_start": 1226, + "offset_end": 1264 + }, + { + "name": "from", + "value": { + "Address": { + "List": [ + { + "name": "calpas calpas", + "address": "calpas2007@yahoo.fr" + } + ] + } + }, + "offset_field": 1264, + "offset_start": 1269, + "offset_end": 1306 + }, + { + "name": "to", + "value": { + "Address": { + "List": [ + { + "name": null, + "address": "shapelib@lists.maptools.org" + } + ] + } + }, + "offset_field": 1306, + "offset_start": 1309, + "offset_end": 1338 + }, + { + "name": "mime_version", + "value": { + "Text": "1.0" + }, + "offset_field": 1338, + "offset_start": 1351, + "offset_end": 1356 + }, + { + "name": "content_type", + "value": { + "ContentType": { + "c_type": "multipart", + "c_subtype": "alternative", + "attributes": [ + { + "name": "boundary", + "value": "0-1188948659-1299669585=:29502" + } + ] + } + }, + "offset_field": 1356, + "offset_start": 1369, + "offset_end": 1435 + }, + { + "name": "subject", + "value": { + "Text": "[Shapelib] need some help" + }, + "offset_field": 1435, + "offset_start": 1443, + "offset_end": 1470 + }, + { + "name": { + "other": "X-BeenThere" + }, + "value": { + "Text": "shapelib@lists.maptools.org" + }, + "offset_field": 1470, + "offset_start": 1482, + "offset_end": 1511 + }, + { + "name": { + "other": "X-Mailman-Version" + }, + "value": { + "Text": "2.1.9" + }, + "offset_field": 1511, + "offset_start": 1529, + "offset_end": 1536 + }, + { + "name": { + "other": "Precedence" + }, + "value": { + "Text": "list" + }, + "offset_field": 1536, + "offset_start": 1547, + "offset_end": 1553 + }, + { + "name": "reply_to", + "value": { + "Address": { + "List": [ + { + "name": "Shapelib Development", + "address": "shapelib@lists.maptools.org" + } + ] + } + }, + "offset_field": 1553, + "offset_start": 1562, + "offset_end": 1614 + }, + { + "name": "list_id", + "value": { + "Address": { + "List": [ + { + "name": "Shapelib Development", + "address": "shapelib.lists.maptools.org" + } + ] + } + }, + "offset_field": 1614, + "offset_start": 1622, + "offset_end": 1674 + }, + { + "name": "list_unsubscribe", + "value": { + "Address": { + "List": [ + { + "name": null, + "address": "http://lists.maptools.org/mailman/listinfo/shapelib" + }, + { + "name": null, + "address": "mailto:shapelib-request@lists.maptools.org?subject=unsubscribe" + } + ] + } + }, + "offset_field": 1674, + "offset_start": 1691, + "offset_end": 1813 + }, + { + "name": "list_archive", + "value": { + "Address": { + "List": [ + { + "name": null, + "address": "http://lists.maptools.org/pipermail/shapelib" + } + ] + } + }, + "offset_field": 1813, + "offset_start": 1826, + "offset_end": 1874 + }, + { + "name": "list_post", + "value": { + "Address": { + "List": [ + { + "name": null, + "address": "mailto:shapelib@lists.maptools.org" + } + ] + } + }, + "offset_field": 1874, + "offset_start": 1884, + "offset_end": 1922 + }, + { + "name": "list_help", + "value": { + "Address": { + "List": [ + { + "name": null, + "address": "mailto:shapelib-request@lists.maptools.org?subject=help" + } + ] + } + }, + "offset_field": 1922, + "offset_start": 1932, + "offset_end": 1991 + }, + { + "name": "list_subscribe", + "value": { + "Address": { + "List": [ + { + "name": null, + "address": "http://lists.maptools.org/mailman/listinfo/shapelib" + }, + { + "name": null, + "address": "mailto:shapelib-request@lists.maptools.org?subject=subscribe" + } + ] + } + }, + "offset_field": 1991, + "offset_start": 2006, + "offset_end": 2126 + }, + { + "name": { + "other": "X-List-Received-Date" + }, + "value": { + "Text": "Wed, 09 Mar 2011 11:20:10 -0000" + }, + "offset_field": 2126, + "offset_start": 2147, + "offset_end": 2180 + } + ], + "is_encoding_problem": false, + "body": { + "Multipart": [ + 1, + 2 + ] + }, + "offset_header": 0, + "offset_body": 2181, + "offset_end": 3740 + }, + { + "headers": [ + { + "name": "content_type", + "value": { + "ContentType": { + "c_type": "text", + "c_subtype": "plain", + "attributes": [ + { + "name": "charset", + "value": "utf-8" + } + ] + } + }, + "offset_field": 2214, + "offset_start": 2227, + "offset_end": 2254 + }, + { + "name": "content_transfer_encoding", + "value": { + "Text": "quoted-printable" + }, + "offset_field": 2254, + "offset_start": 2280, + "offset_end": 2298 + } + ], + "is_encoding_problem": false, + "body": { + "Text": "Dear all,\n\nI am writting my first C application to access the shapefile and retrieve some \ndata. I'm trying to use the shapelib to achieve that unfortunately I'm keeping \non having the following errors: \n\n /home/geotema/valatest/src/readshapetest.c:19: undefined reference to \n`SHPOpen'\n /home/geotema/valatest/src/readshapetest.c:21: undefined reference to \n`SHPGetInfo'\n\nI cannot figure out what is missing. could anyone help me to sort out this \nissue???\n\nCheers\n\n\n" + }, + "offset_header": 2214, + "offset_body": 2299, + "offset_end": 2819 + }, + { + "headers": [ + { + "name": "content_type", + "value": { + "ContentType": { + "c_type": "text", + "c_subtype": "html", + "attributes": [ + { + "name": "charset", + "value": "utf-8" + } + ] + } + }, + "offset_field": 2853, + "offset_start": 2866, + "offset_end": 2892 + }, + { + "name": "content_transfer_encoding", + "value": { + "Text": "quoted-printable" + }, + "offset_field": 2892, + "offset_start": 2918, + "offset_end": 2936 + } + ], + "is_encoding_problem": false, + "body": { + "Html": "
Dear all,

I am writting my first C application to access the shapefile and retrieve some data. I'm trying to use the shapelib to achieve that unfortunately I'm keeping on having the following errors:
    /home/geotema/valatest/src/readshapetest.c:19: undefined reference to `SHPOpen'
    /home/geotema/valatest/src/readshapetest.c:21: undefined reference to `SHPGetInfo'

I cannot figure out what is missing. could anyone help me to sort out this issue???

Cheers

\n

\n\n\n\n\n " + }, + "offset_header": 2853, + "offset_body": 2937, + "offset_end": 3704 + } + ] +} \ No newline at end of file diff --git a/resources/received.json b/resources/received.json index 4c9161a..d0d328f 100644 --- a/resources/received.json +++ b/resources/received.json @@ -4200,5 +4200,163 @@ "tz_minute": 0 } } + }, + { + "header": "from nm2-vm1.bullet.mail.ukl.yahoo.com (nm2-vm1.bullet.mail.ukl.yahoo.com [217.146.183.227]) by lists.maptools.org (Postfix) with SMTP id BC0C186A2A for ; Wed, 9 Mar 2011 06:19:47 -0500 (EST)\n", + "expected": { + "from": { + "Name": "nm2-vm1.bullet.mail.ukl.yahoo.com" + }, + "from_ip": "217.146.183.227", + "from_iprev": "nm2-vm1.bullet.mail.ukl.yahoo.com", + "for_": "shapelib@lists.maptools.org", + "by": { + "Name": "lists.maptools.org" + }, + "with": "SMTP", + "id": "BC0C186A2A", + "date": { + "year": 2011, + "month": 3, + "day": 9, + "hour": 6, + "minute": 19, + "second": 47, + "tz_before_gmt": true, + "tz_hour": 5, + "tz_minute": 0 + } + } + }, + { + "header": "from [217.146.183.184] by nm2.bullet.mail.ukl.yahoo.com with NNFMP;\r\n\t09 Mar 2011 11:19:46 -0000\n", + "expected": { + "from": { + "IpAddr": "217.146.183.184" + }, + "by": { + "Name": "nm2.bullet.mail.ukl.yahoo.com" + }, + "date": { + "year": 2011, + "month": 3, + "day": 9, + "hour": 11, + "minute": 19, + "second": 46, + "tz_before_gmt": false, + "tz_hour": 0, + "tz_minute": 0 + } + } + }, + { + "header": "from [217.146.183.162] by tm15.bullet.mail.ukl.yahoo.com with NNFMP; 09 Mar 2011 11:19:46 -0000\n", + "expected": { + "from": { + "IpAddr": "217.146.183.162" + }, + "by": { + "Name": "tm15.bullet.mail.ukl.yahoo.com" + }, + "date": { + "year": 2011, + "month": 3, + "day": 9, + "hour": 11, + "minute": 19, + "second": 46, + "tz_before_gmt": false, + "tz_hour": 0, + "tz_minute": 0 + } + } + }, + { + "header": "from [127.0.0.1] by omp1003.mail.ukl.yahoo.com with NNFMP; 09 Mar 2011 11:19:46 -0000\n", + "expected": { + "from": { + "IpAddr": "127.0.0.1" + }, + "by": { + "Name": "omp1003.mail.ukl.yahoo.com" + }, + "date": { + "year": 2011, + "month": 3, + "day": 9, + "hour": 11, + "minute": 19, + "second": 46, + "tz_before_gmt": false, + "tz_hour": 0, + "tz_minute": 0 + } + } + }, + { + "header": "(qmail 31873 invoked by uid 60001); 9 Mar 2011 11:19:46 -0000\n", + "expected": { + "date": { + "year": 2011, + "month": 3, + "day": 9, + "hour": 11, + "minute": 19, + "second": 46, + "tz_before_gmt": false, + "tz_hour": 0, + "tz_minute": 0 + } + } + }, + { + "header": "from [93.48.39.139] by web28416.mail.ukl.yahoo.com via HTTP; Wed, 09 Mar 2011 11:19:45 GMT\n", + "expected": { + "from": { + "IpAddr": "93.48.39.139" + }, + "by": { + "Name": "web28416.mail.ukl.yahoo.com" + }, + "via": "HTTP", + "date": { + "year": 2011, + "month": 3, + "day": 9, + "hour": 11, + "minute": 19, + "second": 45, + "tz_before_gmt": true, + "tz_hour": 0, + "tz_minute": 0 + } + } + }, + { + "header": " from [127.0.0.1] (host.example.com [35.173.1.1])\r\n by bf7aa1d4e8a6 with SMTP id 660a079b99f27ed5a03038a8; Mon, 01 Apr 2024\r\n 01:02:19 GMT\r\n", + "expected": { + "from": { + "IpAddr": "127.0.0.1" + }, + "from_ip": "35.173.1.1", + "from_iprev": "host.example.com", + "by": { + "Name": "bf7aa1d4e8a6" + }, + "with": "SMTP", + "id": "660a079b99f27ed5a03038a8", + "date": { + "year": 2024, + "month": 4, + "day": 1, + "hour": 1, + "minute": 2, + "second": 19, + "tz_before_gmt": true, + "tz_hour": 0, + "tz_minute": 0 + } + } } -] \ No newline at end of file +] diff --git a/src/parsers/fields/received.rs b/src/parsers/fields/received.rs index 2f384f8..8c03954 100644 --- a/src/parsers/fields/received.rs +++ b/src/parsers/fields/received.rs @@ -450,7 +450,7 @@ impl<'x> Iterator for Tokenizer<'x, '_> { } else if n_total > 0 { break; } else { - start_pos += 1; + start_pos = self.stream.offset(); } } b'(' => {