GithubHelp home page GithubHelp logo

http's People

Contributors

janhuang avatar longxinh avatar runnerlee avatar xsharp avatar yyz26371945 avatar zqhong avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

http's Issues

withExpires 方法修改建议

https://github.com/JanHuang/http/blob/a1a3f0a6629f8972308bb27b2b00f44fdfe727cc/src/Response.php#L428

这里加上 Cache-Control: max-age=<seconds> 会好一些。原因:

  • Expires 的话,可能存在客户端和服务端时间不一致,导致缓存失效的情况。
  • 如果 Cache-Control header 存在 "max-age" 或 "s-max-age" 指令时,Expires 头部会被忽略。
  • 最后,Cache-Control 出来的目的,就是取代 Expires 的。Expires 是从 HTTP 1.0 开始定义的,使用它更多是在兼容性方面考虑。

SwooleServerRequest构造ServerRequest出错

更新了最新版http组件后,发现swoole模式下报错,发现是ServerRequest的构造函数第3个参数接收一个array类型,但是现在传递的request为一个object,因此报错
image
之前这个没问题是因为header就是一个array,但是现在改了之后变成了一个object

ServerRequest::createUriFromGlobal() 拼接 URI 时建议优先取 HTTP_HOST,而非 SERVER_NAME

如题。
优先取 SERVER_NAME 可能有什么问题?
比如 nginx 中设置站点为:
server_name ~^(?<subdomain>.+).yourname.com$;
那么拼接的 URI 可能是这样的:
http://~^(?<subdomain>.+).yourname.com$/abc,这样的 URI 不能被正确路由。

更多关于 SERVER_NAMEHTTP_HOST 区别:
https://stackoverflow.com/questions/2297403/what-is-the-difference-between-http-host-and-server-name-in-php

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.