View Issue Details

IDProjectCategoryView StatusLast Update
0015790mantisbtotherpublic2019-01-11 06:40
Reporterdregad Assigned Todregad  
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
Product Version1.2.16 
Target Version1.2.16Fixed in Version1.2.16 
Summary0015790: url_get() cURL should set User Agent
Description

the cURL module, unlike command-line curl, does not set User Agent (it's blank by default).

This causes the SourceGithub plugin's Github api calls to fail and return the following JSON payload instead of expected data

{"message":"Missing or invalid User Agent string. See http://developer.github.com/v3/#user-agent-required"}

The issue was initially reported on the source-integration plugin's issues page [1].

I personally think it makes sense that there should always be a valid User Agent specified, so the url_get() api function should be updated accordingly. Following the same logic, I have also filed an enhancement request on PHP tracker [2].

[1] https://github.com/mantisbt-plugins/source-integration/issues/56
[2] https://bugs.php.net/bug.php?id=64723

Steps To Reproduce

$ curl localhost

==> access.log
::1 - - [26/Apr/2013:16:54:52 +0200] "GET / HTTP/1.1" 200 1665 "-" "curl/7.27.0"

$ php -a
php > $c = curl_init('localhost');
php > curl_exec($c);

==> access.log
::1 - - [26/Apr/2013:16:53:15 +0200] "GET / HTTP/1.1" 200 1665 "-" "-"

TagsNo tags attached.

Activities

dregad

dregad

2013-04-26 12:30

developer   ~0036683

And the fact that the changesets below were finally attached proves that the problem is now fixed :)

vboctor

vboctor

2013-09-30 23:35

manager   ~0038159

Shouldn't we set the user agent to something like:

mantisbt/1.2.15

OR

curl/mantisbt/1.2.15

rather than curl/curl_version?

dregad

dregad

2013-10-01 04:33

developer   ~0038167

You're probably right. To be consistent with RFC2616, i would then propose

mantisbt/<version> curl/<version>

wdyt ?

vboctor

vboctor

2013-10-01 11:30

manager   ~0038169

Sounds good.

Related Changesets

MantisBT: master 1d8b02c9

2013-04-26 14:01

dregad


Details Diff
Fix 0015790: url api - set curl user agent in url_get() Affected Issues
0015790
mod - core/url_api.php Diff File

MantisBT: master-1.2.x 8df9d5fa

2013-04-26 14:01

dregad


Details Diff
Fix 0015790: url api - set curl user agent in url_get() Affected Issues
0015790
mod - core/url_api.php Diff File

MantisBT: master-1.2.x 11ee7e25

2013-10-01 13:45

dregad


Details Diff
Fix 0015790: url_get() curl user agent is now mantis

Instead of a generic 'curl/version' we now report 'mantisbt/version
php-curl/version'
Affected Issues
0015790
mod - core/url_api.php Diff File

MantisBT: master 8a523318

2013-10-01 13:45

dregad


Details Diff
Fix 0015790: url_get() curl user agent is now mantis

Instead of a generic 'curl/version' we now report 'mantisbt/version
php-curl/version'
Affected Issues
0015790
mod - core/url_api.php Diff File

MantisBT: master-1.2.x 78c545fe

2013-10-02 09:24

dregad


Details Diff
Fix 0015790: with the '/' this time Affected Issues
0015790
mod - core/url_api.php Diff File

MantisBT: master af338a4a

2013-10-02 09:24

dregad


Details Diff
Fix 0015790: with the '/' this time Affected Issues
0015790
mod - core/url_api.php Diff File