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

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

问题描述

有没有可能在ftp:// URL上发送HTTP标头?



我想要的是基于HTTP的抓取工具在人类用户看到纯粹的FTP内容时看到HTML Response(在标题中)。

p>

解决这个问题最聪明的方法是什么?我想过用户代理特定的重定向,但是这似乎违背了大多数搜索引擎的指导原则。

我想要的是机器人为内容的HTTP版本编制索引,而普通用户可以访问FTP版本,所有这些都使用单个ftp:// URL。



这是可行的吗?

解决方案



您无法将 ftp:// URL重定向至 http:// URL。 FTP协议没有重定向。 FTP协议甚至不知道什么URL。 Web浏览器(充当FTP客户端)也不会发送用户代理或类似于FTP服务器的内容。



FTP协议中也没有标题(但这只是一个技术性,与上面的事实相比)。

FTP协议与HTTP完全不同。




你显然被Web浏览器(所有这些浏览器)以HTTP资源相同的方式呈现FTP资源。但这只是浏览器的游戏。他们远不及此类。



请注意,FTP是在互联网,HTTP,web 和URL 之前发明的。




虽然请注意,您也许可以通过其他方式做到这一点。您应该能够将HTTP重定向到FTP。



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


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

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.

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.

Is this doable?

解决方案

It's NOT doable.

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.

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

FTP protocol is completely different to HTTP.


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.

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


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

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 URL上发送HTTP标头吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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