- if method == "GET"
- req = Net::HTTP::Get.new(path)
- elsif method == "POST"
- req = Net::HTTP::Post.new(path)
- req.body = $stdin.read()
- else
- raise RuntimeError, "No support for method: #{method}"
- end
-
- if ff_header
- add_header(req, "REMOTE_ADDR", "X-Forwarded-For")
- end
- add_header(req, "HTTP_HOST", "Host")
- add_header(req, "HTTP_COOKIE", "Cookie")
- add_header(req, "HTTP_REFERER", "Referer")
- add_header(req, "CONTENT_LENGTH", "Content-Length")
- add_header(req, "CONTENT_TYPE", "Content-Type")
- add_header(req, "HTTP_USER_AGENT", "User-Agent")
- add_header(req, "HTTP_CACHE_CONTROL", "Cache-Control")
- add_header(req, "HTTP_AUTHORIZATION", "Authorization")
- add_header(req, "HTTP_ACCEPT", "Accept")
- add_header(req, "HTTP_ACCEPT_CHARSET", "Accept-Charset")
- add_header(req, "HTTP_ACCEPT_ENCODING", "Accept-Encoding")
- add_header(req, "HTTP_ACCEPT_LANGUAGE", "Accept-Language")
-
- return req
+ if method == "GET"
+ req = Net::HTTP::Get.new(path)
+ elsif method == "POST"
+ req = Net::HTTP::Post.new(path)
+ req.body = $stdin.read()
+ else
+ raise RuntimeError, "No support for method: #{method}"
+ end
+
+ if ff_header
+ add_header(req, "REMOTE_ADDR", "X-Forwarded-For")
+ end
+ add_header(req, "HTTP_HOST", "Host")
+ add_header(req, "HTTP_COOKIE", "Cookie")
+ add_header(req, "HTTP_REFERER", "Referer")
+ add_header(req, "CONTENT_LENGTH", "Content-Length")
+ add_header(req, "CONTENT_TYPE", "Content-Type")
+ add_header(req, "HTTP_USER_AGENT", "User-Agent")
+ add_header(req, "HTTP_CACHE_CONTROL", "Cache-Control")
+ add_header(req, "HTTP_AUTHORIZATION", "Authorization")
+ add_header(req, "HTTP_ACCEPT", "Accept")
+ add_header(req, "HTTP_ACCEPT_CHARSET", "Accept-Charset")
+ add_header(req, "HTTP_ACCEPT_ENCODING", "Accept-Encoding")
+ add_header(req, "HTTP_ACCEPT_LANGUAGE", "Accept-Language")
+
+ return req