core: Timeout on switching back to a pool after a broken connection lowered from 5 minutes to one minute.
Fix build for no libcurl
Break out of the hash work loops when a failure is detected instead of dropping into mt disable.
Get rid of the stage thread since all work can be asynchronously added now via hash_push anyway.

Conflicts:
	cgminer.c
Only check for the stratum clean message if we have had a valid message.
Reset the work_restart bool after the scanwork loop in case the driver flushes work synchronously.
--shares should be scaled to diff1 not absolute number of shares
Initialise the stgd lock mutex earlier to prevent dereferences when pool testing occurs before it.

Conflicts:
	cgminer.c

Conflicts:
	cgminer.c
util.c: Decreasing reference count on allocated JSON obects to prevent memory leak
We can't connect to a GBT pool at all with fix protocol enabled.
api.c: Release io_data->ptr when releasing io_data in io_free()
api.c: Release apisock on error in api()
api.c trylock() add missing locklock
Provide a function for setting the work ntime.
Don't run device restart code if the device is not enabled.
Do not hold the mining thread lock in restart_threads when calling the driver flush work commands.
Set priority of various threads if possible.

Conflicts:
	cgminer.c
Prevent a deadlock with use of restart_threads by spawning a thread to send the driver flush work messages.

Conflicts:
	cgminer.c

Conflicts:
	cgminer.c
Update api example compilation instructions.
line 2913 added urlencode

There was a cross site scripting vulnerability due to insufficient input sanitation on the $pg parameter.  This patch fixes that issue.