Skip to content

Commit 52a8893

Browse files
authored
Update to use https for http file system test also registers https file system (#1357)
* Update to use https for http file system test also registers https file system The http test is failing as apache switched to use https for license page. This PR makes adjustment to fix the issue. Signed-off-by: Yong Tang <[email protected]> * Update README.md to use https Signed-off-by: Yong Tang <[email protected]>
1 parent 13d7bd3 commit 52a8893

File tree

3 files changed

+15
-14
lines changed

3 files changed

+15
-14
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import tensorflow as tf
2424
import tensorflow_io as tfio
2525

2626
# Read the MNIST data into the IODataset.
27-
dataset_url = "http://storage.googleapis.com/cvdf-datasets/mnist/"
27+
dataset_url = "https://storage.googleapis.com/cvdf-datasets/mnist/"
2828
d_train = tfio.IODataset.from_mnist(
2929
dataset_url + "train-images-idx3-ubyte.gz",
3030
dataset_url + "train-labels-idx1-ubyte.gz",
@@ -60,7 +60,7 @@ model.fit(d_train, epochs=5, steps_per_epoch=200)
6060

6161
In the above [MNIST](http://yann.lecun.com/exdb/mnist/) example, the URL's
6262
to access the dataset files are passed directly to the `tfio.IODataset.from_mnist` API call.
63-
This is due to the inherent support that `tensorflow-io` provides for the `HTTP` file system,
63+
This is due to the inherent support that `tensorflow-io` provides for `HTTP`/`HTTPS` file system,
6464
thus eliminating the need for downloading and saving datasets on a local directory.
6565

6666
NOTE: Since `tensorflow-io` is able to detect and uncompress the MNIST dataset automatically if needed,

tensorflow_io/core/plugins/file_system_plugins.cc

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -23,24 +23,25 @@ void TF_InitPlugin(TF_FilesystemPluginInfo* info) {
2323

2424
info->plugin_memory_allocate = tensorflow::io::plugin_memory_allocate;
2525
info->plugin_memory_free = tensorflow::io::plugin_memory_free;
26-
info->num_schemes = 7;
26+
info->num_schemes = 8;
2727
info->ops = static_cast<TF_FilesystemPluginOps*>(
2828
tensorflow::io::plugin_memory_allocate(info->num_schemes *
2929
sizeof(info->ops[0])));
3030
tensorflow::io::az::ProvideFilesystemSupportFor(&info->ops[0], "az");
3131
tensorflow::io::http::ProvideFilesystemSupportFor(&info->ops[1], "http");
32+
tensorflow::io::http::ProvideFilesystemSupportFor(&info->ops[2], "https");
3233
// Load plugins only when the environment variable is set
3334
if (load_plugin == "true" || load_plugin == "1") {
34-
tensorflow::io::s3::ProvideFilesystemSupportFor(&info->ops[2], "s3");
35-
tensorflow::io::hdfs::ProvideFilesystemSupportFor(&info->ops[3], "hdfs");
36-
tensorflow::io::hdfs::ProvideFilesystemSupportFor(&info->ops[4], "viewfs");
37-
tensorflow::io::hdfs::ProvideFilesystemSupportFor(&info->ops[5], "har");
38-
tensorflow::io::gs::ProvideFilesystemSupportFor(&info->ops[6], "gs");
35+
tensorflow::io::s3::ProvideFilesystemSupportFor(&info->ops[3], "s3");
36+
tensorflow::io::hdfs::ProvideFilesystemSupportFor(&info->ops[4], "hdfs");
37+
tensorflow::io::hdfs::ProvideFilesystemSupportFor(&info->ops[5], "viewfs");
38+
tensorflow::io::hdfs::ProvideFilesystemSupportFor(&info->ops[6], "har");
39+
tensorflow::io::gs::ProvideFilesystemSupportFor(&info->ops[7], "gs");
3940
} else {
40-
tensorflow::io::s3::ProvideFilesystemSupportFor(&info->ops[2], "s3e");
41-
tensorflow::io::hdfs::ProvideFilesystemSupportFor(&info->ops[3], "hdfse");
42-
tensorflow::io::hdfs::ProvideFilesystemSupportFor(&info->ops[4], "viewfse");
43-
tensorflow::io::hdfs::ProvideFilesystemSupportFor(&info->ops[5], "hare");
44-
tensorflow::io::gs::ProvideFilesystemSupportFor(&info->ops[6], "gse");
41+
tensorflow::io::s3::ProvideFilesystemSupportFor(&info->ops[3], "s3e");
42+
tensorflow::io::hdfs::ProvideFilesystemSupportFor(&info->ops[4], "hdfse");
43+
tensorflow::io::hdfs::ProvideFilesystemSupportFor(&info->ops[5], "viewfse");
44+
tensorflow::io::hdfs::ProvideFilesystemSupportFor(&info->ops[6], "hare");
45+
tensorflow::io::gs::ProvideFilesystemSupportFor(&info->ops[7], "gse");
4546
}
4647
}

tests/test_http.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ def __init__(self, methodName="runTest"): # pylint: disable=invalid-name
2828
self.local_path = os.path.join(
2929
os.path.dirname(os.path.abspath(__file__)), "test_http", "LICENSE-2.0.txt"
3030
)
31-
self.remote_filename = "http://www.apache.org/licenses/LICENSE-2.0.txt"
31+
self.remote_filename = "https://www.apache.org/licenses/LICENSE-2.0.txt"
3232
super().__init__(methodName)
3333

3434
def setUp(self): # pylint: disable=invalid-name

0 commit comments

Comments
 (0)