CefRegisterScheme and HTTP Status Codes

Think CEF could benefit from a new feature or capability? Discuss CEF feature requests here.

CefRegisterScheme and HTTP Status Codes

Postby crazyfunrandom » Wed Mar 09, 2011 12:57 pm

Hey,

I am looking at creating a custom scheme for my application, but noticed there was no way to return a valid HTTP status code (for example 404 when the page requested is not valid). Any thoughts on how to implement this?

Cheers,
-cfr
crazyfunrandom
Newbie
 
Posts: 8
Joined: Wed Mar 09, 2011 12:51 pm

Re: CefRegisterScheme and HTTP Status Codes

Postby magreenblatt » Wed Mar 09, 2011 2:58 pm

With CEF you control how the browser behaves and how the scheme provides data. What are you expecting the browser to do with a 404 that you can't do from within your scheme implementation?
magreenblatt
Site Admin
 
Posts: 12383
Joined: Fri May 29, 2009 6:57 pm

Re: CefRegisterScheme and HTTP Status Codes

Postby crazyfunrandom » Wed Mar 09, 2011 4:13 pm

I am trying to create code the is cross platform and want the JavaScript logic to be able to handle the result. Especially when processing XMLHttpRequests.
crazyfunrandom
Newbie
 
Posts: 8
Joined: Wed Mar 09, 2011 12:51 pm

Re: CefRegisterScheme and HTTP Status Codes

Postby magreenblatt » Wed Mar 09, 2011 4:32 pm

Instead of relying on the XHR request to fail you can have the custom scheme handler return data that the JavaScript can identify as an error result. For example, return "404" to indicate that the content was not available. You might also want to consider using HandleBeforeResourceLoad instead of a custom scheme handler.

A related issue:
http://code.google.com/p/chromiumembedd ... ail?id=168
magreenblatt
Site Admin
 
Posts: 12383
Joined: Fri May 29, 2009 6:57 pm

Re: CefRegisterScheme and HTTP Status Codes

Postby crazyfunrandom » Wed Mar 09, 2011 4:42 pm

I looked at HandleBeforeResourceLoad, and saw the same thing. I currently have a web app that uses jquery and processes based on status codes from the server. Ideally I want to be able to use the same code for both. Sometimes the server returns a status ( not 200 ) and data and I want to pass them both along without manipulating the data.
crazyfunrandom
Newbie
 
Posts: 8
Joined: Wed Mar 09, 2011 12:51 pm

Re: CefRegisterScheme and HTTP Status Codes

Postby magreenblatt » Wed Mar 09, 2011 4:52 pm

I currently have a web app that uses jquery and processes based on status codes from the server. Ideally I want to be able to use the same code for both. Sometimes the server returns a status ( not 200 ) and data and I want to pass them both along without manipulating the data.

OK, that sounds reasonable. Go ahead and create an issue in the CEF issue tracker named something like "make custom schemes and HandleBeforeResourceLoad return HTTP status codes for jQuery XHR" and linking to this thread.

Thanks,
Marshall
magreenblatt
Site Admin
 
Posts: 12383
Joined: Fri May 29, 2009 6:57 pm

Re: CefRegisterScheme and HTTP Status Codes

Postby crazyfunrandom » Wed Mar 09, 2011 4:58 pm

Thank you. Issue 202 created.
crazyfunrandom
Newbie
 
Posts: 8
Joined: Wed Mar 09, 2011 12:51 pm


Return to Feature Request Forum

Who is online

Users browsing this forum: No registered users and 21 guests