summaryrefslogtreecommitdiff
path: root/test/libapt/strutil_test.cc
Commit message (Collapse)AuthorAgeFilesLines
* avoid std::get_time usage to sidestep libstdc++6 bugDavid Kalnischkies2016-06-171-0/+35
| | | | | | | | | | | | | | | | As reported upstream in https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71556 the implementation of std::get_time is currently not as accepting as strptime is, especially in how hours should be formatted. Just reverting 9febc2b238e1e322dce1f94ecbed46d595893b52 would be possible, but then we would reopen the problems fixed by it, so instead I opted here for a rewrite of the parsing logic which makes this method a lot longer, but at least it provides the same benefits as the rewrite in std::get_time was intended to give us and decouples us from the fix of the issue in the standard library implementation of GCC. LP: 1593583
* accept only the expected UTC timezones in date parsingDavid Kalnischkies2016-05-281-0/+38
| | | | | | | | | | | | | | | | | | HTTP/1.1 hardcodes GMT (RFC 7231 §7.1.1.1) and what is good enough for the internet must be good enough for us™ as we reuse the implementation internally to parse (most) dates we encounter in various places like the Release files with their Date and Valid-Until header fields. Implementing a fully timezone aware parser just feels too hard for no effective benefit as it would take 5+ years (= until LTS's are out of fashion) until a repository could use non-UTC dates and expect it to work. Not counting non-apt implementations which might or might not only want to encounter UTC here as well. As a bonus, this eliminates the use of an instance of setlocale in libapt. Closes: 819697
* encode UTF-8 characters correctly in QuoteStringDavid Kalnischkies2015-11-051-0/+11
| | | | | | | Limit the field length to a char to avoid bogus FF for utf-8 characters with the default length. Closes: 799123
* reimplement the last uses of sprintfDavid Kalnischkies2015-04-101-0/+22
| | | | | | | | Working with strings c-style is complicated and error-prune, so by converting to c++ style we gain some simplicity and avoid buffer overflows by later extensions. Git-Dch: Ignore
* rewrite ReadMessages()David Kalnischkies2014-10-261-0/+70
| | | | | | | | | | | | | Central methods of our infrastructure like this one responsible for communication with our methods shouldn't be more complicated then they have to and not claim to have (albeit unlikely) bugs. While I am not sure about having improved the first part, the bug is now gone and a few explicit tests check that it stays that way, so nobody will notice the difference (hopefully) – expect that this should a very tiny bit faster as well as we don't manually proceed through the string. Git-Dch: Ignore
* add test for Basic Authentication schemeDavid Kalnischkies2014-10-231-1/+15
| | | | Git-Dch: Ignore
* Merge branch 'debian/sid' into debian/experimentalMichael Vogt2014-09-231-0/+15
|\ | | | | | | | | | | | | | | | | Conflicts: apt-pkg/acquire-item.cc apt-pkg/acquire-item.h apt-pkg/cachefilter.h configure.ac debian/changelog
| * strip everything spacey in APT::String::StripDavid Kalnischkies2014-09-071-0/+15
| | | | | | | | Git-Dch: Ignore
* | Only allow "apt-get build-dep path" when path starts with ./ or /Michael Vogt2014-07-081-0/+9
|/ | | | | | This avoid the subtle problem that someone might have a directory with the same package name as the build-depends he/she is trying to fetch. Also print a note that the specific file/dir is used.
* fix SubstVar to be usable as a replace_all methodDavid Kalnischkies2014-06-181-0/+35
| | | | | | | The name suggests that it is supposed to substitute a variable with a value, but we tend to use it in a more liberal replace_all() fashion, but this breaks if either of the parameters is empty or more importantly if two "variable" occurrences follow each other directly.
* use Google C++ Testing Framework for libapt testsDavid Kalnischkies2014-04-161-81/+57
| | | | | | | | | | | | My commit 45df0ad2 from 26. Nov 2009 had a little remark: "The commit also includes a very very simple testapp." This was never intended to be permanent, but as usually… The commit adds the needed make magic to compile gtest statically as it is required and links it against a small runner. All previous testcase binaries are reimplemented in gtest and combined in this runner. While most code is a 1:1 translation some had to be rewritten like compareversion_test.cc, but the coverage remains the same.
* cleanup headers and especially #includes everywhereDavid Kalnischkies2014-03-131-1/+6
| | | | | | | | Beside being a bit cleaner it hopefully also resolves oddball problems I have with high levels of parallel jobs. Git-Dch: Ignore Reported-By: iwyu (include-what-you-use)
* warning: unused parameter ‘foo’ [-Wunused-parameter]David Kalnischkies2014-03-131-1/+1
| | | | | Reported-By: gcc -Wunused-parameter Git-Dch: Ignore
* add "APT::String::Endswith" and automatic adding of ".list" in apt edit-sourceMichael Vogt2013-11-291-0/+18
|
* change maxsplit default from "0" to maxintMichael Vogt2013-10-011-0/+4
|
* add maxsplit parameter to StringSplitMichael Vogt2013-09-071-0/+6
|
* implement StringSplit() as we need this to fix the dpkg status-fd output parsingMichael Vogt2013-09-071-0/+17
|
* do not pollute namespace in the headers with using (Closes: #500198)David Kalnischkies2011-09-191-1/+1
|
* add another escape test case, fixup octal one (its \0XX instead of \0XXX)Michael Vogt2011-07-261-0/+6
|
* * apt-pkg/contrib/strutl.{h,cc}, test/libapt/strutil_test.cc:Michael Vogt2011-07-261-0/+40
- add new DeEscapeString() similar to DeQuoteQuotedWord but unescape charackter escapes like \0XXX and \xXX (plus add test)