Error downloading/installing git repositories from behind a firewall

I am unable to install a library at the moment, I suspect this is due to our firewall.
but manually cloning the library works fine.

Edit:more info: this error started after we migrated from bitbucket to microsoft azure devops.
also if I edit the downloader.py file to accept 203 status:

line 41:
if 300<= self._request.status_code or self._request.status_code < 200:

a new issue occurs in the unpacker.
is there a workaround for this issue?
performing git clone works flawlessly but when trying to build a project that depends on this repository it fails with:

====================[ Build | PLATFORMIO_BUILD | heltec_wifi_kit_32 ]===========
"C:\Program Files\JetBrains\CLion 2018.3.4b\bin\cmake\win\bin\cmake.exe" --build C:\Users\<user>\CLionProjects\someProject\cmake-build-heltec_wifi_kit_32 --target PLATFORMIO_BUILD -- -j 6
Processing heltec_wifi_kit_32 (platform: espressif32; board: heltec_wifi_kit_32; framework: arduino)
--------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/espressif32/heltec_wifi_kit_32.html
PLATFORM: Espressif 32 1.9.0 > Heltec WiFi Kit 32
HARDWARE: ESP32 240MHz, 320KB RAM, 4MB Flash
DEBUG: Current (esp-prog) External (esp-prog, iot-bus-jtag, jlink, minimodule, olimex-arm-usb-ocd, olimex-arm-usb-ocd-h, olimex-arm-usb-tiny-h, olimex-jtag-tiny, tumpa)
PACKAGES: toolchain-xtensa32 2.50200.80 (5.2.0), framework-arduinoespressif32 2.10002.190628 (1.0.2), tool-esptoolpy 1.20600.0 (2.6.0)
LDF: Library Dependency Finder -> http://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain+, Compatibility ~ soft
LibraryManager: Installing someLibrary
FDUnrecognizedStatusCode: Got an unrecognized status code ''203'' when downloaded https://someCompany.visualstudio.com/someProject/_git/someLibrary:
  File "C:\Users\<user>\.platformio\penv\lib\site-packages\platformio\builder\main.py", line 126:
    env.SConscript("$BUILD_SCRIPT")
  File "C:\Users\<user>\.platformio\packages\tool-scons\script\..\engine\SCons\Script\SConscript.py", line 605:
    return _SConscript(self.fs, *files, **subst_kw)
  File "C:\Users\<user>\.platformio\packages\tool-scons\script\..\engine\SCons\Script\SConscript.py", line 286:
    exec(compile(scriptdata, scriptname, ''exec''), call_stack[-1].globals)
  File "C:\Users\<user>\.platformio\platforms\espressif32\builder\main.py", line 209:
    target_elf = env.BuildProgram()
  File "C:\Users\<user>\.platformio\packages\tool-scons\script\..\engine\SCons\Environment.py", line 224:
    return self.method(*nargs, **kwargs)
  File "C:\Users\<user>\.platformio\penv\lib\site-packages\platformio\builder\tools\platformio.py", line 122:
    _build_project_deps(env)
  File "C:\Users\<user>\.platformio\penv\lib\site-packages\platformio\builder\tools\platformio.py", line 47:
    project_lib_builder = env.ConfigureProjectLibBuilder()
  File "C:\Users\<user>\.platformio\packages\tool-scons\script\..\engine\SCons\Environment.py", line 224:
    return self.method(*nargs, **kwargs)
  File "C:\Users\<user>\.platformio\penv\lib\site-packages\platformio\builder\tools\piolib.py", line 1043:
    project.install_dependencies()
  File "C:\Users\<user>\.platformio\penv\lib\site-packages\platformio\builder\tools\piolib.py", line 878:
    lm.install(uri)
  File "c:\users\<user>\.platformio\penv\lib\site-packages\platformio\managers\lib.py", line 359:
    force=force)
  File "c:\users\<user>\.platformio\penv\lib\site-packages\platformio\managers\package.py", line 701:
    track=True)
  File "c:\users\<user>\.platformio\penv\lib\site-packages\platformio\managers\package.py", line 481:
    dlpath = self.download(url, tmp_dir, sha1)
  File "c:\users\<user>\.platformio\penv\lib\site-packages\platformio\managers\package.py", line 178:
    fd = FileDownloader(url, dest_dir)
  File "c:\users\<user>\.platformio\penv\lib\site-packages\platformio\downloader.py", line 42:
    raise FDUnrecognizedStatusCode(self._request.status_code, url)
========================== [FAILED] Took 1.94 seconds ==========================
mingw32-make.exe[3]: *** [CMakeFiles/PLATFORMIO_BUILD] Error 1
CMakeFiles\PLATFORMIO_BUILD.dir\build.make:56: recipe for target ''CMakeFiles/PLATFORMIO_BUILD'' failed
CMakeFiles\Makefile2:108: recipe for target ''CMakeFiles/PLATFORMIO_BUILD.dir/all'' failed
mingw32-make.exe[2]: *** [CMakeFiles/PLATFORMIO_BUILD.dir/all] Error 2
CMakeFiles\Makefile2:120: recipe for target ''CMakeFiles/PLATFORMIO_BUILD.dir/rule'' failed
mingw32-make.exe[1]: *** [CMakeFiles/PLATFORMIO_BUILD.dir/rule] Error 2
Makefile:130: recipe for target ''PLATFORMIO_BUILD'' failed
mingw32-make.exe: *** [PLATFORMIO_BUILD] Error 2

Has anyone managed to fix/workaround this?

I need to use Azure Devops Repos for storing custom dependencies, but it does not work, as LDF seems to not handle HTTP 203s properly (like Tirpitz describes)

Any hints would be greatly appreciated :slight_smile:

I see no open issue about it.

https://github.com/search?q=repo%3Aplatformio%2Fplatformio-core+FDUnrecognizedStatusCode&type=issues

Can you get the ball rolling on this one by creating an issue and providing an example?

I’m sure we can get this fixed.

Also see

Hey Max, thank you for looking into this.

I made a public test library at: https://dev.azure.com/biggunbenny/_git/pio-ldf-test and tried to get LDF to fetch it through https. Then I changed download.py the same as with your pull request, but unfortunately it seems that Azure just sends some kind of “login page”, which platformio then tries to parse as a zip file:

In the end, I solved this by using SSH (git+ssh://) instead of https as the protocol and setting up public/private key access in Azure. This works like a perfectly. I realize that this does not bring you closer to any solution this problem, but I included this for others to reference, in case they run into the same issue

Thanks again! Your work on PIO is very appreciated!

Ouch. Then the whole PR was wrong?

I would say that “Incomplete” is more accurate than “Wrong” :slight_smile:

I believe the change to accept HTTP status 203 is correct, but it will not solve the issue on its own, unfortunately.