<div dir="ltr"><div class="gmail_quote">Hello GDAL Devs,</div><div class="gmail_quote"><br></div><div class="gmail_quote">We are trying to use /vsicurl to allow users to access data in our datapool.  However, we are having a problem that I'm hoping one of you may know the answer to.  Below is a summary from a developer on the team.  </div><div class="gmail_quote"><br></div><div class="gmail_quote"><br><div dir="ltr"><div dir="ltr"><div>Is there a way to make vsicurl persist cookies across redirects?</div><div><br></div><div>I'm trying to use vsicurl to interact with a URL behind OAuth authentication.  The OAuth behavior involves redirects, cookies, and .netrc credentials.  This curl command will successfully download the file (assumes credentials are in a .netrc file):</div><div><br></div></div><blockquote style="margin:0 0 0 40px;border:none;padding:0px"><div dir="ltr"><div><font face="monospace, monospace">curl --remote-name --location --netrc --cookie-jar "" <a href="https://grfn.asf.alaska.edu/door/download/S1-IFG_RM_M1S2_TN143_20180924T122701-20180918T122541_s1-resorb-686f-v1.2.1-standard.zip" target="_blank">https://grfn.asf.alaska.edu/door/download/S1-IFG_RM_M1S2_TN143_20180924T122701-20180918T122541_s1-resorb-686f-v1.2.1-standard.zip</a></font></div></div></blockquote><div dir="ltr"><div><br></div><div>But an equivalent vsicurl command fails:</div><div><br></div></div><blockquote style="margin:0 0 0 40px;border:none;padding:0px"><div dir="ltr"><div><font face="monospace, monospace">gdalinfo --config CPL_CURL_VERBOSE YES --config CPL_VSIL_CURL_USE_HEAD NO "/vsizip/vsicurl/<a href="https://grfn.asf.alaska.edu/door/download/S1-IFG_RM_M1S2_TN143_20180924T122701-20180918T122541_s1-resorb-686f-v1.2.1-standard.zip" target="_blank">https://grfn.asf.alaska.edu/door/download/S1-IFG_RM_M1S2_TN143_20180924T122701-20180918T122541_s1-resorb-686f-v1.2.1-standard.zip</a>"</font></div></div></blockquote><div dir="ltr"><div><br></div><div>I'm effectively missing the --cookie-jar behavior.  In the attached output, curl receives a session cookie on line 167, and forwards it with the subsequent redirect on line 182 as desired.  vsicurl receives the same cookie on line 96, but does not forward it with the subsequent redirect on line 106.  This leads to an infinite redirect loop, and vsicurl eventually fails with a "Maximum (10) redirects followed" error.</div></div></div>
</div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div>Scott Arko<br>Alaska Satellite Facility Deputy Director<div>University of Alaska Fairbanks<br><br>903 Koyukuk Drive<br>Fairbanks, AK 99775<br>Phone: (907) 474 - 5570<br>email:  <a href="mailto:saarko@alaska.edu" target="_blank">saarko@alaska.edu</a><br><a href="http://www.asf.alaska.edu" target="_blank">http://www.asf.alaska.edu</a></div></div></div></div></div>