unsupported
     ˆÇÆÅ599ÄÃÂ W    ‹      Õ–ßoÚ0ÇßûWx~Ø�Žv4xêÒÐ(E-Ó4MSebC¬&vdýëçà´M§¢1© öé|É7w÷qÎ?ÂwÑeoòcÜG_&C4þöy8è!\øÞêD“È¿8®7€þ#œX›w V«U}Õª+=‡É$6K�ÁX-b[g–arÏÈ
N™³(´Â¦œ$ã¿‘š!Pkãî»µÆ—"æ¦[žAÆ3¥×¥	š§ ã�Òo=uƒF;Ü¥ƒ2_8Ul]”ì+¥‹¼Á¢ÓMæb¨Ih´¤©˜Ë.¶*Ç$Ùw1ˆXIÓ”ÊÛú\Ì0¢©íâŸƒÞå/§›_“�¢DóYêuGg—Ý“ÍxôyÍ…Óœc2¤Æ¢L11œm_{ñµ¸Û0òšˆ›X‹Ü
%¥à«¨±JMNëG�èªÊKØ¿fƒÆO&c|~ÕM¢Á•ŸV„x¬î~ &cª¹´(šÇÖ½*é|ª÷rjò³{•µk1O,&ÕÐ³Êÿ ž©”q]EÞ{_¯·Õ*ÿ*«Ùh¶kAP>¢à¤Óh#´ÇúòVª•¬¸~x@ÉTHŽ‰·; 4œvZÍ­ núz@€<Y›ße˜Tœ·Š"Š�°$ÙŒ_Èî‹"W+®Ý¢ðvçúƒ“×²(´ÛŽ–Å‘�ÉÃp÷µ½ãÀýd,µacÞ^™Å´<4ÂÃøn±¾tg&Þ¾À�û¨Änî”ä“Š³ÿžÚñåý.„Í…2¯ýø­È:    $   ˆÇÆÅ647Äa–Ü4ý( ©¤ýÔâ�vã-\Å£Ã ‡    ‹      Õ—QoÚ0Çßû)<?ìŽ@×n4xêH¥¡¶µLÓ4M•‰Mb5Ø‘m`ìÓÏ‰ÓB§²¥ÒØÊKîìüßÏ¹sœðUtÕ�¡�ãË4úôábÐG¸ð¹ÓˆÆ‘¿qØl gCŒpjmÞX.—Íe§©tãkHí,;cµˆm“Y†ÉAXô‘¦œ2gQh…Í8HÆ¿#5E æÖÆÝ¸•Æ"æ¦ð-Ÿ�TŒ——Äù¼f>©î0-\Èµrz£t!8ªºÿ0?“›ªÉÃ‰b«"¦àŸÌï¦)�é¤£p5	mŠ4‰ìa«rLB1K�Ñqƒˆ•40É¨¼k&bŠÍlô¯¾9Ø´MBŠRÍ§=ü¾ßž\õ"L†tÆC Ok.�æ“j,š)&¦‚³­â/¾?¶?0òšˆ›X‹Ü
%×Rpˆ›¨±ÊLNëG�êM•—°?­�-Æèôúl8Ž×~IXñˆut;y›˜Œ¨æÒ¢Hh[¥W¯Ÿüµœ˜üä¾‰*-’Ôb‚P=©|ÆLUÆ¸Þ\„mø1�Sîâõv3Ê_Âj·ÚG� hïPpÜm#´ÃøçòNª¥Üpò4€¦&½•Êrã(Ö�(í o»Áv·{�ÿ”[ãÊéOÙSªÓÙ)Týüz(ˆÊ©ŸaG;Í°úS¡gKWÍ·åf€Éãöþñ¤ÊæÙ<q$÷^=†v§´_ƒß’1ñö¥¼ƒg”º’™�®À½Ý¿²ÎÕ²¬jo÷/�ÖrLÖþKI¤ún¼ÊT²rî~Äç|áNK˜xû7^ÃïË¡æqªƒxåo@þ×ä'�hEëý    5   ˆl–Ü4ý( ©¤ýÔâ�và›¸TÅ£�þB g6„ãaŸÂƒh¹Ç¿Ä      1
  D   ˆl–Ãa¾”ªeJe@ãB¸©‹Fÿ�þeuõ›•–Zˆô¥ ?ŸÃƒe÷È_�uÐb&=LyZËcõÁÆ y    # encoding: binary
#  Phusion Passenger - https://www.phusionpassenger.com/
#  Copyright (c) 2010-2017 Phusion Holding B.V.
#
#  "Passenger", "Phusion Passenger" and "Union Station" are registered
#  trademarks of Phusion Holding B.V.
#
#  Permission is hereby granted, free of charge, to any person obtaining a copy
#  of this software and associated documentation files (the "Software"), to deal
#  in the Software without restriction, including without limitation the rights
#  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
#  copies of the Software, and to permit persons to whom the Software is
#  furnished to do so, subject to the following conditions:
#
#  The above copyright notice and this permission notice shall be included in
#  all copies or substantial portions of the Software.
#
#  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
#  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
#  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
#  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
#  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
#  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
#  THE SOFTWARE.

require 'socket'
PhusionPassenger.require_passenger_lib 'message_channel'
PhusionPassenger.require_passenger_lib 'utils'

module PhusionPassenger

  # A convenience class for communicating with MessageServer servers,
  # for example the ApplicationPool server.
  class MessageClient
    include Utils

    class ProtocolError < StandardError
    end

    # Connect to the given server. By default it connects to the current
    # generation's core.
    def initialize(username, password, address)
      @socket = connect_to_server(address)
      begin
        @channel = MessageChannel.new(@socket)

        result = @channel.read
        if result.nil?
          raise EOFError
        elsif result.size != 2 || result[0] != "version"
          raise IOError, "The message server didn't sent a valid version identifier"
        elsif result[1] != "1"
          raise IOError, "Unsupported message server protocol version #{result[1]}"
        end

        @channel.write_scalar(username)
        @channel.write_scalar(password)

        result = @channel.read
        if result.nil?
          raise EOFError
        elsif result[0] != "status"
          raise ProtocolError, "Invalid authentication response: expected \"status\", got #{result[0].inspect}"
        elsif result[1] == "o