Google Groups Home
Help | Sign in
Message from discussion How to use Thin with Swiftiply
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
Reza Primardiansyah  
View profile
 More options Apr 4, 12:24 am
From: "Reza Primardiansyah" <reza.primardians...@gmail.com>
Date: Fri, 4 Apr 2008 11:24:12 +0700
Local: Fri, Apr 4 2008 12:24 am
Subject: Re: How to use Thin with Swiftiply

Can it because of the CRLF separator ? Do you type it from windows ? I
suspect Thin expects \n but you gave it \r\n

On Thu, Apr 3, 2008 at 10:19 PM, gpop <gpop2...@gmail.com> wrote:

> I'm using swiftiply 0.6.1.1 and thin 0.7.1 . And you're correct - I
> was surprised to find that it in fact does work in a browser. I played
> around with it some more and found that it responds via cURL requests
> as well, but it still doesn't like an interactive telnet request. If I
> telnet to the swiftiply port and copy/paste:

> GET /test/user/login HTTP/1.1
> Host: testapp:4000
> Accept: */*

> Then it responds properly - however if I type the same thing, it
> doesn't, and thin trips out with:

> !! Invalid request
> e is #<Thin::InvalidRequest: Invalid HTTP format, parsing fails.>
> data is "Host: testapp:4000\r\nAccept: */*\r\n\r\n\r\n\r\n"
> !! Invalid request
> e is #<Thin::InvalidRequest: Invalid HTTP format, parsing fails.>
> data is "Host: testapp:4000\r\nAccept: */*\r\n\r\n\r\n\r\n"
> !! Invalid request
> e is #<Thin::InvalidRequest: Invalid HTTP format, parsing fails.>
> data is "Host: testapp:4000\r\nAccept: */*\r\n\r\n\r\n\r\n"

> I guess I'm used to testing services by telnet-ing to them, however
> that doesn't seem to work with Swiftiply. I'm assuming there's some
> sort of timeout that occurs while I'm ever so slowly (compared to a
> copy/paste) typing my request in. Regardless, I stand corrected and
> can confirm that at least through a browser, my Swiftiply and Thin
> play together nicely.

> I still don't think I'm going to go with Swiftiply in production until
> it's more mature, though it looks promising!

> --George

> On Apr 2, 7:33 pm, macournoyer <macourno...@gmail.com> wrote:
> > does it work from a browser, also what version of switiply are you
> > using?

> > On Apr 2, 6:04 pm, gpop <gpop2...@gmail.com> wrote:

> > > Bah, no such luck. I've tried it before and the result is always the
> > > same, my thin servers log "!! Invalid request" over and over.
> > > Swiftiply seems to gobble up the first header. For example, given the
> > > configs:

> > > $ cat swiftiply.yml
> > > cluster_address: 0.0.0.0
> > > cluster_port: 4000
> > > daemonize: true
> > > epoll: true
> > > map:
> > >   - incoming:
> > >     - testapp
> > >     outgoing: 127.0.0.1:8014
> > >     default: true
> > >     redeployable: true
> > > $ cat thin.yml
> > > ---
> > > user: XXX
> > > max_conns: "100"
> > > chdir: /home/XXX/XXX
> > > timeout: "20"
> > > port: 8014
> > > environment: development
> > > group: XXX
> > > address: 127.0.0.1
> > > pid: log/thin.pid
> > > servers: 1
> > > prefix: /test
> > > #rackup: ./thin_proctitle.ru

> > > and starting them with

> > > swiftiply -c swiftiply.yml
> > > thin -y -C thin.yml start

> > > I then make a request to Swiftiply:

> > > $ telnet 0 4000
> > > Trying 0.0.0.0...
> > > Connected to 0.
> > > Escape character is '^]'.
> > > GET /test/testing HTTP/1.1
> > > Host: testapp

> > > Which causes the thin log to scroll "!! Invalid request" repeatedly.
> > > I've hacked up that part of the code to simply puts the e (exception)
> > > and data (the request that came in from swiftiply) variables to the
> > > log, and it the log then reads:

> > > !! Invalid request
> > > e is #<Thin::InvalidRequest: Invalid HTTP format, parsing fails.>
> > > data is "Host: testapp\r\n"
> > > !! Invalid request
> > > e is #<Thin::InvalidRequest: Invalid HTTP format, parsing fails.>
> > > data is "Host: testapp\r\n"
> > > !! Invalid request
> > > e is #<Thin::InvalidRequest: Invalid HTTP format, parsing fails.>
> > > data is "Host: testapp\r\n"
> > > !! Invalid request
> > > e is #<Thin::InvalidRequest: Invalid HTTP format, parsing fails.>
> > > data is "Host: testapp\r\n"
> > > !! Invalid request
> > > e is #<Thin::InvalidRequest: Invalid HTTP format, parsing fails.>
> > > data is "Host: testapp\r\n"
> > > !! Invalid request

> > > repeatedly. It looks like Swiftiply never passes the GET request to
> > > the thin server. You ever see something like this before? Also, please
> > > note that the prefix: and rackup: stuff is from some testing I'm doing
> > > and doesn't affect the behaviour of Swiftiply (it doesn't work
> > > regardless).

> > > I've read there's currently a bug in EventMachine that causes
> > > Swiftiply to crash unexpectedly. The bug is supposedly fixed in
> > > eventmachine 0.11.0 , but that gem isn't out yet. Regardless, I can't
> > > wait until Swiftiply is more mature so I can put it into production.

> > > --George

> > > On Mar 27, 1:31 pm, macournoyer <macourno...@gmail.com> wrote:

> > > > hey matt,

> > > > First you need to install & setup a swiftiply config file:
> > > >  gem install swiftiply

> > > > and check thin specs for a sample config file:
> http://github.com/macournoyer/thin/tree/master/spec/server/swiftiply.yml

> > > > then start swiftiply:
> > > >  swiftiply -c /path/to/your/swiftiply/config.yml

> > > > then start your thins:
> > > >  thin start -s3 -p5555 -y

> > > > If you wanna put this behind Apache, proxy to the swiftiply cluster
> > > > port (3333 in this case)

> > > > Hope this helps!
> > > > Marc

> > > > On Mar 27, 11:11 am, matt mitchell <goodie...@gmail.com> wrote:

> > > > > Hi,

> > > > > I can't seem to find any information on how to actually get Thin
> > > > > working with Swiftiply? I see there is the -y argument for Thin. I
> > > > > tried it out and seems to start up something.... But Apache (load
> > > > > balancer) is not able to connect to the ports I specified in my
> > > > > thin.yml config file. Is there something I'm missing?


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2008 Google