我可以在 FTP URL 上发送 HTTP 标头吗? [英] Can I send HTTP headers on an FTP URL?

查看:21
本文介绍了我可以在 FTP URL 上发送 HTTP 标头吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有可能在 ftp://URL 上发送 HTTP 标头?我该怎么办?

Is there any possibility to send HTTP headers on an ftp:// URL? How would I go about it?

我想要的是基于 HTTP 的爬虫在人类用户看到纯 FTP 内容时看到 HTML 响应(在标题中).

What I want is HTTP based crawlers to see an HTML Response (in the headers) while human users see the pure FTP Content.

解决这个问题最聪明的方法是什么?我考虑过用户代理特定的重定向,但这似乎违反了大多数搜索引擎的准则.

What would be the smartest way of solving this problem? I thought about user agent specific redirection, however this seems to be against most search engine's guidelines.

我想要的是让机器人索引内容的 HTTP 版本,而普通用户可以访问 FTP 版本,同时使用单个 ftp://URL.

What I want is for bots to index an HTTP version of the content, while normal users can get access to the FTP version, all while using a single ftp:// URL.

这可行吗?

推荐答案

不可行.

您不能将 ftp:// URL 重定向到 http:// URL.FTP 协议没有重定向.FTP 协议甚至不知道 URL 是什么.Web 浏览器(充当 FTP 客户端)也不会发送用户代理"或任何类似于 FTP 服务器的东西.

You cannot redirect ftp:// URL to http:// URL. The FTP protocol has no redirects. FTP protocol does not even know what URL is. Nor does a web browser (acting as an FTP client) send "user agent" or anything similar to the FTP server.

FTP 协议中也没有标头(但这只是技术性问题,与上述事实相比).

There are also no headers in FTP protocol (but that's just a technicality, comparing to the fact above).

FTP 协议与 HTTP 完全不同.

FTP protocol is completely different to HTTP.

您显然对 Web 浏览器(所有浏览器)以与 HTTP 资源相同的方式呈现 FTP 资源感到困惑.但这只是浏览器的游戏".它们远非相似.

You are obviously confused by the web browsers (all of them) presenting an FTP resource the same way as an HTTP resource. But it's just a "game" by the browsers. They are nowhere near similar.

请注意,FTP 是在 Internet、HTTP、Web 和 URL 之前发明的.

Note that FTP was invented eons before Internet, HTTP, web and URLs.

但请注意,您也许可以反过来做.您应该能够将 HTTP 重定向到 FTP.

Though note that you may be able to do it the other way around. You should be able to redirect HTTP to FTP.

但我仍然认为这不是一个好主意.如果客户端需要 FTP,他们可能想要使用真正的 FTP 客户端,而不是 Web 浏览器.而且真正的 FTP 客户端不会理解 HTTP(重定向).

But I still do not think it's a good idea. If the clients need FTP, they probably want to use a real FTP client, not a web browser. And a real FTP client won't understand HTTP (redirects).

不过这个问题有点意思,现在各大网络浏览器都逐渐无论如何都要删除对 FTP 的支持.

But this question is kind of meaningless, now that all major web browsers are gradually removing a support for FTP anyway.

这篇关于我可以在 FTP URL 上发送 HTTP 标头吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆