Kitura / Kitura-net

Kitura networking
Apache License 2.0
104 stars 79 forks source link

ClientRequest error. on Linux #311

Closed sinisaabramovic closed 5 years ago

sinisaabramovic commented 5 years ago

Hi I follow this tutorial (https://www.raywenderlich.com/1079484-kitura-tutorial-getting-started-with-server-side-swift#toc-anchor-008) and when I run my app and try to execute GET request on linux machine I recieve this error:

[ClientRequest.swift:568 end(close:)] ClientRequest error. Failed to parse response. Error=Parsed fewer bytes than were passed to the HTTP parser From [AcronymPersistence.swift:20 getAll(from:callback:)] Error retrieving all documents: Optional(Error: Server Error, No response from queryByView request)

For Example POST pass right And If I run project on MAC than I dont get any of errors PS. Linux runs CouchDB 2.3.1 OSX runs CouchDB 1.7.2

Spriter commented 4 years ago

What was the issue? I have the same problem.

dsperling commented 4 years ago

@Spriter I see the same issue with a Kitura project I upgraded to Swift 5. It appears to be the version of libcurl (7.58.0) included available to Ubuntu 18.04 which is the base image of swift:5.1.

Example to show the version included:

docker run -it swift:5.1 \
    bash -c "apt-get -y update && apt-get -y install curl && curl --version"
...
curl 7.58.0 (x86_64-pc-linux-gnu) libcurl/7.58.0 OpenSSL/1.1.1 zlib/1.2.11 libidn2/2.0.4 libpsl/0.19.1 (+libidn2/2.0.4) nghttp2/1.30.0 librtmp/2.3
...

I worked around the problem by using swift:5.1-xenial (Ubuntu 16.04) which includes curl 7.47.0.

docker run -it swift:5.1-xenial \
    bash -c "apt-get -y update && apt-get -y install curl && curl --version"
...
curl 7.47.0 (x86_64-pc-linux-gnu) libcurl/7.47.0 GnuTLS/3.4.10 zlib/1.2.8 libidn/1.32 librtmp/2.3
...