Re: Mongrel HTTP Library 0.2.0 (Fast And RubyForgified)

Seem to have a slight problem with the mongrel gem, unless I’m using the
custom require supplied by rubygems, I can’t get the gem to work.

The following:

p require ‘rubygems’
p require_gem ‘mongrel’
p Mongrel

gives me:

true
true
-:3: uninitialized constant Mongrel (NameError)

The following, however, works:

p require ‘ubygems’
p require ‘mongrel’
p Mongrel

Odd, not quite sure what would cause that. Can you try the soon to
be announce 0.2.1 release and let me know if you get the same problems?

Zed A. Shaw

You’re missing the fix posted just today. I’ll have a 0.2.2 out that
should fix this later tonight. Basically, try adding:

#if defined(_WIN32)
#include <stddef.h>
#endif

To the top of http_parser.h just after the sys/types.h include.

Let me know if that works.

Zed A. Shaw

I know Windows is evil, but I thought I’d paste in my log again, just
in case it becomes handy.

Ruby O.Click 1.8.2-15 install, Visual Studio 2K3

-I./…/missing -c -Tchttp11_parser.c
http11_parser.c
e:\Temp\mongrel-0.2.1\ext\http11\http11_parser.h(6) : error C2146: syntax
error
: missing ‘)’ before identifier ‘length’

I know Windows is evil, but I thought I’d paste in my log again, just
in case it becomes handy.

Ruby O.Click 1.8.2-15 install, Visual Studio 2K3
Unpack tar.gz, run ‘vsvars32’ to set up the Visual C++ environment.
I then modified the extconf.rb file to look for “libc.lib”, instead of
“c.lib”, since this looked like the Visual Studio equivalent, and
added a dir_config to let it find ruby.h and whatnot.
Without that it doesn’t link the library in during the mkmf step, or
find the headers during compilation.
(Just in case it sounds like I’m decent at compiling C extensions,
don’t be deceived. I actually suck at it.)
E:\Temp\mongrel-0.2.1>rake compile
(in E:/Temp/mongrel-0.2.1)
c:/ruby/bin/ruby extconf.rb
–with-ruby-include=e:/projects/ruby_src/ruby
–with-ruby-lib=e:/projects/ruby_src/ruby/lib
checking for main() in libc.lib… yes
creating Makefile
make

Microsoft ® Program Maintenance Utility Version 7.10.3077
Copyright © Microsoft Corporation. All rights reserved.

    cl -nologo -MD -Zi -O2b2xg- -G6 -I. 

-Ic:/ruby/lib/ruby/1.8/i386-mswin32
-Ic:/ruby/lib/ruby/1.8/i386-mswin32 -I. -Ie:/projects/ruby_src/ruby -I.
-I./…
-I./…/missing -c -Tchttp11_parser.c
http11_parser.c
e:\Temp\mongrel-0.2.1\ext\http11\http11_parser.h(6) : error C2146:
syntax error
: missing ‘)’ before identifier ‘length’
e:\Temp\mongrel-0.2.1\ext\http11\http11_parser.h(6) : error C2144:
syntax error
: ‘’ should be preceded by ‘’
e:\Temp\mongrel-0.2.1\ext\http11\http11_parser.h(6) : error C2144:
syntax error
: ‘’ should be preceded by ‘’
e:\Temp\mongrel-0.2.1\ext\http11\http11_parser.h(6) : error C2143:
syntax error
: missing ‘)’ before ‘identifier’
e:\Temp\mongrel-0.2.1\ext\http11\http11_parser.h(6) : error C2081:
‘size_t’ : na
me in formal parameter list illegal
e:\Temp\mongrel-0.2.1\ext\http11\http11_parser.h(6) : error C2061:
syntax error
: identifier ‘length’
e:\Temp\mongrel-0.2.1\ext\http11\http11_parser.h(6) : error C2059:
syntax error
: ‘;’
e:\Temp\mongrel-0.2.1\ext\http11\http11_parser.h(6) : error C2059:
syntax error
: ‘)’
e:\Temp\mongrel-0.2.1\ext\http11\http11_parser.h(7) : error C2146:
syntax error
: missing ‘)’ before identifier ‘flen’
e:\Temp\mongrel-0.2.1\ext\http11\http11_parser.h(7) : error C2144:
syntax error
: ‘’ should be preceded by ‘’
e:\Temp\mongrel-0.2.1\ext\http11\http11_parser.h(7) : error C2144:
syntax error
: ‘’ should be preceded by ‘’
e:\Temp\mongrel-0.2.1\ext\http11\http11_parser.h(7) : error C2143:
syntax error
: missing ‘)’ before ‘identifier’
e:\Temp\mongrel-0.2.1\ext\http11\http11_parser.h(7) : error C2081:
‘size_t’ : na
me in formal parameter list illegal
e:\Temp\mongrel-0.2.1\ext\http11\http11_parser.h(7) : error C2061:
syntax error
: identifier ‘flen’
e:\Temp\mongrel-0.2.1\ext\http11\http11_parser.h(7) : error C2059:
syntax error
: ‘;’
e:\Temp\mongrel-0.2.1\ext\http11\http11_parser.h(7) : error C2059:
syntax error
: ‘,’
e:\Temp\mongrel-0.2.1\ext\http11\http11_parser.h(7) : error C2059:
syntax error
: ‘)’
e:\Temp\mongrel-0.2.1\ext\http11\http11_parser.h(13) : error C2061:
syntax error
: identifier ‘size_t’
e:\Temp\mongrel-0.2.1\ext\http11\http11_parser.h(16) : error C2061:
syntax error
: identifier ‘field_len’
e:\Temp\mongrel-0.2.1\ext\http11\http11_parser.h(16) : error C2059:
syntax error
: ‘;’
e:\Temp\mongrel-0.2.1\ext\http11\http11_parser.h(20) : error C2061:
syntax error
: identifier ‘http_field’
e:\Temp\mongrel-0.2.1\ext\http11\http11_parser.h(20) : error C2059:
syntax error
: ‘;’
e:\Temp\mongrel-0.2.1\ext\http11\http11_parser.h(21) : error C2061:
syntax error
: identifier ‘request_method’
e:\Temp\mongrel-0.2.1\ext\http11\http11_parser.h(21) : error C2059:
syntax error
: ‘;’
e:\Temp\mongrel-0.2.1\ext\http11\http11_parser.h(22) : error C2061:
syntax error
: identifier ‘path_info’
e:\Temp\mongrel-0.2.1\ext\http11\http11_parser.h(22) : error C2059:
syntax error
: ‘;’
e:\Temp\mongrel-0.2.1\ext\http11\http11_parser.h(23) : error C2061:
syntax error
: identifier ‘query_string’
e:\Temp\mongrel-0.2.1\ext\http11\http11_parser.h(23) : error C2059:
syntax error
: ‘;’
e:\Temp\mongrel-0.2.1\ext\http11\http11_parser.h(24) : error C2061:
syntax error
: identifier ‘http_version’
e:\Temp\mongrel-0.2.1\ext\http11\http11_parser.h(24) : error C2059:
syntax error
: ‘;’
e:\Temp\mongrel-0.2.1\ext\http11\http11_parser.h(26) : error C2059:
syntax error
: ‘}’
e:\Temp\mongrel-0.2.1\ext\http11\http11_parser.h(28) : error C2143:
syntax error
: missing ‘)’ before ‘
e:\Temp\mongrel-0.2.1\ext\http11\http11_parser.h(28) : error C2143:
syntax error
: missing ‘{’ before '

e:\Temp\mongrel-0.2.1\ext\http11\http11_parser.h(28) : error C2059:
syntax error
: ‘)’
e:\Temp\mongrel-0.2.1\ext\http11\http11_parser.h(29) : error C2143:
syntax error
: missing ‘)’ before ‘
e:\Temp\mongrel-0.2.1\ext\http11\http11_parser.h(29) : error C2143:
syntax error
: missing ‘{’ before '

e:\Temp\mongrel-0.2.1\ext\http11\http11_parser.h(29) : error C2059:
syntax error
: ‘)’
e:\Temp\mongrel-0.2.1\ext\http11\http11_parser.h(30) : error C2061:
syntax error
: identifier ‘http_parser_execute’
e:\Temp\mongrel-0.2.1\ext\http11\http11_parser.h(30) : error C2059:
syntax error
: ‘;’
e:\Temp\mongrel-0.2.1\ext\http11\http11_parser.h(30) : error C2143:
syntax error
: missing ‘)’ before ‘
e:\Temp\mongrel-0.2.1\ext\http11\http11_parser.h(30) : error C2143:
syntax error
: missing ‘{’ before '

e:\Temp\mongrel-0.2.1\ext\http11\http11_parser.h(30) : error C2059:
syntax error
: ‘type’
e:\Temp\mongrel-0.2.1\ext\http11\http11_parser.h(30) : error C2059:
syntax error
: ‘)’
e:\Temp\mongrel-0.2.1\ext\http11\http11_parser.h(31) : error C2143:
syntax error
: missing ‘)’ before ‘
e:\Temp\mongrel-0.2.1\ext\http11\http11_parser.h(31) : error C2143:
syntax error
: missing ‘{’ before '

e:\Temp\mongrel-0.2.1\ext\http11\http11_parser.h(31) : error C2059:
syntax error
: ‘)’
e:\Temp\mongrel-0.2.1\ext\http11\http11_parser.h(32) : error C2143:
syntax error
: missing ‘)’ before ‘
e:\Temp\mongrel-0.2.1\ext\http11\http11_parser.h(32) : error C2143:
syntax error
: missing ‘{’ before '

e:\Temp\mongrel-0.2.1\ext\http11\http11_parser.h(32) : error C2059:
syntax error
: ‘)’
e:\Temp\mongrel-0.2.1\ext\http11\http11_parser.h(33) : error C2143:
syntax error
: missing ‘)’ before ‘
e:\Temp\mongrel-0.2.1\ext\http11\http11_parser.h(33) : error C2143:
syntax error
: missing ‘{’ before '

e:\Temp\mongrel-0.2.1\ext\http11\http11_parser.h(33) : error C2059:
syntax error
: ‘)’
ext/http11/http11_parser.rl(105) : error C2143: syntax error : missing
‘)’ befor
e ‘
ext/http11/http11_parser.rl(105) : error C2143: syntax error : missing
‘{’ befor
e '

ext/http11/http11_parser.rl(105) : error C2059: syntax error : ‘)’
ext/http11/http11_parser.rl(105) : error C2054: expected ‘(’ to follow
‘parser’
ext/http11/http11_parser.rl(108) : error C2005: #line expected a line
number, fo
und ‘string’
ext/http11/http11_parser.rl(112) : error C2005: #line expected a line
number, fo
und ‘string’
ext/http11/http11_parser.rl(124) : error C2143: syntax error : missing
‘)’ befor
e ‘
ext/http11/http11_parser.rl(124) : error C2143: syntax error : missing
‘{’ befor
e '

ext/http11/http11_parser.rl(124) : error C2059: syntax error : ‘type’
ext/http11/http11_parser.rl(124) : error C2059: syntax error : ‘)’
ext/http11/http11_parser.rl(139) : error C2143: syntax error : missing
‘)’ befor
e ‘
ext/http11/http11_parser.rl(139) : error C2143: syntax error : missing
‘{’ befor
e '

ext/http11/http11_parser.rl(139) : error C2059: syntax error : ‘)’
ext/http11/http11_parser.rl(140) : error C2054: expected ‘(’ to follow
‘parser’
ext/http11/http11_parser.rl(144) : error C2005: #line expected a line
number, fo
und ‘string’
ext/http11/http11_parser.rl(145) : error C2005: #line expected a line
number, fo
und ‘string’
ext/http11/http11_parser.rl(158) : error C2143: syntax error : missing
‘)’ befor
e ‘
ext/http11/http11_parser.rl(158) : error C2143: syntax error : missing
‘{’ befor
e '

ext/http11/http11_parser.rl(158) : error C2059: syntax error : ‘)’
ext/http11/http11_parser.rl(158) : error C2054: expected ‘(’ to follow
‘parser’
ext/http11/http11_parser.rl(162) : error C2143: syntax error : missing
‘)’ befor
e ‘
ext/http11/http11_parser.rl(162) : error C2143: syntax error : missing
‘{’ befor
e '

ext/http11/http11_parser.rl(162) : error C2059: syntax error : ‘)’
ext/http11/http11_parser.rl(162) : error C2054: expected ‘(’ to follow
‘parser’
NMAKE : fatal error U1077: ‘cl’ : return code ‘0x2’
Stop.
rake aborted!
Command failed with status (2): [make]

(See full trace by running task with --trace)

On 2/2/06, [email protected] [email protected] wrote:

Awesome. Fixed. The changes I made to extconf.rb were unnecessary as
well.

rake test
Started

RESOLVE(8500): 0.062000 0.000000 0.062000 ( 0.062000)
REG_UNREG(8500): 0.063000 0.000000 0.063000 ( 0.063000)

Finished in 1.172 seconds.

14 tests, 210 assertions, 0 failures, 0 errors