Sha256: 23b4b5391b8147af6461ffb2bf798ac3dcd9819cebc20b50db36c348a77132d2

Contents?: true

Size: 1.49 KB

Versions: 17

Compression:

Stored size: 1.49 KB

Contents

<?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>execute (Mongrel::HttpParser)</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>/**
 * call-seq:
 *    parser.execute(req_hash, data) -&gt; Integer
 *
 * Takes a Hash and a String of data, parses the String of data filling in the Hash
 * returning an Integer to indicate how much of the data has been read.  No matter
 * what the return value, you should call HttpParser#finished? and HttpParser#error?
 * to figure out if it's done parsing or there was an error.
 * 
 * This function now throws an exception when there is a parsing error.  This makes 
 * the logic for working with the parser much easier.  You can still test for an 
 * error, but now you need to wrap the parser with an exception handling block.
 */
VALUE HttpParser_execute(VALUE self, VALUE req_hash, VALUE data)
{
  http_parser *http = NULL;
  DATA_GET(self, http_parser, http);

  http-&gt;data = (void *)req_hash;
  http_parser_execute(http, RSTRING(data)-&gt;ptr, RSTRING(data)-&gt;len);

  if(http_parser_has_error(http)) {
    rb_raise(rb_eStandardError, &quot;HTTP Parsing failure&quot;);
  } else {
    return INT2FIX(http_parser_nread(http));
  }
}</pre>
</body>
</html>

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
mongrel-0.2.2 doc/rdoc/classes/Mongrel/HttpParser.src/M000004.html
mongrel-0.2.1 doc/rdoc/classes/Mongrel/HttpParser.src/M000004.html
mongrel-0.2.0 doc/rdoc/classes/Mongrel/HttpParser.src/M000004.html
mongrel-0.3.1 doc/rdoc/classes/Mongrel/HttpParser.src/M000019.html
mongrel-0.3.10.1 doc/rdoc/classes/Mongrel/HttpParser.src/M000025.html
mongrel-0.3.10 doc/rdoc/classes/Mongrel/HttpParser.src/M000025.html
mongrel-0.3.12 doc/rdoc/classes/Mongrel/HttpParser.src/M000054.html
mongrel-0.3.7 doc/rdoc/classes/Mongrel/HttpParser.src/M000004.html
mongrel-0.3.5 doc/rdoc/classes/Mongrel/HttpParser.src/M000018.html
mongrel-0.3.6 doc/rdoc/classes/Mongrel/HttpParser.src/M000018.html
mongrel-0.3.8 doc/rdoc/classes/Mongrel/HttpParser.src/M000004.html
mongrel-0.3.3 doc/rdoc/classes/Mongrel/HttpParser.src/M000018.html
mongrel-0.3.4 doc/rdoc/classes/Mongrel/HttpParser.src/M000018.html
mongrel-0.3.7.1 doc/rdoc/classes/Mongrel/HttpParser.src/M000004.html
mongrel-0.3.2 doc/rdoc/classes/Mongrel/HttpParser.src/M000018.html
mongrel-0.3 doc/rdoc/classes/Mongrel/HttpParser.src/M000005.html
mongrel-0.3.9 doc/rdoc/classes/Mongrel/HttpParser.src/M000019.html