aboutsummaryrefslogtreecommitdiff
path: root/http_test.go
AgeCommit message (Collapse)AuthorFilesLines
2024-04-22fix: propagate body stream error to close function (#1743) (#1757)Gravatar Max Denushev 1-1/+1
* fix: propagate body stream error to close function (#1743) * fix: http test * fix: close body stream with error in encoding functions * fix: lint --------- Co-authored-by: Max Denushev <denushev@tochka.com>
2024-03-02test: remove `//nolint:govet` comments (#1729)Gravatar Oleksandr Redko 1-4/+4
2024-03-02Enable few gocritic checks; fix up issues (#1728)Gravatar Oleksandr Redko 1-2/+2
2024-02-21Upgrade golangci-lint to v1.56.2; fix gocritic issues (#1722)Gravatar Oleksandr Redko 1-2/+2
2024-02-11Follow RFCs 7230 and 9112 for HTTP versions (#1710)Gravatar Erik Dubbelboer 1-12/+3
Require that HTTP versions match the following pattern: HTTP/[0-9]\.[0-9]
2024-01-09Move Fuzz tests into their own fileGravatar Erik Dubbelboer 1-26/+0
This is required for https://github.com/google/oss-fuzz/pull/11453
2024-01-06test: migrate remaining fuzzit tests to go 1.18 fuzzing (#1687)Gravatar nickajacks1 1-0/+26
2024-01-04Change empty string checks to be more idiomatic (#1684)Gravatar Oleksandr Redko 1-2/+2
2023-11-12Enable dupword, unconvert linters (#1658)v1.51.0Gravatar Oleksandr Redko 1-1/+1
2023-08-30docs: fix typos in comments and testsGravatar Oleksandr Redko 1-1/+1
2023-08-24fix round2_32, split round2 tests because they depend on sizeof int at ↵Gravatar Duncan Overbruck 1-30/+0
compile time (#1607)
2023-07-08Fix round2Gravatar Erik Dubbelboer 1-15/+22
- don't limit it to 32 bits - give it a proper name - don't over-allocate too much
2023-06-13Enable gofumpt linter; format code `gofumpt -w .` (#1576)v1.48.0Gravatar Oleksandr Redko 1-6/+6
2023-05-07Fix tests (#1552)Gravatar Erik Dubbelboer 1-1/+9
2023-04-28test: refactor to use WriteString (#1546)v1.47.0Gravatar Oleksandr Redko 1-3/+3
2023-04-25test: use ReplaceAll, remove unnecessary else (#1542)Gravatar Oleksandr Redko 1-10/+8
2023-04-12Fixed transfer-encoding for empty chunked payload (#1536)Gravatar Abe Saiovici 1-0/+19
2023-04-05support response body stream (#1414)Gravatar Anthony-Dong 1-0/+119
* feat: support response body stream * style: add header interface * Update http.go Co-authored-by: Erik Dubbelboer <erik@dubbelboer.com> * feat: support request、response、client stream * fix: close reader bug --------- Co-authored-by: fanhaodong.516 <fanhaodong.516@bytedance.com> Co-authored-by: Erik Dubbelboer <erik@dubbelboer.com>
2023-03-18test: simplify bytes.Buffer declaration (#1523)Gravatar Oleksandr Redko 1-8/+4
2023-02-11Refactor golangci-lint config and remove redundant nolints (#1486)Gravatar Oleksandr Redko 1-8/+8
* Refactor golangci-lint config - Use golangci-lint-action for GitHub workflow. - Add additional golangci-lint run options. - Remove unused nolint directives. * Revert exclude-use-default option
2023-02-09doc,test: correct typos (#1484)Gravatar Oleksandr Redko 1-4/+4
2023-01-14fix: CopyTo doesn't copy bodyraw deeply (#1471)Gravatar kinggo 1-0/+32
2022-11-03fix form empty field error when used with pipe (#1417)Gravatar nick9822 1-0/+84
Co-authored-by: root <nikesh.tawde@digitalairtech.com>
2022-10-29fix: (#1410)Gravatar byene0923 1-4/+4
1. the length of trailer key should > 0 2. fix http_test words typo
2022-10-29fix: ignore body should not set content-length of streaming (#1406)Gravatar byene0923 1-0/+19
* fix: ignore body should not set content-length of streaming https://github.com/valyala/fasthttp/pull/1022 * fix: add commit
2022-09-15Deprecate Go 1.15 (#1379)Gravatar Aoang 1-4/+3
* Dropping support for 1.15. * Replaces Go 1.16 Deprecated functions * Update test build flag * Fix import sort and comment * Update github.com/klauspost/compress to v1.15.9 https://github.com/klauspost/compress improved performance and changed Minimum version is 1.16, this should be the final supported release for Go 1.16 (https://github.com/klauspost/compress/commit/6d0019a95afa3221f7522d1f2eed0033b5e79470) .
2022-07-29Prevent overflow and panic on large HTTP responses (#1351)Gravatar mathew 1-0/+2
2022-06-06BodyDecoded() for request and responses (#1308)Gravatar Sergey Ponomarev 1-2/+54
* header.go ContentEncoding() getter and setters For Response the CE header is stored into a separate field because compressed responses are often used. But for the Request let's just peek and store it from headers map * http.go: New BodyUncompressed() method for request and responses The new method returns a body and uncompress if it's gzipped
2022-06-05Response.ContentEncoding(): store as field and avoid using ↵Gravatar Sergey Ponomarev 1-4/+4
Header.SetCanonical() (#1311) * Response.ContentEncoding(): store as field The CE is not so often used for plain APIs responses and even not so often used for static files and on the fly compression. But still it should be checked each time. Also having a dedicated field getter and setter simplifies code * header.go Use shorter Response.setNonSpecial() and Request.setNonSpecial() methods instead of SetCanonical() The change should improve performance because the setSpecialHeader() call is omitted. As a downside on adding a new basic header field all putHeader() must be replaced with a direct getter and setter.
2022-04-01Use %v for errors and %q for strings (#1262)v1.35.0Gravatar Erik Dubbelboer 1-110/+110
Mostly in tests.
2022-03-01Fix panic while reading invalid trailersGravatar Erik Dubbelboer 1-0/+3
2021-12-28Release UseHostHeader in ReleaseRequest() (#1185)Gravatar Tolyar 1-0/+14
* Fix UseHostHeader for DoTimeout + tests * Release UseHostHeader in ReleaseRequest() + tests
2021-12-26Fix UseHostHeader for DoTimeout + tests (#1184)Gravatar Tolyar 1-0/+37
2021-12-17Allow to set Host header for Client (#1169)Gravatar Tolyar 1-5/+26
* Allow to set Host header for Client * Allow to change Host header without tests violation * Rename AllowToChangeHostHeader and add tests. * Allow to use empty uri.Host() when req.Header.Host() does not empty
2021-12-13Use %w to wrap errors (#1175)Gravatar Erik Dubbelboer 1-3/+8
2021-12-13Fix bad request trailer panicGravatar Erik Dubbelboer 1-0/+6
2021-12-06Fix parseTrailer panicGravatar Erik Dubbelboer 1-0/+10
2021-12-05Add trailer support (#1165)Gravatar ichx 1-81/+311
* Add trailer support * fix issue and add documentation * remove redundant code * add error return for add/set trailer method * fix lint error * fix bad trailer error return issue and update bad content-length error * update errNonNumericChars * update errNonNumericChars * fix issue about error and fix typo
2021-11-08http.go: Request.SetURI() (Fix #1141) (#1148)Gravatar Sergey Ponomarev 1-0/+25
Currently, the only way to set URI for a request is to call SetRequestURI(string). Then when a request performed the string will be parsed into a fasthttp.URI struct. If there are many requests with the same URI then we'll waste CPU for a parsing of the same URI string. With the new SetURI(*URI) method we can once parse a URI string into a fasthttp.URI struct and then reuse it for many requests. Unfortunately the URI will be copied because may be modified inside the request. But anyway this will be more lightweight than parsing.
2021-11-08fix: Status Line parsing and writing (#1135)Gravatar Shivansh Vij 1-2/+2
* Adding zero-allocation uint64 to byte slice conversion and fixing the ResponseHeader.SetStatusLine function call signature * Removing unnecessary i2b function * Fixing various bugs * Adding test cases * Commenting AppendStatusLine * Update status.go Co-authored-by: Erik Dubbelboer <erik@dubbelboer.com> * Update header.go Co-authored-by: Erik Dubbelboer <erik@dubbelboer.com> * Cleaning up references to strHTTP11, using formatStatusLine for invalidStatusLine, and making `appendStatusLine` an unexported function Issue: https://github.com/valyala/fasthttp/issues/1132 * Fixing merge conflicts Issue: https://github.com/valyala/fasthttp/issues/1132 * Replacing []byte{} with nil in some test cases Issue: https://github.com/valyala/fasthttp/issues/1132 * Cleaning up parsing first line, and improving StatusMessage function Issue: https://github.com/valyala/fasthttp/issues/1132 * Fixing as per PR * Update header.go Co-authored-by: Erik Dubbelboer <erik@dubbelboer.com> * Update header.go Co-authored-by: Erik Dubbelboer <erik@dubbelboer.com> * Fixing as per requested changes * Update header_test.go Co-authored-by: Erik Dubbelboer <erik@dubbelboer.com> Co-authored-by: Erik Dubbelboer <erik@dubbelboer.com>
2021-10-22feat: ability to edit status messages (#1126)Gravatar Valentin Paz Marcolla 1-0/+18
* SetStatusMessage * Docstring * statusLine in header * Use statusLine as []byte + ResponseHeader parsing * status line getter
2021-06-18Lower go test timeGravatar Erik Dubbelboer 1-0/+4
2021-05-14Fix ignoreBody still set content length (#1022)Gravatar MoreFreeze 1-3/+20
* Fix ignore body should not set content-length * Add TestRequestReadNoBody Co-authored-by: liuchenxing <liuchenxing@bytedance.com>
2021-03-15ImmediateHeaderFlush when no body (#995)Gravatar Vladimir Shteinman 1-0/+80
2021-01-06Ignore empty Transfer-Encoding headersGravatar Erik Dubbelboer 1-0/+16
Don't default to chunked. If we have a Content-Length header we have a fixed body.
2020-12-09fix issue #875 (#909)v1.18.0Gravatar Kirill Danshin 1-0/+48
* 🐞 panic in fs.go #824 * fix issue #875 Signed-off-by: Kirill Danshin <kirill@danshin.pro> * improve issue 875 Co-authored-by: Fenny <fenny@gofiber.io> * Update header.go * Update header.go Co-authored-by: Kirill Danshin <kirill@danshin.pro> * remove foldReplacer * Improve removeNewLines Start replacing at the first character found, use bytes.Indexbyte to make the function signature more logical. Both bytes.indexByte and strings.IndexByte use exactly the same code: https://github.com/golang/go/blob/0c703b37dffe74d3fffc04347884bb0ee2fba5b3/src/internal/bytealg/indexbyte_amd64.s#L8-L20 Co-authored-by: wernerr <rene.werner@verivox.com> Co-authored-by: wernerr <rene@gofiber.io> Co-authored-by: Fenny <fenny@gofiber.io> Co-authored-by: Erik Dubbelboer <erik@dubbelboer.com>
2020-11-02Add Request.SetBodyRawGravatar Erik Dubbelboer 1-0/+40
Fixes https://github.com/valyala/fasthttp/issues/891
2020-07-17Update linting (#851)Gravatar Erik Dubbelboer 1-1/+1
2020-04-14Add configuration to not pre-parse multipart form data (#778)v1.10.0Gravatar Markmerc 1-1/+43
Co-authored-by: Mercurio <mmmercur@amazon.com>
2020-02-28Don't send the fragment/hash/# part of a URL to the serverGravatar Erik Dubbelboer 1-0/+15
Fixes https://github.com/valyala/fasthttp/issues/748