Skip to content

Instantly share code, notes, and snippets.

View loveky's full-sized avatar
🍺
cheers

loveky loveky

🍺
cheers
View GitHub Profile
@loveky
loveky / 常用Gem列表.md
Last active December 15, 2015 12:29
常用Gem列表
@loveky
loveky / Install Ruby mysql2 gem on Windows 7.md
Last active December 15, 2015 11:29
Install Ruby mysql2 gem on Windows 7
  1. Download and install Ruby from RubyInstaller
  2. Download Development Kit and follow the installation instructions
  3. Download Mysql Connector/C and extract it into a path without spaces. For example c:\mysql-connector
  4. Run gem install mysql2 -- --with-mysql-include=c:\mysql-connector\include --with-mysql-lib=c:\mysql-connector\lib to install the gem.
  5. Copy c:\mysql-connector\lib\libmysql.dll to your Ruby bin path.
@loveky
loveky / Sinatra中request.path_info和request.script_name的区别.md
Last active July 9, 2020 07:35
Sinatra中request.path_info和request.script_name的区别

最近在看Sinatra 1.3.5的源码。在Sinatra::Helpers模块中看到一个名为uri的方法,用来将一个相对路径转换为绝对路径。在该函数的代码中看到分别针对request.script_name和request.path_info进行了处理。但是并不清楚这两个参数的区别,于是做了一些reseach。

二者在RFC3875中有如下定义:

4.1.13. SCRIPT_NAME

The SCRIPT_NAME variable MUST be set to a URI path (not URL-encoded) which could identify the CGI script (rather than the script's output). The syntax is the same as for PATH_INFO (section 4.1.5) >