[ruby-list:50566] Re: IMAP IDLE
From:
emo@...
Date:
2017-08-27 10:17:59 UTC
List:
ruby-list #50566
とみた様、前田様
ありがとうございます。
ドコモの IMAP の仕様書を見つけました。
https://www.nttdocomo.co.jp/binary/pdf/service/developer/smart_phone/application/imap/mail_imap_spec_151201.pdf
これを見ると IDLE が成功したときにどのような
応答が返ってくるか書いていないようです。
ただし、「3.3.26.5 コマンドの実行例」では、
"+ ."が返ってくるような例が書かれています。
On 2017/08/27 15:36, Shugo Maeda wrote:
> 前田です。
>
> 2017年8月27日 9:03 とみたまさひろ <tommy@tmtm.org>:
>> IDLE コマンドの応答が「+」だけなのがおかしいですね。
>> 「+ 何かの文字列」である必要があります。
>>
>> https://tools.ietf.org/html/rfc3501#section-7.5
>>
>> # それで connection closed というエラーになるのもどうかと思いますが…。
>>
>> 原因はサーバーがIMAPプロトコルに従ってないためなので、クライアント側で
>> 対応するには net/imap ライブラリに手を入れるしかないと思います。
>
> trunkでは修正しましたが、以下のようなモンキーパッチで対処できるのではないかと思います。
>
> class Net::IMAP::ResponseParser
> def continue_req
> match(T_PLUS)
> token = lookahead
> if token.symbol == T_SPACE
> shift_token
> return ContinuationRequest.new(resp_text, @str)
> else
> return ContinuationRequest.new(ResponseText.new(nil, ""), @str)
> end
> end
> end
>
> ついでにパースエラー等の時にオリジナルの例外を投げるように修正しました。
>
とりあえず、上記を修正して
以下のようにすることで、
ドコモには対応できるようになりました。
class Net::IMAP::ResponseParser
def continue_req
match(T_PLUS)
token = lookahead
if token.symbol == T_SPACE
shift_token
return ContinuationRequest.new(resp_text, @str)
else
# return ContinuationRequest.new(ResponseText.new(nil, ""), @str)
return T_PLUS
end
end
end
江本
Attachments (1)
smime.p7s
(3.91 KB, application/pkcs7-signature)