Skip to content

Commit

Permalink
Fix #1204
Browse files Browse the repository at this point in the history
  • Loading branch information
cress-cc committed Jan 21, 2025
1 parent ea4e540 commit cbaffcd
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
10 changes: 6 additions & 4 deletions lib/tdiary/dispatcher/index_main.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,9 @@ def run
head['pragma'] = 'no-cache'
head['cache-control'] = 'no-cache'
head['x-frame-options'] = conf.x_frame_options if conf.x_frame_options
head['cookie'] = tdiary.cookies if tdiary.cookies.size > 0
TDiary::Response.new( body, ::TDiary::Dispatcher.extract_status_for_legacy_tdiary( head ), head )
res = TDiary::Response.new( body, ::TDiary::Dispatcher.extract_status_for_legacy_tdiary( head ), head )
res.set_header('Set-Cookie', tdiary.cookies.map(&:to_s)) if tdiary && tdiary.cookies.size > 0
res
end
rescue TDiary::NotFound
body = %Q[
Expand All @@ -67,9 +68,10 @@ def run
</head>
<body>Wait or <a href="#{$!.path}">Click here!</a></body>
</html>]
head['cookie'] = tdiary.cookies if tdiary && tdiary.cookies.size > 0
# TODO return code should be 302? (current behaviour returns 200)
TDiary::Response.new( body, 200, head )
res = TDiary::Response.new( body, 200, head )
res.set_header('Set-Cookie', tdiary.cookies.map(&:to_s)) if tdiary && tdiary.cookies.size > 0
res
end
end

Expand Down
5 changes: 3 additions & 2 deletions lib/tdiary/dispatcher/update_main.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,10 @@ def run
</head>
<body>Wait or <a href="#{$!.path}">Click here!</a></body>
</html>]
head['cookie'] = tdiary.cookies if tdiary.cookies.size > 0
# TODO return code should be 302? (current behaviour returns 200)
TDiary::Response.new( body, 200, head )
res = TDiary::Response.new( body, 200, head )
res.set_header('Set-Cookie', tdiary.cookies.map(&:to_s)) if tdiary && tdiary.cookies.size > 0
res
end
end

Expand Down

0 comments on commit cbaffcd

Please sign in to comment.