-
-
Notifications
You must be signed in to change notification settings - Fork 493
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
VBA-Web Stripping ending slash "/" and not following redirects #466
Comments
What server is expecting trailing slashes for resources? Usually endpoints are setup as http://foo.com/posts to GET the posts collection. |
I tried to reproduce your issue and I'm not seeing the trailing slash removed. In PrepareHttpRequest, the call Me.GetFullUrl(request) seems to send back whatever I put in.
|
Did you try the url I posted?? Just note that the server redirects to the correct url, even with
|
I didn't try your URL, but I looked at |
Possible. |
I think you'll just have to set breakpoints and look. I don't think the maintainer is very active these days. AFAIK, this project was meant for RESTful APIs and not web scraping so you may be better served with an alternate project? Maybe someone else can jump in with some more actionable advice, but I think breakpoints will answer 97.5% of your questions. :) |
This is an old post, but I came across a similar problem where when joining the base url with the resources when the resources were just a query string a slash was being added. Instead of https://abc.com?something=1 it would create https://abc.com/?something=1 which would result in a redirect that would not get followed resulting in an error. I looked at the code and found that the WebHelpers.JoinUrl is where it removes the trailing slash and the beginning slash from the left side and right side and then joins them together with a slash if both sides are non-blank. I added a test in there to leave out the slash if the right side started with a question mark indicating that it was only a query string and not a resource path. |
Thank you for your comment. I had the same problem, my api called worked but I was annoyed to be redirected everytime. |
FWIW, if you type in |
UnscribeMobile emailOn 24 Apr 2023, at 20:14, Zoltan Grose ***@***.***> wrote:
FWIW, if you type in https://yahoo.com?foo=1 in the Edge browser (112.0.1722.48), you'll see it flip to https://yahoo.com/?foo=1 as well. Dunno if there is some RFC at play, but it seems the days of https://yahoo.com?foo=1 are behind us.
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you are subscribed to this thread.Message ID: ***@***.***>
|
A very simple client:
Response.StatusCode will return 302.
The problem is that VBA-Web is stripping the last character -> /
and the server rejects the request redirecting it to the correct url with an / in the end.
This was checked with
WebHelpers.EnableLogging = True
.The
Client.FollowRedirects
did not comply, but this could be an failsafe to avoid an infinite loop request the same url over and over (supposing it would [re]strip the / from the Location header).One important note is that a workaround for this bug was to add
Request.Resource = " "
.If added
Request.Resource = "/"
the problem would continue.The text was updated successfully, but these errors were encountered: