Skip to content

Commit

Permalink
クッキーからのsid抽出処理を修正
Browse files Browse the repository at this point in the history
  • Loading branch information
onihusube committed Apr 24, 2022
1 parent 5dc7875 commit b7d2e2a
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions 2chAPIProxy/DatProxy.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1177,10 +1177,16 @@ private void ResPostv2(Session oSession, bool is2ch)
// sidフィールドにある場合(専ブラ)
Write.Headers.Add("X-Ronin-Sid", post_field_map["sid"]);
}
else if (Cookie.TryGetValue("sid", out string sid_value) && Regex.IsMatch(sid_value, @"Monazilla/\d.\d\d:\w+"))
else if (Cookie.TryGetValue("sid", out string sid_cookie))
{
// クッキーにある場合(一般ブラウザ、sikiなど?)
Write.Headers.Add("X-Ronin-Sid", sid_value);
var m = Regex.Match(sid_cookie, @"Monazilla/\d.\d\d:\w+");

if (m.Success)
{
// クッキーにある場合(一般ブラウザ、sikiなど?)
// クッキーはsid=xxxxの形で保存されてる
Write.Headers.Add("X-Ronin-Sid", m.Value);
}
}
}
// 新仕様ではこのフィールドはなさそうなので削除
Expand Down

1 comment on commit b7d2e2a

@onihusube
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#4

Please sign in to comment.