cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: Trailing slash in Curl

From: Evgeny <morozov.e.r_at_gmail.com>
Date: Wed, 31 Aug 2016 21:07:41 +0300

Thanks for answer, Daniel!
I need think about it again.

2016-08-30 17:09 GMT+03:00 Daniel Stenberg <daniel_at_haxx.se>:

> On Tue, 30 Aug 2016, Evgeny wrote:
>
> Hello, Daniel! Thanks a lot for your great tool Curl!
>>
>
> You're welcome, although we're over 1400 people who contributed to make
> curl what it is - certainly not just me!
>
> I tune url redirects for my site using htacess file.
>> When I perform
>> curl -Ls -o /dev/null -w %{url_effective} morozov.one/(something_else)
>> and final redirect is bare domain name
>> Curl outputs:
>> http://morozov.one/
>> Notice leading slash at the end of domain.
>>
>
> Yeah, the trailing slash is part of curl's internals that makes it best to
> cleanup and rectify URLs (at least some mistakes). Like a raw host name,
> which implies asking for '/' so it adds the slash to "correct" it. But yes,
> it could be argued if that is correct or not.
>
> Why do you redirect to the hostname only without slash? Why do you feel a
> need to distinguish those two versions that have no difference when you use
> them?
>
> This inflexible behaviour of curl doesn't allow me to see is where
>> redirect from slash ended domain to without-slash domain or vise versa.
>>
>
> Correct. Also, if you redirect to a URL with one or three slashes, curl
> will show you the corrected version.
>
> Can I switch off adding this slash in Curl?
>>
>
> Nope, it's part of what it does without asking.
>
> --
>
> / daniel.haxx.se
> -------------------------------------------------------------------
> List admin: https://cool.haxx.se/list/listinfo/curl-users
> FAQ: https://curl.haxx.se/docs/faq.html
> Etiquette: https://curl.haxx.se/mail/etiquette.html
>

-- 
Евгений Морозов
http://vk.com/id54573770
https://www.facebook.com/morozov.e.r
https://twitter.com/morozov_e <https://twitter.com/Morozov_E>

-------------------------------------------------------------------
List admin: https://cool.haxx.se/list/listinfo/curl-users
FAQ: https://curl.haxx.se/docs/faq.html
Etiquette: https://curl.haxx.se/mail/etiquette.html
Received on 2016-08-31