Conversation
取り急ぎ手元で動作確認をしてみましたが,問題なく動作しました.このコミットをマージすること自体は構わないのですが,具体的にどういうケースで障害が発生したのかをお知らせいただけると助かります.ライブラリが想定しているように,毎回新しいcURLリソースを作成する使い方をすれば,この処理が無くても動作するはずなので. |
Example: Sign in with Twitter と同じようにログインを実装したのですがoauthForRequestTokenで例外が発生します。CURLOPT_POSTFIELDSに空文字を指定すると問題なく動作しました。 メッセージ: |
うーん,同じように再確認してみたんですが現象が全く再現できません… 差し支え無ければブランチ 3c3fcec のスクリプトで実験していただけませんか? |
Authorizationヘッダの中身は全く同じですが,どうもヘッダが微妙に違うせいでハッシュ値は違いますね. 修正前POST /oauth/request_token HTTP/1.1
Host: 127.0.0.1:8080
Accept: */*
Authorization: OAuth oauth_consumer_key="aaa", oauth_signature_method="HMAC-SHA1", oauth_timestamp="0", oauth_version="1.0a", oauth_nonce="abcdefg", oauth_signature="LMmADkZVxLb%2FwJMSCWpPL5ulLSU%3D"
Content-Type: application/x-www-form-urlencoded
Expect: 100-continue
修正後POST /oauth/request_token HTTP/1.1
Host: 127.0.0.1:8080
Accept: */*
Authorization: OAuth oauth_consumer_key="aaa", oauth_signature_method="HMAC-SHA1", oauth_timestamp="0", oauth_version="1.0a", oauth_nonce="abcdefg", oauth_signature="LMmADkZVxLb%2FwJMSCWpPL5ulLSU%3D"
Content-Length: 0
Content-Type: application/x-www-form-urlencoded
考察よくあるパターンとして Content-Type: application/x-www-form-urlencoded
Content-Length: 0 Content-Type: multipart/form-data; boundary=xxxxx
Expect: 100-continue の組み合わせは自然なものですが,どうも Content-Type: application/x-www-form-urlencoded
Expect: 100-continue は不自然に思えるので,PRマージしておきます. |
ご報告ありがとうございました. |
ありがとうございます。 3c3fcec で確認してみました。 修正前 POST /oauth/request_token HTTP/1.1
Host: 127.0.0.1:8080
Accept: */*
Authorization: OAuth oauth_consumer_key="aaa", oauth_signature_method="HMAC-SHA1", oauth_timestamp="0", oauth_version="1.0a", oauth_nonce="abcdefg", oauth_signature="LMmADkZVxLb%2FwJMSCWpPL5ulLSU%3D"
Content-Length: -1
Content-Type: application/x-www-form-urlencoded
Expect: 100-continue 修正後 POST /oauth/request_token HTTP/1.1
Host: 127.0.0.1:8080
Accept: */*
Authorization: OAuth oauth_consumer_key="aaa", oauth_signature_method="HMAC-SHA1", oauth_timestamp="0", oauth_version="1.0a", oauth_nonce="abcdefg", oauth_signature="LMmADkZVxLb%2FwJMSCWpPL5ulLSU%3D"
Content-Length: 0
Content-Type: application/x-www-form-urlencoded 修正前のContent-Lengthが-1になってますね… |
@ysr227 なんと!libcurlのバージョンはおいくつでしょうか?(古そう… |
備考: phpのcurl ライブラリの使い方のHTTP実例いっぱい - それマグで! 現在のバージョンでは修正されているようです |
なるほど…7.29.0でした… |
oauth/request_token と oauth/access_token で400が返されるのを修正