Bug 5192

Summary: non-existent URLs listed in the "Layer index URL" column
Product: [Build System, Metadata & Runtime] Toaster Reporter: Belen Barros Pena <belen.barros.pena>
Component: toasterAssignee: Elliot Smith <elliot.smith>
Status: VERIFIED OBSOLETE QA Contact: Alexandru Roman <alexandru.costinx.roman>
Severity: minor    
Priority: Medium CC: alexandru.costinx.roman, alexandru.damian, belen.barros.pena, bluelightning, jessica.zhang
Version: 1.5   
Target Milestone: Future   
Hardware: All   
OS: Multiple   
Whiteboard: simple
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: No (bug/feature does not impact docs)

Description Belen Barros Pena 2013-09-13 14:20:43 UTC
In the "All layers" table, we are not checking if the "Layer Index URL" exists.  For example: 

http://layers.openembedded.org/layerindex/branch/master/layer/meta-hob/ 

returns 404, because the meta-hob layer is not in the OpenEmbedded metadata index. 

We might not have to fix this right now, but the interface should not list URLs that return 404.
Comment 1 Belen Barros Pena 2013-09-13 14:43:00 UTC
webhob-poky/master:aa7bec2e9dffd6901ebe3accf748ce458d1481a3
Comment 2 Alexandru Damian 2013-10-03 15:21:58 UTC
The layers don't have URLs specified anywhere. So it's a guessed URL.

Not sure what options we have here.
Comment 3 Belen Barros Pena 2013-10-04 11:17:35 UTC
Well, I guess we should be checking for a 404 before displaying the URL, bearing in mind that we cannot condition the display of other content in the page to obtaining a response.

I am cc'ing PaulE: hopefully he has some suggestions for us.
Comment 4 Alexandru Damian 2013-10-04 13:14:10 UTC
Generally speaking, the way to do this would be a XMLHttpRequest. Unfortunately, cross origin requests using XMLHttpRequest are being denied by the browser under the Same Origin Policy. 

This means that we can't check if the target link is a 404 at runtime.  Maybe we can solve this in the layerindex application in the presentation level, i.e. a nicer 404 ?
Comment 5 Belen Barros Pena 2013-10-04 14:17:51 UTC
(In reply to comment #4)
> Generally speaking, the way to do this would be a XMLHttpRequest.
> Unfortunately, cross origin requests using XMLHttpRequest are being denied
> by the browser under the Same Origin Policy. 
> This means that we can't check if the target link is a 404 at runtime. 

Cross-Origin Resource Sharing seems to be well supported

http://caniuse.com/#feat=cors

Is this something we could consider? If not supported by the browser, we consider the check as failed and don't provide the link.

> Maybe we can solve this in the layerindex application in the presentation
> level, i.e. a nicer 404 ?

The alternative is not providing links to the layer index: you should not be showing non-existent URLs to people.  

The issue I have is that right now this is about the layer index, but the idea  is to integrate our web tools (that's why we are moving to this platform), and in order to do so effectively we need to be able to solve this problem.
Comment 6 Alexandru Damian 2013-10-04 15:04:35 UTC
If the layerindex server sends back the header

''Access-Control-Allow-Origin: *'

I can verify non-404 of the destination URL and not show invalid links.
Comment 7 Belen Barros Pena 2013-10-04 15:28:32 UTC
(In reply to comment #6)
> If the layerindex server sends back the header
> 
> ''Access-Control-Allow-Origin: *'
> 
> I can verify non-404 of the destination URL and not show invalid links.

Sounds good :) Now we just need Paul / Michael to confirm if the server can be set up that way.
Comment 8 Alexandru Damian 2013-12-03 18:55:25 UTC
Moved to WaitForUpstream until the layer index application supports this functionality.
Comment 9 Paul Eggleton 2013-12-04 11:35:27 UTC
I'm confused - why do we need the browser to do this via an XMLHttpRequest? Why not just do it on the server side as we're sending the page to the user?
Comment 10 Alexandru Damian 2013-12-05 11:10:26 UTC
Conceptually, this is a presentation issue, so it should be solved at the presentation layer.

Generally speaking, I am totally against implementing this policy, because:
* it drives up the load on the layer-index application, getting lots of hits for content that is not seen by a user
* it raises a privacy problem, as the system will make external network calls to a 3rd party web application without user consent; 

The privacy issue would be alleviated somewhat if the calls are made through a system where there is reasonable expectations of such calls happening, i.e. a browser, instead making calls from the backend itself.

Maybe we should handle this problem somehow else, like embedding URLs into layer git branch descriptions ?
Comment 11 Elliot Smith 2015-09-02 11:15:42 UTC
As we now show the layer index directly, we don't need the layer index URL any more (the user used to be able to visit the URL to get more info. about the layer).
Comment 12 Alexandru Roman 2015-12-04 14:01:31 UTC
Verified.