Skip to content
This repository has been archived by the owner on Jan 2, 2023. It is now read-only.

Protocol Relative URL's cause ProtocolInvalidOperationError #2713

Open
halfnibble opened this issue Dec 10, 2015 · 8 comments
Open

Protocol Relative URL's cause ProtocolInvalidOperationError #2713

halfnibble opened this issue Dec 10, 2015 · 8 comments
Labels
Verified The issue is verified.

Comments

@halfnibble
Copy link

Using a protocol relative URL in HTML source code, for example:
<link href='//fonts.googleapis.com/css?family=Permanent+Marker' rel='stylesheet' type='text/css'>
causes an exit status 1, ProtocolInvalidOperationError.

Perhaps wkhtmltopdf could be modified to assume a smart default protocol (http or https) when the protocol is relative?

Thanks.

@channainfo
Copy link

i have the same problem with relative protocol

@bgadoury
Copy link

This is a duplicate of #1746

@halfnibble
Copy link
Author

Interesting. It does appear to be a duplicate. I didn't catch that because the other issue is marked as "closed." However, this issue persists even in the most recent build.

@bocharsky-bw
Copy link

bocharsky-bw commented Nov 8, 2016

Well, it's not a duplicate. All previous issues were solved by specifying a protocol, but it's just a workaround. Maybe let's fix it finally? Links that start with // are valid links, so looks like it's a bug.

@marcusorjames
Copy link

Has this been put on the roadmap at all due to the constraints of the system I am working with it's a real pain to have to convert everything to not use protocol relative urls

@ashkulz ashkulz added the Verified The issue is verified. label Jun 5, 2018
@nuest
Copy link

nuest commented Aug 9, 2018

I use a third party template and ran into the same error. Since I already had a make target to run wkhtmltopdf I added the following two preprocessing steps, hope it helps someone coming across this issue:

find site/ -type f -name '*.html' | xargs sed -i 's|href="//|href="https://|g'
find site/ -type f -name '*.html' | xargs sed -i 's|src="//|src="https://|g'

@PhilterPaper
Copy link

The proper fix is to remember whether the source page was invoked under http: or https:, and use that. If you blindly add "https:" to a URL, you run the risk of the target server not supporting SSL, or that you'll get a 30x response requesting another try with an updated URL. @nuest's fix is at best a workaround when you know that all such URLs can be http: or https:, but I wouldn't use it as a general fix.

nuest added a commit to o2r-project/api that referenced this issue Dec 14, 2018
nuest added a commit to o2r-project/api that referenced this issue Dec 14, 2018
@igordeveloper
Copy link

#5274 i have the same problem

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Verified The issue is verified.
Development

No branches or pull requests

9 participants