Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HTTP GET error after get 302 response #435

Closed
dmknght opened this issue Aug 7, 2019 · 2 comments
Closed

HTTP GET error after get 302 response #435

dmknght opened this issue Aug 7, 2019 · 2 comments

Comments

@dmknght
Copy link

dmknght commented Aug 7, 2019

Julia 1.0.4
HTTP.jl 0.X.X (Pulled Aug 07, 2019)
MbedTLS.jl v0.6.8 -- Please specify versions

I am having this code

url = "http://foo.com/"
response = HTTP.request("GET", url; verbose = 2)

the site http://foo.com/ redirects to http://foo.com/home.php

The response header (generated by verbose):

HTTP/1.1 302 Moved Temporarily
Date: Wed, 07 Aug 2019 14:03:10 GMT
Server: Apache
X-Powered-By: PHP/5.4.35
location: home.php
X-Powered-By: PleskLin

And running Julia gives me this error:

ERROR: LoadError: ArgumentError: jl_apply_generic requires !(scheme in ["http", "https"]) || (isempty(path) || path[1] == '/')
Stacktrace:
 [1] macro expansion at /home/dmknght/.julia/packages/HTTP/U2ZVp/src/debug.jl:52 [inlined]
 [2] #merge#4(::SubString{String}, ::SubString{String}, ::SubString{String}, ::SubString{String}, ::SubString{String}, ::SubString{String}, ::SubString{String}, ::Function, ::HTTP.URIs.URI) at /home/dmknght/.julia/packages/HTTP/U2ZVp/src/URIs.jl:81
 [3] (::getfield(Base, Symbol("#kw##merge")))(::NamedTuple{(:path, :query),Tuple{SubString{String},SubString{String}}}, ::typeof(merge), ::HTTP.URIs.URI) at ./none:0
 [4] absuri(::HTTP.URIs.URI, ::HTTP.URIs.URI) at /home/dmknght/.julia/packages/HTTP/U2ZVp/src/URIs.jl:419
 [5] absuri(::SubString{String}, ::HTTP.URIs.URI) at /home/dmknght/.julia/packages/HTTP/U2ZVp/src/URIs.jl:407
 [6] #request#1(::Int64, ::Bool, ::Base.Iterators.Pairs{Symbol,Int64,Tuple{Symbol},NamedTuple{(:verbose,),Tuple{Int64}}}, ::Function, ::Type{HTTP.RedirectRequest.RedirectLayer{HTTP.MessageRequest.MessageLayer{HTTP.RetryRequest.RetryLayer{HTTP.ExceptionRequest.ExceptionLayer{HTTP.ConnectionRequest.ConnectionPoolLayer{HTTP.StreamRequest.StreamLayer}}}}}}, ::String, ::HTTP.URIs.URI, ::Array{Pair{SubString{String},SubString{String}},1}, ::Array{UInt8,1}) at /home/dmknght/.julia/packages/HTTP/U2ZVp/src/RedirectRequest.jl:35
 [7] (::getfield(HTTP, Symbol("#kw##request")))(::NamedTuple{(:verbose,),Tuple{Int64}}, ::typeof(HTTP.request), ::Type{HTTP.RedirectRequest.RedirectLayer{HTTP.MessageRequest.MessageLayer{HTTP.RetryRequest.RetryLayer{HTTP.ExceptionRequest.ExceptionLayer{HTTP.ConnectionRequest.ConnectionPoolLayer{HTTP.StreamRequest.StreamLayer}}}}}}, ::String, ::HTTP.URIs.URI, ::Array{Pair{SubString{String},SubString{String}},1}, ::Array{UInt8,1}) at ./none:0
 [8] #request#5(::Base.Iterators.Pairs{Symbol,Int64,Tuple{Symbol},NamedTuple{(:verbose,),Tuple{Int64}}}, ::Function, ::String, ::HTTP.URIs.URI, ::Array{Pair{SubString{String},SubString{String}},1}, ::Array{UInt8,1}) at /home/dmknght/.julia/packages/HTTP/U2ZVp/src/HTTP.jl:300
 [9] (::getfield(HTTP, Symbol("#kw##request")))(::NamedTuple{(:verbose,),Tuple{Int64}}, ::typeof(HTTP.request), ::String, ::HTTP.URIs.URI, ::Array{Pair{SubString{String},SubString{String}},1}, ::Array{UInt8,1}) at ./none:0
 [10] #request#6(::Array{Pair{SubString{String},SubString{String}},1}, ::Array{UInt8,1}, ::Nothing, ::Base.Iterators.Pairs{Symbol,Int64,Tuple{Symbol},NamedTuple{(:verbose,),Tuple{Int64}}}, ::Function, ::String, ::String, ::Array{Pair{SubString{String},SubString{String}},1}, ::Array{UInt8,1}) at /home/dmknght/.julia/packages/HTTP/U2ZVp/src/HTTP.jl:314
 [11] (::getfield(HTTP, Symbol("#kw##request")))(::NamedTuple{(:verbose,),Tuple{Int64}}, ::typeof(HTTP.request), ::String, ::String, ::Array{Pair{SubString{String},SubString{String}},1}, ::Array{UInt8,1}) at ./none:0 (repeats 2 times)
 [12] connect() at /home/dmknght/NgFuzz/src/main.jl:12
 [13] top-level scope at none:0
 [14] include at ./boot.jl:317 [inlined]
 [15] include_relative(::Module, ::String) at ./loading.jl:1044
 [16] include(::Module, ::String) at ./sysimg.jl:29
 [17] exec_options(::Base.JLOptions) at ./client.jl:266
 [18] _start() at ./client.jl:425
in expression starting at /home/dmknght/NgFuzz/src/main.jl:15

Process finished with exit code 1

I am thinking HTTP trying to open home.php instead of http://foo.com/home.php so the program gives me this error and exit. Can you guy fix this?

@hissatupassenger
Copy link

maybe I got same error...

@dfucci
Copy link

dfucci commented Nov 5, 2020

there is a redirect option which allows following 3xx pages

response = HTTP.request("GET", url; verbose = 2, redirect=true)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants