1
0
mirror of https://github.com/cmur2/dyndnsd.git synced 2024-12-21 14:54:22 +01:00

Supply IP to responder

This commit is contained in:
cn 2013-04-27 14:30:15 +02:00
parent b6bc37c042
commit 3a39f4fa0a
2 changed files with 5 additions and 5 deletions

View File

@ -81,10 +81,10 @@ module Dyndnsd
@db['serial'] += 1 @db['serial'] += 1
@db.save @db.save
update update
return @responder.response_for(:good) return @responder.response_for(:good, myip)
end end
@responder.response_for(:nochg) @responder.response_for(:nochg, myip)
end end
def self.run! def self.run!

View File

@ -2,7 +2,7 @@
module Dyndnsd module Dyndnsd
module Responder module Responder
class RestStyle class RestStyle
def response_for(state) def response_for(state, ip = nil)
# general http errors # general http errors
return [405, {"Content-Type" => "text/plain"}, ["Method Not Allowed"]] if state == :method_forbidden return [405, {"Content-Type" => "text/plain"}, ["Method Not Allowed"]] if state == :method_forbidden
return [404, {"Content-Type" => "text/plain"}, ["Not Found"]] if state == :not_found return [404, {"Content-Type" => "text/plain"}, ["Not Found"]] if state == :not_found
@ -11,8 +11,8 @@ module Dyndnsd
return [403, {"Content-Type" => "text/plain"}, ["Forbidden"]] if state == :host_forbidden return [403, {"Content-Type" => "text/plain"}, ["Forbidden"]] if state == :host_forbidden
return [422, {"Content-Type" => "text/plain"}, ["Hostname malformed"]] if state == :hostname_malformed return [422, {"Content-Type" => "text/plain"}, ["Hostname malformed"]] if state == :hostname_malformed
# OKs # OKs
return [200, {"Content-Type" => "text/plain"}, ["Good"]] if state == :good return [200, {"Content-Type" => "text/plain"}, ["Changed to #{ip}"]] if state == :good
return [200, {"Content-Type" => "text/plain"}, ["No change"]] if state == :nochg return [200, {"Content-Type" => "text/plain"}, ["No change needed for #{ip}"]] if state == :nochg
end end
end end
end end