efiop: @mroutis Need to update https://dvc.org/doc/user-guide/external-dependencies as well. Could you send a patch for it please?
diff --git a/dvc/remote/http.py b/dvc/remote/http.py
index fc502fc46..1e74d6bf7 100644
--- a/dvc/remote/http.py
+++ b/dvc/remote/http.py
@@ -107,10 +107,14 @@ class RemoteHTTP(RemoteBase):
         return self._request('HEAD', url).headers.get('Content-Length')
 
     def _etag(self, url):
-        etag = self._request('HEAD', url).headers.get('ETag')
+        etag = (self._request('HEAD', url).headers.get('ETag')
+                or self._request('HEAD', url).headers.get('Content-MD5'))
 
         if not etag:
-            raise DvcException("could not find an ETag for '{}'".format(url))
+            raise DvcException(
+                "could not find an ETag or Content-MD5 header for '{url}'"
+                .format(url=url)
+            )
 
         if etag.startswith('W/'):
             raise DvcException(

http: use Content-Md5 header if available
We could use it for https://github.com/iterative/dvc/issues/1348 .
diff --git a/tests/test_repro.py b/tests/test_repro.py
index dc23db423..ff6327116 100644
--- a/tests/test_repro.py
+++ b/tests/test_repro.py
@@ -1131,6 +1131,16 @@ class TestReproExternalHTTP(TestReproExternalBase):
         self.assertTrue(os.path.exists(import_output))
         self.assertTrue(filecmp.cmp(import_output, self.FOO, shallow=False))
 
+        self.dvc.remove('imported_file.dvc')
+
+        with StaticFileServer(handler='Content-MD5'):
+            import_url = urljoin(self.remote, self.FOO)
+            import_output = 'imported_file'
+            import_stage = self.dvc.imp(import_url, import_output)
+
+        self.assertTrue(os.path.exists(import_output))
+        self.assertTrue(filecmp.cmp(import_output, self.FOO, shallow=False))
+
         # Run --deps
         with StaticFileServer():
             run_dependency = urljoin(self.remote, self.BAR)
diff --git a/tests/utils/httpd.py b/tests/utils/httpd.py
index afe6eefd5..be5c44cf0 100644
--- a/tests/utils/httpd.py
+++ b/tests/utils/httpd.py
@@ -17,12 +17,26 @@ class ETagHandler(SimpleHTTPRequestHandler):
         SimpleHTTPRequestHandler.end_headers(self)
 
 
+class ContentMD5Handler(SimpleHTTPRequestHandler):
+    def end_headers(self):
+        file = self.translate_path(self.path)
+
+        if not os.path.isdir(file) and os.path.exists(file):
+            with open(file, 'r') as fd:
+                md5 = hashlib.md5(fd.read().encode('utf8')).hexdigest()
+                self.send_header('Content-MD5', md5)
+
+        SimpleHTTPRequestHandler.end_headers(self)
+
+
 class StaticFileServer:
     __server_lock = threading.Lock()
 
-    def __init__(self):
+    def __init__(self, handler='etag'):
+        handler_class = ETagHandler if handler == 'etag' else ContentMD5Handler
+
         self.__server_lock.acquire()
-        self.httpd = HTTPServer(('localhost', 8000), ETagHandler)
+        self.httpd = HTTPServer(('localhost', 8000), handler_class)
 
     def __enter__(self):
         self.server_thread = threading.Thread(target=self.httpd.serve_forever)

pip install -e .[all]
parse_log_pytest
requirements.txt
pytest>=3.3.1 nose>=1.3.7 mock>=2.0.0 coverage>=4.5.1 codecov>=2.0.15 xmltodict>=0.11.0 awscli>=1.14.18 google-compute-engine Pygments collective.checkdocs pytest
apt-get update apt-get install -y gcc
3.7
requirements.txt
pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning
altgraph==0.17.4
appdirs==1.4.4
asciimatics==1.14.0
awscli==1.31.13
azure-common==1.1.28
azure-nspkg==3.0.2
azure-storage-blob==1.3.0
azure-storage-common==1.3.0
azure-storage-nspkg==3.1.0
bcrypt==4.2.1
boto==2.49.0
boto3==1.7.4
botocore==1.10.84
cachetools==5.5.2
certifi @ file:///croot/certifi_1671487769961/work/certifi
cffi==1.15.1
charset-normalizer==3.4.1
codecov==2.1.13
collective.checkdocs==0.2
colorama==0.4.4
configobj==5.0.9
configparser==5.3.0
coverage==7.2.7
cryptography==44.0.2
decorator==5.1.1
distro==1.9.0
docutils==0.16
-e git+https://github.com/iterative/dvc.git@423c212d3f1069a0db134f5f990fd7a254b9f7f6#egg=dvc
exceptiongroup==1.2.2
future==1.0.0
gitdb==4.0.12
GitPython==3.1.44
google-api-core==1.34.1
google-auth==2.38.0
google-cloud-core==0.28.1
google-cloud-storage==1.13.0
google-compute-engine==2.8.13
google-crc32c==1.5.0
google-resumable-media==2.7.2
googleapis-common-protos==1.69.2
grandalf==0.6
idna==3.10
importlib-metadata==6.7.0
iniconfig==2.0.0
jmespath==0.10.0
jsonpath-rw==1.4.0
macholib==1.16.3
mock==5.2.0
nanotime==0.5.2
networkx==2.6.3
nose==1.3.7
packaging==24.0
paramiko==3.5.1
pefile==2024.8.26
Pillow==9.5.0
pluggy==1.2.0
ply==3.11
protobuf==3.20.3
pyasn1==0.5.1
pyasn1-modules==0.3.0
pycparser==2.21
pydot==2.0.0
pyfiglet==0.8.post1
Pygments==2.17.2
PyInstaller==3.3.1
PyNaCl==1.5.0
pyparsing==3.1.4
pytest==7.4.4
python-dateutil==2.9.0.post0
PyYAML==6.0.1
requests==2.31.0
rsa==4.7.2
s3transfer==0.1.13
schema==0.7.7
six==1.17.0
smmap==5.0.2
tomli==2.0.1
typing_extensions==4.7.1
urllib3==1.26.20
wcwidth==0.2.13
xmltodict==0.14.2
zc.lockfile==3.0.post1
zipp==3.15.0

name: dvc
channels:
  - defaults
  - https://repo.anaconda.com/pkgs/main
  - https://repo.anaconda.com/pkgs/r
  - conda-forge
dependencies:
  - _libgcc_mutex=0.1=main
  - _openmp_mutex=5.1=1_gnu
  - ca-certificates=2025.2.25=h06a4308_0
  - certifi=2022.12.7=py37h06a4308_0
  - ld_impl_linux-64=2.40=h12ee557_0
  - libffi=3.4.4=h6a678d5_1
  - libgcc-ng=11.2.0=h1234567_1
  - libgomp=11.2.0=h1234567_1
  - libstdcxx-ng=11.2.0=h1234567_1
  - ncurses=6.4=h6a678d5_0
  - openssl=1.1.1w=h7f8727e_0
  - pip=22.3.1=py37h06a4308_0
  - python=3.7.16=h7a1cb2a_0
  - readline=8.2=h5eee18b_0
  - setuptools=65.6.3=py37h06a4308_0
  - sqlite=3.45.3=h5eee18b_0
  - tk=8.6.14=h39e8969_0
  - wheel=0.38.4=py37h06a4308_0
  - xz=5.6.4=h5eee18b_1
  - zlib=1.2.13=h5eee18b_1
  - pip:
      - altgraph==0.17.4
      - appdirs==1.4.4
      - asciimatics==1.14.0
      - awscli==1.31.13
      - azure-common==1.1.28
      - azure-nspkg==3.0.2
      - azure-storage-blob==1.3.0
      - azure-storage-common==1.3.0
      - azure-storage-nspkg==3.1.0
      - bcrypt==4.2.1
      - boto==2.49.0
      - boto3==1.7.4
      - botocore==1.10.84
      - cachetools==5.5.2
      - cffi==1.15.1
      - charset-normalizer==3.4.1
      - codecov==2.1.13
      - collective-checkdocs==0.2
      - colorama==0.4.4
      - configobj==5.0.9
      - configparser==5.3.0
      - coverage==7.2.7
      - cryptography==44.0.2
      - decorator==5.1.1
      - distro==1.9.0
      - docutils==0.16
      - exceptiongroup==1.2.2
      - future==1.0.0
      - gitdb==4.0.12
      - gitpython==3.1.44
      - google-api-core==1.34.1
      - google-auth==2.38.0
      - google-cloud-core==0.28.1
      - google-cloud-storage==1.13.0
      - google-compute-engine==2.8.13
      - google-crc32c==1.5.0
      - google-resumable-media==2.7.2
      - googleapis-common-protos==1.69.2
      - grandalf==0.6
      - idna==3.10
      - importlib-metadata==6.7.0
      - iniconfig==2.0.0
      - jmespath==0.10.0
      - jsonpath-rw==1.4.0
      - macholib==1.16.3
      - mock==5.2.0
      - nanotime==0.5.2
      - networkx==2.6.3
      - nose==1.3.7
      - packaging==24.0
      - paramiko==3.5.1
      - pefile==2024.8.26
      - pillow==9.5.0
      - pluggy==1.2.0
      - ply==3.11
      - protobuf==3.20.3
      - pyasn1==0.5.1
      - pyasn1-modules==0.3.0
      - pycparser==2.21
      - pydot==2.0.0
      - pyfiglet==0.8.post1
      - pygments==2.17.2
      - pyinstaller==3.3.1
      - pynacl==1.5.0
      - pyparsing==3.1.4
      - pytest==7.4.4
      - python-dateutil==2.9.0.post0
      - pyyaml==6.0.1
      - requests==2.31.0
      - rsa==4.7.2
      - s3transfer==0.1.13
      - schema==0.7.7
      - six==1.17.0
      - smmap==5.0.2
      - tomli==2.0.1
      - typing-extensions==4.7.1
      - urllib3==1.26.20
      - wcwidth==0.2.13
      - xmltodict==0.14.2
      - zc-lockfile==3.0.post1
      - zipp==3.15.0
prefix: /opt/conda/envs/dvc

tests/test_repro.py::TestReproExternalHTTP::test
tests/test_repro.py::TestReproMissingMd5InStageFile::test tests/test_repro.py::TestReproShell::test
tests/test_repro.py::TestReproFail::test tests/test_repro.py::TestReproCyclicGraph::test tests/test_repro.py::TestReproWorkingDirectoryAsOutput::test tests/test_repro.py::TestReproWorkingDirectoryAsOutput::test_nested tests/test_repro.py::TestReproWorkingDirectoryAsOutput::test_similar_paths tests/test_repro.py::TestReproDepUnderDir::test tests/test_repro.py::TestReproDepDirWithOutputsUnderIt::test tests/test_repro.py::TestReproNoDeps::test tests/test_repro.py::TestReproForce::test tests/test_repro.py::TestReproChangedCode::test tests/test_repro.py::TestReproChangedData::test tests/test_repro.py::TestReproDry::test tests/test_repro.py::TestReproUpToDate::test tests/test_repro.py::TestReproDryNoExec::test tests/test_repro.py::TestReproChangedDeepData::test tests/test_repro.py::TestReproIgnoreBuildCache::test tests/test_repro.py::TestReproPipeline::test tests/test_repro.py::TestReproPipeline::test_cli tests/test_repro.py::TestReproPipelines::test tests/test_repro.py::TestReproPipelines::test_cli tests/test_repro.py::TestReproLocked::test tests/test_repro.py::TestReproLocked::test_non_existing tests/test_repro.py::TestReproLockedCallback::test tests/test_repro.py::TestReproLockedUnchanged::test tests/test_repro.py::TestReproMetricsAddUnchanged::test tests/test_repro.py::TestReproPhony::test tests/test_repro.py::TestNonExistingOutput::test tests/test_repro.py::TestReproDataSource::test tests/test_repro.py::TestReproChangedDir::test tests/test_repro.py::TestReproChangedDirData::test tests/test_repro.py::TestCmdRepro::test tests/test_repro.py::TestCmdReproChdir::test tests/test_repro.py::TestReproExternalBase::test tests/test_repro.py::TestReproExternalS3::test tests/test_repro.py::TestReproExternalGS::test tests/test_repro.py::TestReproExternalHDFS::test tests/test_repro.py::TestReproExternalSSH::test tests/test_repro.py::TestReproExternalLOCAL::test tests/test_repro.py::TestReproNoSCM::test tests/test_repro.py::TestReproAllPipelines::test
dvc/remote/http.py
dvc/remote/http.py