phantomjs icon indicating copy to clipboard operation
phantomjs copied to clipboard

proxyAuth command is not working correctly

Open kevtrn opened this issue 13 years ago • 5 comments

Which version of PhantomJS are you using? Tip: run 'phantomjs --version'

PhantomJS 1.9.1

What steps will reproduce the problem?

  1. I used CMD prompt and changed directories to the examples folder of PhantomJS directory.
  2. Ran the command

phantomjs --debug=yes --proxy=http://proxy-url:80/ --proxy-auth=USERNAME:PWD tweets.js

  1. Here is my debug log:

2013-06-21T08:30:31 [DEBUG] CookieJar - Created but will not store cookies (use option '--cookies-file=' to enable persisten cookie storage) 2013-06-21T08:30:31 [DEBUG] Phantom - execute: Configuration 2013-06-21T08:30:31 [DEBUG] 0 objectName : "" 2013-06-21T08:30:31 [DEBUG] 1 cookiesFile : "" 2013-06-21T08:30:31 [DEBUG] 2 diskCacheEnabled : "false" 2013-06-21T08:30:31 [DEBUG] 3 maxDiskCacheSize : "-1" 2013-06-21T08:30:31 [DEBUG] 4 ignoreSslErrors : "false" 2013-06-21T08:30:31 [DEBUG] 5 localToRemoteUrlAccessEnabled : "false" 2013-06-21T08:30:31 [DEBUG] 6 outputEncoding : "UTF-8" 2013-06-21T08:30:31 [DEBUG] 7 proxyType : "http" 2013-06-21T08:30:31 [DEBUG] 8 proxy : proxyURL:80" 2013-06-21T08:30:31 [DEBUG] 9 proxyAuth : "USERNAME:PWD" 2013-06-21T08:30:31 [DEBUG] 10 scriptEncoding : "UTF-8" 2013-06-21T08:30:31 [DEBUG] 11 webSecurityEnabled : "true" 2013-06-21T08:30:31 [DEBUG] 12 offlineStoragePath : "" 2013-06-21T08:30:31 [DEBUG] 13 offlineStorageDefaultQuota : "-1" 2013-06-21T08:30:31 [DEBUG] 14 printDebugMessages : "true" 2013-06-21T08:30:31 [DEBUG] 15 javascriptCanOpenWindows : "true" 2013-06-21T08:30:31 [DEBUG] 16 javascriptCanCloseWindows : "true" 2013-06-21T08:30:31 [DEBUG] 17 sslProtocol : "sslv3" 2013-06-21T08:30:31 [DEBUG] 18 sslCertificatesPath : "" 2013-06-21T08:30:31 [DEBUG] 19 webdriver : ":" 2013-06-21T08:30:31 [DEBUG] 20 webdriverLogFile : "" 2013-06-21T08:30:31 [DEBUG] 21 webdriverLogLevel : "INFO" 2013-06-21T08:30:31 [DEBUG] 22 webdriverSeleniumGridHub : "" 2013-06-21T08:30:31 [DEBUG] Phantom - execute: Script & Arguments 2013-06-21T08:30:31 [DEBUG] script: "tweets.js" 2013-06-21T08:30:31 [DEBUG] Phantom - execute: Starting normal mode 2013-06-21T08:30:31 [DEBUG] WebPage - setupFrame "" 2013-06-21T08:30:31 [DEBUG] FileSystem - _open: ":/modules/fs.js" QMap(("mode", QVariant(QString, "r") ) ) 2013-06-21T08:30:31 [DEBUG] FileSystem - _open: ":/modules/system.js" QMap(("mode", QVariant(QString, "r") ) ) 2013-06-21T08:30:31 [DEBUG] FileSystem - _open: ":/modules/_coffee-script.js" QMap(("mode", QVariant(QString, "r") ) ) 2013-06-21T08:30:31 [DEBUG] FileSystem - _open: ":/modules/../coffee-script/package.json" QMap(("mode", QVariant(QString, "r") ) ) 2013-06-21T08:30:31 [DEBUG] FileSystem - _open: ":/modules/../coffee-script/./lib/coffee-script/coffee-script.js" QMap(("mode", QVariant(QString, "r") ) ) 2013-06-21T08:30:31 [DEBUG] FileSystem - _open: ":/modules/../coffee-script/./lib/coffee-script/./lexer.js" QMap(("mode", QVariant(QString, "r") ) ) 2013-06-21T08:30:31 [DEBUG] FileSystem - _open: ":/modules/../coffee-script/./lib/coffee-script/././rewriter.js" QMap(("mode", QVariant(QString, "r") ) ) 2013-06-21T08:30:31 [DEBUG] FileSystem - _open: ":/modules/../coffee-script/./lib/coffee-script/././helpers.js" QMap(("mode", QVariant(QString, "r") ) ) 2013-06-21T08:30:31 [DEBUG] FileSystem - _open: ":/modules/../coffee-script/./lib/coffee-script/./parser.js" QMap(("mode", QVariant(QString, "r") ) ) 2013-06-21T08:30:31 [DEBUG] FileSystem - _open: ":/modules/../coffee-script/./lib/coffee-script/./helpers.js" QMap(("mode", QVariant(QString, "r") ) ) 2013-06-21T08:30:31 [DEBUG] FileSystem - _open: ":/modules/../coffee-script/./lib/coffee-script/./nodes.js" QMap(("mode", QVariant(QString, "r") ) ) 2013-06-21T08:30:32 [DEBUG] FileSystem - _open: ":/modules/../coffee-script/./lib/coffee-script/././scope.js" QMap(("mode", QVariant(QString, "r") ) ) 2013-06-21T08:30:32 [DEBUG] FileSystem - _open: ":/modules/../coffee-script/./lib/coffee-script/./././helpers.js" QMap(("mode", QVariant(QString, "r") ) ) 2013-06-21T08:30:32 [DEBUG] FileSystem - _open: ":/modules/../coffee-script/./lib/coffee-script/././lexer.js" QMap(("mode", QVariant(QString, "r") ) ) 2013-06-21T08:30:32 [DEBUG] FileSystem - _open: ":/modules/../coffee-script/./lib/coffee-script/./././rewriter.js" QMap(("mode", QVariant(QString, "r") ) ) 2013-06-21T08:30:32 [DEBUG] FileSystem - _open: ":/modules/webpage.js" QMap(("mode", QVariant(QString, "r") ) ) Usage: tweets.js [twitter ID] *** Latest tweets from @PhantomJS ***

2013-06-21T08:30:32 [DEBUG] WebPage - updateLoadingProgress: 10 2013-06-21T08:30:32 [DEBUG] WebPage - updateLoadingProgress: 12 2013-06-21T08:30:32 [DEBUG] Network - Resource request error: 105 ( "Proxy requires authentication" ) URL: "http://mobile.twitter.com/PhantomJS" 2013-06-21T08:30:32 [DEBUG] WebPage - updateLoadingProgress: 100 2013-06-21T08:30:32 [DEBUG] WebPage - evaluateJavaScript "(function() { return (function () { var list = document.querySelectorAll('div.tweet-text'); for (var i = 0; i < list.length; ++i) { console.log((i + 1) + ": " + list[i].innerText); } })(); })()" 2013-06-21T08:30:32 [DEBUG] WebPage - setupFrame "" 2013-06-21T08:30:32 [DEBUG] WebPage - evaluateJavaScript result QVariant(, )

Which operating system are you using? Windows 7

Did you use binary PhantomJS or did you compile it from source? Binary

Please provide any additional information below. We use HTTP for proxy authentication. I changed the proxyURL, USERNAME, and PWD for security reasons. I am 100% sure the proxyURL, USERNAME, and PWD are correct when I run it in my command line.

Any help would be greatly appreciated

Thanks, Kevin

kevtrn avatar Jun 21 '13 13:06 kevtrn

Proxy auth works. I used squid on Windows 7 with the basic authentication. The debug log is here: https://gist.github.com/Vitallium/5842641

vitallium avatar Jun 22 '13 21:06 vitallium

@Vitallium Hmm. That is strange. I wonder why it isn't working for me. Is there a way i can set the username and password to use default system credentials?

kevtrn avatar Jun 25 '13 14:06 kevtrn

i got the error from the responsed data: "stage": "start", "status": 407, "statusText": "Proxy Authentication Required ..." debug error info :"2014-08-20T17:44:44 [DEBUG] Network - Resource request error: 105 ( "Proxy requires authentication" ) "

i use the following cmd line, and i'm sure about the host,port,name and pwd info.

phantomjs --debug=yes --proxy=host:port --proxy-auth=name:pwd testproxy.js

strivingzhou avatar Aug 20 '14 09:08 strivingzhou

@kvntrn did you slove this problem?

strivingzhou avatar Aug 20 '14 09:08 strivingzhou

Due to our very limited maintenance capacity, we need to prioritize our development focus on other tasks. Therefore, this issue will be automatically closed (see #15395 for more details). In the future, if we see the need to attend to this issue again, then it will be reopened. Thank you for your contribution!

stale[bot] avatar Dec 30 '19 14:12 stale[bot]