February 7th, 2013, 11:20 AM
Need Help with a program Please
Can someone please help me with a solution to this program. It would be greatly appriciated.
Simple web server log analysis program that will read the provided apache.log file and
use a case statement to print the HTTP method used by each web transaction in the log.
Each line of the log file is a single file transaction and has a clearly displayed HTTP verb.
Since this is a good web server, it only accepts HEAD, GET, POST, and OPTIONS. There are other methods like TRACE, if these are encountered 'invalid' should be displayed.
For the provided log file, your output
should look something like:
Request 1 used GET.
Request 2 used GET.
Request 3 used GET.
Request 4 used GET.
Request 5 used POST.
Request 6 used an invalid verb/method.
Request 7 used HEAD.
There is no need to write code to read the file. Use the gets method to read from standard input
(STDIN). When running the program, use I/O redirection to redirect the file to standard input like
$ ruby_name_1.rb < apache.log