小编kla*_*usi的帖子

为什么Firefox不总是为POST请求发送HTTP Origin头?

我正在探索HTTP Origin检查作为Drupal的CSRF保护的想法,网址https://www.drupal.org/node/1803712

现在我正在测试Origin标头如何通过POST请求到达,但Firefox不会在用户登录表单提交上发送Origin标头.Chromium和Chrome工作正常,他们发送Origin标头.

Firefox版本是36.0.1.我还测试了一个干净的Firefox安装,因为我想我的某些浏览器插件可能会抑制Origin标头,但没有运气 - 也没有Origin标头.

是否有文档页面描述Firefox何时发送Origin标头,何时不?

firefox http

15
推荐指数
1
解决办法
3097
查看次数

如何强制 git apply 覆盖未跟踪的文件?

我有一个应用补丁的脚本,有时它会因任何原因而失败(在我的情况下是文件权限)。我想在解决问题后再次运行脚本,但是可能会有上次 git apply 尝试的剩余文件。

我不想运行git clean,这会丢掉我想保留的其他文件。我只想替换那些受补丁影响的未跟踪文件。

我的脚本:

for SITE in $SITES
do
  echo "Updating $SITE ..."
  cd /home/klausi/web/$SITE
  chmod u+w sites/default
  git fetch
  git reset --hard origin/master
  git apply --index /home/klausi/web/7.33.patch
  git commit -m "Updated Drupal core to 7.33."
  git push
done
Run Code Online (Sandbox Code Playgroud)

当我再次运行时,我得到:

error: misc/throbber-active.gif: already exists in working directory
error: misc/throbber-inactive.png: already exists in working directory
error: modules/simpletest/tests/themes/test_theme/templates/node--1.tpl.php: already exists in working directory
Run Code Online (Sandbox Code Playgroud)

所以类似的东西git apply --force会很好。

git

5
推荐指数
1
解决办法
4968
查看次数

如何从文件或 URL 创建 Rust Quick XML 阅读器?

我有使用quick_xml库的以下代码:

use quick_xml::Reader;
use std::io::BufRead;
use std::path::Path;
use std::io::BufReader;

/// Returns an XML stream either from a file or a URL.
fn get_xml_stream(source: &str) -> Result<Reader<impl BufRead>, Error> {
    let local_path = Path::new(source);

    // Try to read a local file first.
    if local_path.is_file() {
        let reader =
            Reader::from_file(source).context(format!("couldn't read file {:?}", source))?;
        return Ok(reader);
    }
    // Try to fetch a remote file.
    let response = reqwest::get(source).context(format!(
        "File not found and failed fetching from remote URL {}",
        source
    ))?;
    if !response.status().is_success() …
Run Code Online (Sandbox Code Playgroud)

rust

5
推荐指数
1
解决办法
2130
查看次数

标签 统计

firefox ×1

git ×1

http ×1

rust ×1