Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Errors when using the library #13

Open
machawk1 opened this issue Mar 25, 2017 · 6 comments
Open

Errors when using the library #13

machawk1 opened this issue Mar 25, 2017 · 6 comments

Comments

@machawk1
Copy link
Member

$ phantomjs --version
2.1.1
$ python --version
Python 2.7.13
$ memento-damage http://matkelly.com/
2017-03-25 14:00:15 http://matkelly.com/ ERROR Protocol "" is unknown
2017-03-25 14:00:15 http://matkelly.com/ ERROR Processing text in frame
2017-03-25 14:00:15 http://matkelly.com/ ERROR PHANTOM ERROR: ReferenceError: Can't find variable: $
2017-03-25 14:00:15 http://matkelly.com/ ERROR TRACE:
2017-03-25 14:00:15 http://matkelly.com/ ERROR -> undefined: 6
2017-03-25 14:00:15 http://matkelly.com/ ERROR -> undefined: 119
2017-03-25 14:00:15 http://matkelly.com/ ERROR Page is moved permanently (Status code 301)
Error in processing http://matkelly.com/: Page is moved permanently (Status code 301)
$ 

Installed via pip. I am not sure how to proceed from here.

@erikaris
Copy link
Collaborator

Hi Mat,

This happened because your URI's status code is 301.
To follow redirection, use option -L: 'memento-damage -L http://matkelly.com/'.

Here are other options available: (see the list by typing: "memento-damage --help")

Usage: memento-damage [options] <URI>
Options:
  -h, --help            show this help message and exit
  -o OUTPUT_DIR, --output-dir=OUTPUT_DIR
                        output directory (optional)
  -O, --overwrite       overwrite existing output directory
  -m MODE, --mode=MODE  output mode: "simple" or "json" [default: simple]
  -d DEBUG, --debug=DEBUG
                        debug mode: "simple" or "complete" [default: none]
  -L, --redirect        follow url redirection

This is what I got when run memento-damage with your URI:

erikaris:~$ memento-damage -L http://matkelly.com/
Total damage of http://www.cs.odu.edu/~mkelly/ is 0.0

@machawk1
Copy link
Member Author

@erikaris Though this option is available, the command-line interface ought to fail more gracefully when encountering an HTTP 3XX.

@erikaris
Copy link
Collaborator

I am sorry, but I don't understand what you mean by 'fail more gracefully'?

@machawk1
Copy link
Member Author

@erikaris The error messages on the command line when a user supplies a URI that is a redirect should not be shown. Instead, the application ought to recognize that a redirect has occurred and respond appropriately, e.g., reporting it in a message. To "fail gracefully" is to handle the errors.

@erikaris
Copy link
Collaborator

Do you mean the application should automatically follow the redirection?
For the 'website' version (the one on http://memento-damage.cs.odu.edu/), the redirection is automatically followed.
But for the other versions, we let the users choose whether they want to follow redirection or not. This way, they will be aware that their original URI has been redirected to other URI.
(That's what I understood from my meeting with Dr. Nelson and Dr. Weigle. ).

But I will modify the error message to let the user know to add -L, in case they want to follow redirection.

@machawk1
Copy link
Member Author

machawk1 commented Mar 29, 2017

For the 'website' version (the one on http://memento-damage.cs.odu.edu/), the redirection is automatically followed.

When I use the URI http://matkelly.com , the interface does not update. curl -I http://matkelly.com reports a 301 redirect. Strangely, http://matkelly.com/ works despite the same status code and redirect location.

we let the users choose whether they want to follow redirection or not.

This is good but, as you plan, reporting that a redirection would be better if this flag is not set than reporting errors.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants