Commit Graph
19 Commits
Author SHA1 Message Date
David Evans 22b38c56ed Parser cleanup (implement shortcut methods, use new parse oneOf) (#509) 2021-03-31 11:21:34 +01:00
8b9c01a6ba Servers now can send authentication challenges (#505)
* Servers now can send authentication challenges

* Soundness

* Fix tests

* Change to use Response

* Docs

* Soundness

* work around SR-14394

* Update Sources/NIOIMAPCore/Grammar/Response/Response.swift

Co-authored-by: Daniel Eggert <daniel.eggert@hoerbuch.dk>

* Fix compile on 5.2

Co-authored-by: Johannes Weiss <johannesweiss@apple.com>
Co-authored-by: Daniel Eggert <daniel.eggert@hoerbuch.dk>
2021-03-23 16:33:36 +00:00
David Evans f1e7faa75f Propagate command tag on parsing error (#500)
* Propagate command tag on parsing error

* Soundness

* Docs

* Fix tests
2021-03-23 10:04:16 +00:00
David Evans 80a2910e63 Implement table parser with commands example (#437)
* Performance structure

* More tests

* Add more tests

* Remove dups

* More performance test cases

* Parse it all

* Fix sanity

* Use NIO perf tooling

* Change perf target name

* New table parser

* Fix quota parsers

* Fix ID parsers

* Human readable

* Cleanup

* Soundness

* Fix tests

* Minor refactor to use suffixes

* Tests

* Make parsing table non-global

* Rebase

* Soundness

* Tests

* More tests

* Soundness

* Fix compile

* Condense

* Maybe fix
2021-03-22 09:25:17 +00:00
David Evans 238caca684 Skip parsing if the ByteBuffer is empty (#478)
* Don't attempt parsing if 0 bytes

* Soundness

* undo

* Update CommandParser+Tests.swift
2021-03-16 11:53:52 +00:00
Johannes Weiss be9c737a29 restore separation of parser & parser library (#468) 2021-03-11 16:56:08 +00:00
David Evans 135f473bf6 Documentation PR part 5 (#383)
* Document UseAttribute

* Document URLRumpMechanism

* Document URLFetchData

* Document UAuthMechanism

* Document StoreModifier

* Document SortData

* Document SequenceMatchData

* Document QResyncParameter

* Document SelectParameter

* Document SectionSpecifier

* Document SectionSpecifier.Part

* Document SectionSpecifier.Kind

* Document ResponseEncodingOptions

* Document ResponseEncodeBuffer

* Document EncodeBuffer

* Document EncodeBuffer.Chunk

* Document EncodeBuffer more.

* Document CommandEncodeBuffer

* Document ParserError

* Document ResponseParser

* Document CommandParser

* Document SynchronisingLiteralParser

* Remove public where it isn't needed

* Document write CommandStream

* Document write TaggedCommand

* Remove public from write functions

* Document FetchAttribute

* Document top-level Capability

* Documents Capability subtypes

* Document FullDateTime

* Document FullDate

* Document FullTime

* Document ContinuationRequest

* Document ListSelectOptions

* Document ResponseOrContinuationRequest

* Document Response

* Document FetchResponse

* Document StreamingKind

* Document ResponseText

* Document ResponseTextCode

* Document TaggedResponse

* Document TaggedResponseState

* Remove docs

* PR review

* Fix sanity

* Document FullDate
2020-12-10 12:37:05 +00:00
David EvansandGeorge Barnett 78b55555bf Add some documentation (#341)
* Fix documentation

* Remove link to NIO http 2

* Document TooDeep error

* Remove ParsingError

* Make GrammarParser non-public

* Better UTF7 errors

* Document Access

* Document CommandStream types

* Partially document `Command`

* Document date

* Document Access

* Update Sources/NIOIMAPCore/Grammar/Date/Date.swift

Co-authored-by: George Barnett <gbarnett@apple.com>

* Update Sources/NIOIMAPCore/Grammar/Access.swift

Co-authored-by: George Barnett <gbarnett@apple.com>

* Update Sources/NIOIMAPCore/Grammar/Command/CommandStream.swift

Co-authored-by: George Barnett <gbarnett@apple.com>

* Fix typo

Co-authored-by: George Barnett <gbarnett@apple.com>
2020-10-26 09:54:46 +00:00
David Evans 1f9658005f Refactor parsing (#321)
* Refactor parse space

* Refactor parse fixed string

* Refactor parseOneOf

* Refactor parseOptional

* Refactor parseComposite

* Refactor parseNewline

* Fix sanity

* Rebase fixes
2020-09-28 13:22:10 +01:00
Cory Benfield f3d154b06c Implement RFC 4469 CATENATE (#310)
Motivation:

CATENATE functionality is convenient for low-power client usage, as it
allows clients to stitch together new messages out of the parts of older
ones without needing to reupload (or indeed redownload) that content.

Modifications:

- Extend CommandStream to support CATENATE.
- Extend serializer and parser to work with new definitions.

Result:

CATENATE is parseable.
2020-09-15 11:08:14 +01:00
David Evans 495d5f8c4b Refactor tests part 2 (#279)
* Update testParse2Digit

* Update testParseToken

* Update testParseUnsubscribe

* Update testParseUID

* Update testParseUIDSet

* Update testParseUserId

* Update testUIDRange

* Update testParseUid

* Update testParseText

* Fix sanity

* Remove un-needed function

* Update parseTaggedResponse

* Update parseTag

* Update parseSequenceSet

* Update parseRename

* Update parseSubscribe

* Update parseStoreAttribueFlags

* Update parseStore

* Update parseStatus

* Update testParseSequenceSet

* Update parse NZNumber

* Update parseNumber

* Update parseNString

* Test utilities for void returning parsers

* Update testParseNil

* Update testParseNewline

* Update testParseNamespace

* Update testParseAddress

* Better error messages

* Update testParseSequenceRange

* Fix testParseStatus

* Update testParseSequenceNumber

* Update testParseSelect

* Update testParseSectionSpecifierKind

* Update testParseSectionSpecifier

* Update testParseSectionPart

* Update testParseSectionBinary

* Update testParseSection

* Update testParseSearchReturnOptionExtension

* Batch replace function calls

* Use new method almost everywhere

* Remove extra spacing

* Fix sanity

* Remove redundant function

* Remove redundant code

* Refactor parsing search keys
2020-07-31 01:54:17 -07:00
Johannes WeissandDavid Evans 525d58d1fa non-happy path tests: over/underflows (#220)
* Support encoding append commands

* Yay it works

* Cleanup 1

* Cleanup 2

* Fix sanity

* Fix command decoder test

* Fix parsing partial commands sync literals

* Fix parser stress tests

* Fix tests

* Remove unused code

* Code refactor and cleanup

* Fix sanity

Co-authored-by: David Evans <d.evans@apple.com>
2020-06-26 14:47:40 +01:00
David Evans a06b3898aa Hide incomplete message errors (#135)
* Hide incomplete message errors

* Fix sanity

* Throw error

* Fix rebase

* Refactor

* Log not throw

* Improve roundtrip handler

* Fix sanity

* Update comments

* Remove error case

* Logging

* PR review

* Simplify loop

* Use NIOSinglestep...

* Fix sanity

* Even more efficiency

* Fix sanity
2020-05-28 13:49:11 +01:00
David EvansandJohannes Weiss 042d11fe17 Add B2MD tests for most commands/responses (#125)
* Move tests to dedicated file

* Add NOOP tests

* Add capability tests

* Add logout tests

* Add starttls tests

* Add select tests

* Add examine tests

* Fix sanity

* Add create tests

* Add delete tests

* Fix sanity

* Add subscribe tests

* Add unsubscribe tests

* Add missing test file header

* Add check tests

* Fix sanity

* Rebase

* Add list tests

* Add LSUB tests

* Add status tests

* Add append tests

* Setup response tests

* Allow response parse mode override

* Temp remove append

* Conditional state tests

* Bye tests

* Capability tests

* Flags tests

* Exists tests

* Recent tests

* Expunge tests

* Tagged response tests

* List, LSUB, and status tests

* Comment everything

* Make tests use synchronizing literals

* Replace CRLF

* Test fetch responses

* Fix sanity

* Assert

* Refactor error catching

* Test that breaks synchronising literals

* fix some stuff

* Fix sanity

* Fix all the things

* Fix sanity

Co-authored-by: Johannes Weiss <johannesweiss@apple.com>
2020-05-20 17:40:56 +01:00
Daniel Eggert 17c740a21b Change TaggedCommand property name and property order. (#154) 2020-05-20 10:50:18 +01:00
David Evans 28225ece7d Remove NIOIMAP namespace 2020-05-09 14:46:42 +01:00
tomer doron 53efab1d95 standardize format (#80)
motivation: use standard format across all of our projects

changes:
* add .swiftformat settings based on what we use in other projects
* validate format in the sanity script
* format
2020-04-24 12:05:17 +01:00
David Evans 0f5de678e5 Rename top-level command types and flatten UID commands into Command (#90)
* Flatten UID commands

* Rename command types
2020-04-23 16:22:56 +01:00
David Evans 19ecdb9576 Seperate module (#61) 2020-04-20 12:41:39 +01:00