ikod / dlang-requests

dlang http client library inspired by python-requests
Boost Software License 1.0
154 stars 32 forks source link

import requests; causes "Can't parse uri '' " #109

Closed bartland closed 4 years ago

bartland commented 4 years ago

Tried (installed with "curl https://dlang.org/install.sh | bash -s dmd|gdc|ldc")

app.d

import requests;

void main() {
}

dub --vverbose

Running ./tmp 
requests.uri.UriException@/home/cartland/.dub/packages/requests-1.0.9/requests/source/requests/uri.d(35): Can't parse uri ''
Program exited with code 1
Full exception: object.Exception@source/dub/generators/build.d(557): Program exited with code 1
----------------
/home/vagrant/old-dmd/dmd2/linux/bin64/../../src/phobos/std/exception.d:515 pure @safe void std.exception.bailOut!(Exception).bailOut(immutable(char)[], ulong, scope const(char)[]) [0x858d7a]
??:? pure @safe bool std.exception.enforce!().enforce!(bool).enforce(bool, lazy const(char)[], immutable(char)[], ulong) [0xa0274b]
source/dub/generators/build.d:557 void dub.generators.build.BuildGenerator.runTarget(dub.internal.vibecompat.inet.path.NativePath, const(dub.compilers.buildsettings.BuildSettings), immutable(char)[][], dub.generators.generator.GeneratorSettings) [0x94b986]
source/dub/generators/build.d:128 void dub.generators.build.BuildGenerator.performPostGenerateActions(dub.generators.generator.GeneratorSettings, const(dub.generators.generator.ProjectGenerator.TargetInfo[immutable(char)[]])) [0x9476c5]
source/dub/generators/generator.d:121 void dub.generators.generator.ProjectGenerator.generate(dub.generators.generator.GeneratorSettings) [0x9505d7]
source/dub/dub.d:618 void dub.dub.Dub.generateProject(immutable(char)[], dub.generators.generator.GeneratorSettings) [0x81463f]
source/dub/commandline.d:819 int dub.commandline.GenerateCommand.execute(dub.dub.Dub, immutable(char)[][], immutable(char)[][]) [0x7ce328]
source/dub/commandline.d:872 int dub.commandline.BuildCommand.execute(dub.dub.Dub, immutable(char)[][], immutable(char)[][]) [0x7ce8d9]
source/dub/commandline.d:957 int dub.commandline.RunCommand.execute(dub.dub.Dub, immutable(char)[][], immutable(char)[][]) [0x7cf0e2]
source/dub/commandline.d:273 int dub.commandline.runDubCommandLine(immutable(char)[][]) [0x7ca510]
source/app.d:14 _Dmain [0x7bcef7]
bartland commented 4 years ago

For curiosity, went to .dub/packages/requests-1.0.9/requests/

dub test

$ dub test
Generating test runner configuration 'requests-test-std' for 'std' (library).
Excluding package.d file from test due to https://issues.dlang.org/show_bug.cgi?id=11847
Excluding package.d file from test due to https://issues.dlang.org/show_bug.cgi?id=11847
Excluding package.d file from test due to https://issues.dlang.org/show_bug.cgi?id=11847
Excluding package.d file from test due to https://issues.dlang.org/show_bug.cgi?id=11847
Performing "unittest" build using /home/bruce/dlang/dmd-2.089.0/linux/bin64/dmd for x86_64.
cachetools 0.3.1: building configuration "library"...
requests 1.0.9: building configuration "requests-test-std"...
source/requests/package.d(403,31): Deprecation: alias std.json.JSON_TYPE is deprecated - Use JSONType
source/requests/package.d(403,31): Deprecation: enum member std.json.JSONType.STRING is deprecated - Use .string
Compiling httpbin server
Linking...
Running ./requests-test-std 
2019-11-09T12:07:34.438 [trace] ssl_adapter.d:66:_sharedStaticCtor_L50_C1 will use libssl.so
2019-11-09T12:07:34.438 [trace] ssl_adapter.d:80:_sharedStaticCtor_L50_C1 will use libcrypto.so
requests.uri.UriException@source/requests/uri.d(35): Can't parse uri ''
Program exited with code 1
ikod commented 4 years ago

Hello @bartland

Can you please run dub run -v --force for your test app and show me complete output?

Thanks!

UPD: also can you try git clone https://github.com/ikod/dlang-requests.git; cd requests ; dub test

bartland commented 4 years ago

Figured it out. MacOS and Linux.

If the environment variable http_proxy is set, it uses it even when blank.

If I unset it, it works.

The code should probably check this and ignore it if blank - as per std.net.curl behavior.

Cheers.

ikod commented 4 years ago

Hello @bartland !

Thanks for report! Can you please check with latest commit from github? I'll make new release if everything will be ok.

Thanks!

bartland commented 4 years ago

Hi @ikod

The original project fails but the new one works.

All unit tests have been run successfully.

Cheers

ikod commented 4 years ago

Thanks, will close issue