aboutsummaryrefslogtreecommitdiff
path: root/bytesconv.go
AgeCommit message (Collapse)AuthorFilesLines
2024-03-29fix: panic in ParseIPv4 when len(dst) > 4 (#1742)Gravatar Oleksandr Redko 1-6/+2
2024-02-21Upgrade golangci-lint to v1.56.2; fix gocritic issues (#1722)Gravatar Oleksandr Redko 1-1/+1
2023-06-13Enable gofumpt linter; format code `gofumpt -w .` (#1576)v1.48.0Gravatar Oleksandr Redko 1-1/+1
2023-03-30get rid of some panics (#1526)Gravatar Moritz Poldrack 1-0/+3
* client: simplify (*HostClient).do() Remove an allocation in favour of deferring a call to release the response. * client: remove panic in dialAddr Return an error instead of panicking if the user supplied a nonsensical DialFunc. * compression: remove panic on invalid compression level If a compression level exceeding gzip's boundaries is provided, fasthttp will panic. Instead it would be better to handle this error for them by limiting it to the minimum or maximum value, depending on the direction the user has exceeded the limits. Clamp the value of gzip to always be between gzip.BestSpeed and gzip.BestCompression. * peripconn: remove panic on negative connection count When a negative count is reached when unregistering a connection, a panic is caused even though data-integrity is not at risk. Replace the panic() with a simple clamp on the value to ensure the value does not exceed it's expected lower bounds. References: #1504 * compress: remove error on failed nonblocking writes Since there is no way of handling or even logging non-critical errors in stateless non-blocking writecalls, just drop them and hope the user notices and tries again. * workerPool: remove panic on redundant Start and Stop calls Instead of panicking for invalid behaviour, it's preferable to just turn the function into a noop. * http: remove panic on invalid form boundary * http: remove panic on negative reads Since bufio already panics on negative reads, it is not necessary to do so as well. If the length is zero and for some reason no error is returned, readBodyIdentity and appendBodyFixedSize now errors in these cases. Link: https://github.com/golang/go/blob/851f6fd61425c810959c7ab51e6dc86f8a63c970/src/bufio/bufio.go#L246 * fs: remove panic on negative reader count When a negative count is reached when unregistering a reader, a panic is thrown even though data-integrity is not at risk. Replace the panic() with a simple clamp on the value to ensure the value does not exceed it's expected lower bounds. * server: remove panic in favour of a segfault Panicking with "BUG: " obscures the error. As the segfault causes a panic anyway, just let the chaos unfold. * server: remove panic in favour of returning an error Writing on a timed-out response is not endangering data integrity and just fails. * chore: add comments to all panics * chore: fix minor typo
2023-02-03Add support for Go 1.20 (#1481)Gravatar Erik Dubbelboer 1-27/+0
2022-11-18style: modify typo and remove repeated type conversions (#1437)Gravatar kinggo 1-1/+1
2022-08-29Chore (#1365)Gravatar tyltr 1-3/+1
* chore-1 * chore2
2022-03-17Imporve AppendHTMLEscape fast path (#1249)Gravatar ZhangYunHao 1-13/+4
2022-03-15Fix AppendHTMLEscape (#1248)Gravatar ZhangYunHao 1-3/+6
2021-12-13Use %w to wrap errors (#1175)Gravatar Erik Dubbelboer 1-2/+2
2021-10-30chore (#1137)Gravatar tyltr 1-1/+1
2021-09-20Remove useless runtime.KeepAlive (#1107)Gravatar Oleg Kovalov 1-2/+0
* Remove useless runtime.KeepAlive * Update bytesconv.go
2021-09-10Check go fmt during lint (#1097)Gravatar Erik Dubbelboer 1-1/+1
2021-08-26Fix s2b (#1079)Gravatar YenForYang 1-1/+3
Ensure `len(b)` <= `cap(b)` at all times. Additionally, use `runtime.KeepAlive()` to prevent `s` from being GC-ed.
2021-02-12fix s2b go vet warning (#967)Gravatar ZhangYunHao 1-1/+1
2020-04-23Fix integer overflow handling in parseUintBuf() (#789)Gravatar Ivan Mironov 1-2/+3
* Add more tests for parseUintBuf() * Fix integer overflow handling in parseUintBuf()
2020-02-28feat: workflow to verify security using GoSec (#747)Gravatar RENAN.BASTOS 1-0/+3
* feat: workflow to valid security using GoSec * Update security.yml * Fix gosec problems These are all either false positives or os.Open operations done on filenames supplied by the fasthttp user which we have to assume is safe. * Just ignore some rules globally * Fix more warnings * No more warnings Co-authored-by: Erik Dubbelboer <erik@dubbelboer.com>
2019-11-16Run golangci-lint using a Github ActionGravatar Erik Dubbelboer 1-1/+3
2019-09-28Use 'go generate' in bytesconv.go (#663)Gravatar ZhangYunHao 1-95/+4
* Add bytesconv_table_gen.go
2019-09-20Add lowerhexGravatar ZYunH 1-1/+2
2019-09-20Use 0xf instead of 15Gravatar ZYunH 1-1/+1
2019-09-20Replace int2hexbyte with uppercaseGravatar ZYunH 1-8/+1
2019-09-19Replace hexCharUpeer with upperhex (#657)Gravatar ZYunH 1-10/+6
2019-09-18Improve appendQuotedPath and AppendQuotedArg (#654)Gravatar ZYunH 1-18/+66
* Update bytesconv.go * Modify tests * Remove unnecessary comments * Update args_test.go * Add test for appendQuotedPath * Fix 11202 issue * Fix some problems
2019-08-19A faster s2b function (#637)Gravatar ZYunH 1-8/+7
* Use pointer for smaller stack space
2019-02-16Remove methods that had been deprecated in 2015Gravatar Erik Dubbelboer 1-20/+0
2018-11-14Fix ParseUint to support all possible numbersGravatar Erik Dubbelboer 1-1/+2
Fixes #461
2018-09-11use proper "Deprecated" comment formatGravatar Iskander Sharipov 1-2/+2
Found using https://go-critic.github.io/overview#deprecatedComment-ref
2018-09-05Fix appendQuotedPath to include all allowed charactersGravatar Erik Dubbelboer 1-2/+10
2018-09-01Add ';' to unescaped charactersGravatar Jan Siemiński 1-1/+2
2018-08-13Merge pull request #303 from chebyrash/masterGravatar Kirill Danshin 1-2/+2
Typo fixes
2017-12-07added missing byte 0xFF into hex2intTable. This fixes panic when decoding ↵v20180529Gravatar Aliaksandr Valialkin 1-5/+5
specially crafted string like "%\xff"
2017-10-08A lot of typo fixesGravatar xPushkin 1-2/+2
2017-07-21ioptimized decodeArgAppend a bitGravatar Aliaksandr Valialkin 1-11/+7
Benchmark results on linux/amd64: name old time/op new time/op delta ArgsParse-4 72.8ns ± 2% 68.0ns ± 2% -6.59% (p=0.000 n=10+9) AppendUnquotedArgFastPath-4 20.4ns ± 2% 21.1ns ± 9% ~ (p=0.614 n=8+10) AppendUnquotedArgSlowPath-4 68.9ns ± 3% 70.4ns ± 6% ~ (p=0.148 n=9+10) URIParsePath-4 80.9ns ± 2% 78.7ns ± 2% -2.80% (p=0.000 n=10+10) URIParsePathQueryString-4 88.9ns ± 1% 86.3ns ± 1% -2.90% (p=0.000 n=10+8) URIParsePathQueryStringHash-4 95.7ns ± 8% 91.0ns ± 1% -4.88% (p=0.000 n=9+10) URIParseHostname-4 98.6ns ± 1% 95.4ns ± 1% -3.24% (p=0.000 n=10+10)
2017-07-11Issue #278: more optimizations for normalizeHeaderKeyGravatar Aliaksandr Valialkin 1-12/+7
2017-07-10Issue #278: optimize normalizeHeaderKey a bitGravatar Aliaksandr Valialkin 1-8/+24
Performance results on amd64: name old time/op new time/op delta NormalizeHeaderKeyCommonCase-4 43.3ns ± 0% 32.6ns ± 1% -24.80% (p=0.000 n=9+10) NormalizeHeaderKeyLowercase-4 42.6ns ± 3% 32.6ns ± 1% -23.41% (p=0.000 n=10+10) NormalizeHeaderKeyUppercase-4 43.5ns ± 1% 32.6ns ± 2% -25.03% (p=0.000 n=9+8) Based on top of https://github.com/valyala/fasthttp/pull/279 .
2017-06-23added a fast path to AppendHTMLEscape when the string doesnt contain special ↵Gravatar Aliaksandr Valialkin 1-0/+11
chars
2017-06-19Added AppendUnquotedArg - the complementary function to AppendQuotedArgGravatar Aliaksandr Valialkin 1-0/+7
2016-06-07Properly handle hashes and single dots in URI.Update (see ↵Gravatar Aliaksandr Valialkin 1-0/+15
https://github.com/kataras/iris/issues/173)
2016-04-28Do no allocate memory for error when an empty string is passed to ParseIPv4()Gravatar Aliaksandr Valialkin 1-0/+5
2016-03-30bytesconv: reduce memory allocations on parse errors by using static errorsGravatar Aliaksandr Valialkin 1-11/+32
2016-03-29Renamed unsafeBytes2Str to b2sGravatar Aliaksandr Valialkin 1-4/+4
2016-02-15Added AppendHTMLEscape helper functionGravatar Aliaksandr Valialkin 1-0/+31
2016-01-19Fixed golint warningsGravatar Aliaksandr Valialkin 1-1/+1
2016-01-13Exported AppendQuotedArgGravatar Aliaksandr Valialkin 1-4/+5
2016-01-13typo fixGravatar Aliaksandr Valialkin 1-1/+1
2016-01-04Issue #29: use time.UTC instead of time.LoadLocation, since this call may ↵Gravatar Aliaksandr Valialkin 1-9/+3
fail on systems without certain config files
2015-12-23Escape query args chars according to ↵Gravatar Aliaksandr Valialkin 1-1/+2
http://www.w3.org/TR/html5/forms.html#form-submission-algorithm
2015-12-23Moved appendQuotedPath to bytesconvGravatar Aliaksandr Valialkin 1-0/+12
2015-12-22Do not escape '-' and '_' in url path and query argsGravatar Aliaksandr Valialkin 1-1/+1