Xff和Refer

X-Forwarded-For


是一个 HTTP 扩展头部,主要是为了让 Web 服务器获取访问用户的真实 IP 地址。在代理转发及反向代理中经常使用X-Forwarded-For 字段。
是用来识别通过HTTP代理或负载均衡方式连接到Web服务器的客户端最原始的IP地址的HTTP请求头字段。简单地说,xff是告诉服务器当前请求者的最终ip的http请求头字段,通常可以直接通过修改http头中的X-Forwarded-For字段来仿造请求的最终ip
https://www.cnblogs.com/huaxingtianxia/p/6369089.html


正向代理

正向代理是一个位于客户端【用户A】和原始服务器(origin server)【服务器B】之间的服务器【代理服务器Z】,为了从原始服务器取得内容,用户A向代理服务器Z发送一个请求并指定目标(服务器B),然后代理服务器Z向服务器B转交请求并将获得的内容返回给客户端。

作用:

1. 访问本无法访问的服务器B

2.加速访问服务器B

3.Cache作用

4.客户端访问授权

5.隐藏访问者的行踪

反向代理

反向代理正好与正向代理相反,对于客户端而言代理服务器就像是原始服务器,并且客户端不需要进行任何特别的设置。客户端向反向代理的命名空间(name-space)中的内容发送普通请求,接着反向代理将判断向何处(原始服务器)转交请求,并将获得的内容返回给客户端。

作用:

1、保护和隐藏原始资源服务器

2、负载均衡

透明代理

透明代理的意思是客户端根本不需要知道有代理服务器的存在,它改编你的request fields(报文),并会传送真实IP。注意,加密的透明代理则是属于匿名代理,意思是不用设置使用代理了。

https://blog.youkuaiyun.com/championhengyi/article/details/80671517

Referer


Referer 是 HTTP 请求header 的一部分,当浏览器(或者模拟浏览器行为)向web 服务器发送请求的时候,头信息里有包含 Referer 。比如我在www.sojson.com 里有一个www.baidu.com 链接,那么点击这个www.baidu.com ,它的header 信息里就有:

Referer=https://www.sojson.com

由此可以看出来吧。它就是表示一个来源。看下图的一个请求的 Referer 信息。

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-rCO6UgwS-1647931039394)(https://cdn.yinshua86.com/file/16-01-23-02-49-30/doc/6023914857.jpg)]

这里有一个小问题要说明下。
Referer 的正确英语拼法是referrer 。由于早期HTTP规范的拼写错误,为了保持向后兼容就将错就错了。其它网络技术的规范企图修正此问题,使用正确拼法,所以目前拼法不统一。还有它第一个字母是大写。

Referer的作用
1.防盗链。

我在www.sojson.com里有一个www.baidu.com链接,那么点击这个www.baidu.com,它的header信息里就有:

Referer=https://www.sojson.com

那么可以利用这个来防止盗链了,比如我只允许我自己的网站访问我自己的图片服务器,那我的域名是www.sojson.com,那么图片服务器每次取到Referer来判断一下是不是我自己的域名www.sojson.com,如果是就继续访问,不是就拦截。

这是不是就达到防盗链的效果了?

2.防止恶意请求。

比如我的SOJSON网站上,静态请求是*.html结尾的,动态请求是*.shtml,那么由此可以这么用,所有的*.shtml请求,必须 Referer 为我自己的网站。

Referer=https://www.sojson.com

空Referer是怎么回事?什么情况下会出现Referer?
首先,我们对空 Referer 的定义为, Referer 头部的内容为空,或者,一个 HTTP 请求中根本不包含 Referer 头部。

那么什么时候 HTTP 请求会不包含 Referer 字段呢?根据Referer的定义,它的作用是指示一个请求是从哪里链接过来,那么当一个请求并不是由链接触发产生的,那么自然也就不需要指定这个请求的链接来源。

比如,直接在浏览器的地址栏中输入一个资源的URL地址,那么这种请求是不会包含 Referer 字段的,因为这是一个“凭空产生”的 HTTP 请求,并不是从一个地方链接过去的。

那么在防盗链设置中,允许空Referer和不允许空Referer有什么区别?
允许 Referer 为空,意味着你允许比如浏览器直接访问,就是空。

如下图:

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-wvS7l4lz-1647931039394)(https://cdn.yinshua86.com/file/16-01-23-02-54-09/doc/6753290148.jpg)]

这就是空的 Referer 。

拒绝空的 Referer 。比如我的www.sojson.com的静态资源都是拒绝空的Referer 的。如下图,我访问我的一个图片。

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-qT1m2q0U-1647931039395)(https://cdn.yinshua86.com/file/16-01-23-02-57-10/doc/3910657428.jpg)]

看到了吧,直接拒绝访问了,如果有同学在测试我网站的静态资源的时候,记住强制刷新Ctrl + F5 ,因为浏览器有缓存,可能你开始还是可以访问的。

当然。这个你不能完全依赖 Referer 来做一些事情,因为这个最容易伪造来源。
 

### QSPI Flash Write Operation Example and Guide For performing a QSPI (Quad Serial Peripheral Interface) flash write operation, understanding the interface's configuration and command sequences is essential. Typically, devices supporting QSPI provide specific commands for writing data to the memory device. These operations often require setting up the controller properly before issuing any write instructions. The process involves configuring the QSPI module on the microcontroller or processor used in the system. Configuration parameters include clock speed settings, ensuring it matches what the external QSPI flash supports without exceeding its maximum frequency rating[^1]. Once configured correctly, one must prepare the address where data will be written within the flash memory space along with the actual payload of bytes intended for storage. Here’s an illustrative code snippet demonstrating how this might look using C language: ```c #include "qspi_driver.h" void qspi_flash_write(uint32_t addr, uint8_t *data, size_t length){ // Ensure no ongoing transactions. while(QSPI_IsBusy()); // Send Write Enable instruction. QSPI_SendCommand(WRITE_ENABLE); // Wait until not busy anymore after enabling writes. while(QSPI_IsBusy()); // Prepare buffer containing opcode followed by target address & data. uint8_t cmdBuffer[] = {PAGE_PROGRAM_CMD, (uint8_t)((addr >> 16) & 0xFF), (uint8_t)((addr >> 8) & 0xFF), (uint8_t)(addr & 0xFF)}; memcpy(&cmdBuffer[4], data, length); // Execute page program sequence. QSPI_Transmit(cmdBuffer, sizeof(cmdBuffer)); // Poll status register until ready again post-write. while(QSPI_ReadStatus() & STATUS_WIP); } ``` This function assumes existence of certain helper functions like `QSPI_IsBusy`, which checks whether the hardware is currently processing another transaction; `QSPI_SendCommand` sends control codes over the bus; and finally, `QSPI_Transmit` transmits both commands and associated data blocks through the serial link established between master and slave components connected via QSPI lines. In addition to these software-level considerations, physical connections play a critical role too. For instance, when working with development boards based around processors such as those mentioned in documentation about Cyclone V SoC architecture combining ARM cores alongside FPGA fabric, developers should refer closely to provided schematics regarding pin assignments related specifically to QSPI interfaces[^2]. Moreover, detailed guides tailored towards bringing up custom evaluation platforms equipped with Texas Instruments' TDA4VM series chips also offer valuable insights into best practices concerning initialization routines necessary prior executing low-level I/O procedures involving non-volatile memories interfaced through quad SPI buses[^3].
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值