관리-도구
편집 파일: M000327.html
<?xml version="1.0" encoding="iso-8859-1"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <title>POST (Rack::Request)</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" /> </head> <body class="standalone-code"> <pre><span class="ruby-comment cmt"># File lib/rack/request.rb, line 201</span> <span class="ruby-keyword kw">def</span> <span class="ruby-constant">POST</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@env</span>[<span class="ruby-value str">"rack.input"</span>].<span class="ruby-identifier">nil?</span> <span class="ruby-identifier">raise</span> <span class="ruby-value str">"Missing rack.input"</span> <span class="ruby-keyword kw">elsif</span> <span class="ruby-ivar">@env</span>[<span class="ruby-value str">"rack.request.form_input"</span>].<span class="ruby-identifier">equal?</span> <span class="ruby-ivar">@env</span>[<span class="ruby-value str">"rack.input"</span>] <span class="ruby-ivar">@env</span>[<span class="ruby-value str">"rack.request.form_hash"</span>] <span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">form_data?</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">parseable_data?</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-ivar">@env</span>[<span class="ruby-value str">"rack.request.form_hash"</span>] = <span class="ruby-identifier">parse_multipart</span>(<span class="ruby-identifier">env</span>) <span class="ruby-identifier">form_vars</span> = <span class="ruby-ivar">@env</span>[<span class="ruby-value str">"rack.input"</span>].<span class="ruby-identifier">read</span> <span class="ruby-comment cmt"># Fix for Safari Ajax postings that always append \0</span> <span class="ruby-comment cmt"># form_vars.sub!(/\0\z/, '') # performance replacement:</span> <span class="ruby-identifier">form_vars</span>.<span class="ruby-identifier">slice!</span>(<span class="ruby-value">-1</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">form_vars</span>[<span class="ruby-value">-1</span>] <span class="ruby-operator">==</span> <span class="ruby-value">?\0</span> <span class="ruby-ivar">@env</span>[<span class="ruby-value str">"rack.request.form_vars"</span>] = <span class="ruby-identifier">form_vars</span> <span class="ruby-ivar">@env</span>[<span class="ruby-value str">"rack.request.form_hash"</span>] = <span class="ruby-identifier">parse_query</span>(<span class="ruby-identifier">form_vars</span>) <span class="ruby-ivar">@env</span>[<span class="ruby-value str">"rack.input"</span>].<span class="ruby-identifier">rewind</span> <span class="ruby-keyword kw">end</span> <span class="ruby-ivar">@env</span>[<span class="ruby-value str">"rack.request.form_input"</span>] = <span class="ruby-ivar">@env</span>[<span class="ruby-value str">"rack.input"</span>] <span class="ruby-ivar">@env</span>[<span class="ruby-value str">"rack.request.form_hash"</span>] <span class="ruby-keyword kw">else</span> {} <span class="ruby-keyword kw">end</span> <span class="ruby-keyword kw">end</span></pre> </body> </html>