You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cordova.apache.org by GitBox <gi...@apache.org> on 2021/02/10 11:03:06 UTC

[GitHub] [cordova-ios] tudordumitriu opened a new issue #1074: [cordova-ios@6.2.0] CDVURLSchemeHandler WKURLSchemeTask nil HTTPBody of a POST URLRequest

tudordumitriu opened a new issue #1074:
URL: https://github.com/apache/cordova-ios/issues/1074


   # Bug Report
   We have fully set up the cordova-ios 6.2.0 + installed web-proxy plugin + converting all the urls to be routed through the webproxy.
   Unfortunately the very first call fails and after debugging it I have noticed that the urlSchemeTask.request.HTTPBody is nil even though from Javascript the body is correctly set up, in plugin code there is no body ( even though in Javascript the body is a json "{"name":"t","password":"1"}") and the headers are correctly set and transmitted.
   
   The call is correctly routed to our server because the response headers contain the server details but we are getting back a 400 Bad Request.
   If we amend the code of the plugin and force the HTTPBody the server response is successfully returned
   
   Few more (maybe important) details:
   1. The call is a POST to our DB server which is CouchDB (done automatically by PouchDB client DB)
   2. The call is done via XMLHttpRequest
   2. The call is done on HTTPS
   3. All the headers are correctly set up ("Accept":"application/json", "content-type":"application/json")
   
   This issues was originally reported in https://github.com/GEDYSIntraWare/cordova-plugin-webview-proxy/issues/4 but after debugging a little more the problem seems to be in CDVURLSchemeHandler
   
   ## Problem
   Third party plugin cordova-plugin-webview-proxy is not receiving the HttpBody and is not passing it forward.
   
   ### Environment, Platform, Device
   cordova-ios@6.2.0
   iPhone 12 Pro
   
   ### Version information
   <!-- 
   What are relevant versions you are using?
   For example:
   Cordova: Cordova CLI, Cordova Platforms, Cordova Plugins 
   Other Frameworks: Ionic Framework and CLI version
   Operating System, Android Studio, Xcode etc.
   -->
   Cordova:  Cordova 9, Cordova iOS 6.2.0
   Plugins: https://github.com/GEDYSIntraWare/cordova-plugin-webview-proxy
   OS: iOS 14.3 , XCode 12.3
   
   
   ## Checklist
   <!-- Please check the boxes by putting an x in the [ ] like so: [x] -->
   
   - [ x] I searched for existing GitHub issues
   - [x ] I updated all Cordova tooling to most recent version
   - [ x] I included all the necessary information above
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org


[GitHub] [cordova-ios] tudordumitriu commented on issue #1074: [cordova-ios@6.2.0] CDVURLSchemeHandler WKURLSchemeTask nil HTTPBody of a POST URLRequest

Posted by GitBox <gi...@apache.org>.
tudordumitriu commented on issue #1074:
URL: https://github.com/apache/cordova-ios/issues/1074#issuecomment-783492585


   Hi @NiklasMerz 
   Did you manage to reproduce it?
   Do I need to provide extra info or should I try a completely different alternative, because at the time being we're completely stuck.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org


[GitHub] [cordova-ios] tudordumitriu commented on issue #1074: [cordova-ios@6.2.0] CDVURLSchemeHandler WKURLSchemeTask nil HTTPBody of a POST URLRequest

Posted by GitBox <gi...@apache.org>.
tudordumitriu commented on issue #1074:
URL: https://github.com/apache/cordova-ios/issues/1074#issuecomment-778291529


   @NiklasMerz  I have put together and example where xhr body is empty
   https://github.com/tudordumitriu/cordova-webproxy-xhr-test
   No matter what you want to post in body in the plugin code the request has no body.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org


[GitHub] [cordova-ios] NiklasMerz commented on issue #1074: [cordova-ios@6.2.0] CDVURLSchemeHandler WKURLSchemeTask nil HTTPBody of a POST URLRequest

Posted by GitBox <gi...@apache.org>.
NiklasMerz commented on issue #1074:
URL: https://github.com/apache/cordova-ios/issues/1074#issuecomment-783612279


   Unfortunately I don't have the time to look at this right now. I fear you must debug this yourself.
   
   As I never had issues like this so far this could be an edge case specific to your application.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org


[GitHub] [cordova-ios] NiklasMerz commented on issue #1074: [cordova-ios@6.2.0] CDVURLSchemeHandler WKURLSchemeTask nil HTTPBody of a POST URLRequest

Posted by GitBox <gi...@apache.org>.
NiklasMerz commented on issue #1074:
URL: https://github.com/apache/cordova-ios/issues/1074#issuecomment-784898091


   Many times when I build a reproduction I found out something new. It can be a problem in my app or it's easier to debug the minimal reproduction. I hope it HPs you, too.
   
   And we know know where this issue is because of this reproduction. 


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org


[GitHub] [cordova-ios] isc-elizawmatt commented on issue #1074: [cordova-ios@6.2.0] CDVURLSchemeHandler WKURLSchemeTask nil HTTPBody of a POST URLRequest

Posted by GitBox <gi...@apache.org>.
isc-elizawmatt commented on issue #1074:
URL: https://github.com/apache/cordova-ios/issues/1074#issuecomment-929604808


   @tudordumitriu, I am also running into this problem, with the same set up as you describe. When you were able "amend the code of the plugin and force the HTTPBody the server response is successfully returned", are you referring to the cordova-plugin-webview-proxy plugin? Or CDVURLSchemeHandler? Or something else? And how are you forcing the HTTPBody? 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org


[GitHub] [cordova-ios] meiram-tr commented on issue #1074: [cordova-ios@6.2.0] CDVURLSchemeHandler WKURLSchemeTask nil HTTPBody of a POST URLRequest

Posted by GitBox <gi...@apache.org>.
meiram-tr commented on issue #1074:
URL: https://github.com/apache/cordova-ios/issues/1074#issuecomment-861685121


   @tudordumitriu hi,
   I got to this issue my self in the last days. Did you had any progress or new insights that you can share? In my case i post formdata with file in it and got a nil body. 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org


[GitHub] [cordova-ios] tudordumitriu edited a comment on issue #1074: [cordova-ios@6.2.0] CDVURLSchemeHandler WKURLSchemeTask nil HTTPBody of a POST URLRequest

Posted by GitBox <gi...@apache.org>.
tudordumitriu edited a comment on issue #1074:
URL: https://github.com/apache/cordova-ios/issues/1074#issuecomment-784854638


   No worries at all and sorry for being a little pushy, just that it wasn't clear how things are since you requested a reproduction environment and I tried to be intrusive little as possible (not very successful though).
   Good to know that you are using fetch, it helps a lot because I kept on assuming that you were using XHR as well and I thought it was working in your case but not in ours.
   So now at least I know I have to fix it on my own (and PR if I succeed).
   Thanks again for the great work!


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org


[GitHub] [cordova-ios] tudordumitriu commented on issue #1074: [cordova-ios@6.2.0] CDVURLSchemeHandler WKURLSchemeTask nil HTTPBody of a POST URLRequest

Posted by GitBox <gi...@apache.org>.
tudordumitriu commented on issue #1074:
URL: https://github.com/apache/cordova-ios/issues/1074#issuecomment-784175518


   @NiklasMerz 
   That is an entirely new project, created from scratch, and is using vanilla XHR to call, tested on iOS device, cordova 6.2.0., cordova webroxy plugin
   So it has absolutely nothing to do with our app, I have just followed your request in trying to reproduce it, and started from zero, and there are 2 calls to a local API endpoint that can be emulated via any framework.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org


[GitHub] [cordova-ios] NiklasMerz commented on issue #1074: [cordova-ios@6.2.0] CDVURLSchemeHandler WKURLSchemeTask nil HTTPBody of a POST URLRequest

Posted by GitBox <gi...@apache.org>.
NiklasMerz commented on issue #1074:
URL: https://github.com/apache/cordova-ios/issues/1074#issuecomment-784200138


   I understand thanks for the issue and reproduction. It's great to have this simplified example. It's probably a strange quirk that happens with XHR and how we built this proxy. XHR is quite strange and I don't know it well enough. As I am using fetch with no problems I don't see this as an urgent issue. That's why I said it has something to do with they way your app uses this stuff. This new feature in cordova-ios is kind of experimental and "my proxy plugin" you are using is just built for a personal need with no support.
   
   You already did a lot of debugging and might find more about this with your example. Cordova is maintained by volunteers and if you find a specific problem you probably need to fix it yourself. That's how I did it many times in the past and I think you can do it, too. If you find a fix I am happy to help but I cannot do the debugging.
   
   Sorry if this sounds rude but please don't ping me every time. As I am not getting paid to do this work, I just do the stuff I want to. That's the nature of open source for me.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org


[GitHub] [cordova-ios] tudordumitriu commented on issue #1074: [cordova-ios@6.2.0] CDVURLSchemeHandler WKURLSchemeTask nil HTTPBody of a POST URLRequest

Posted by GitBox <gi...@apache.org>.
tudordumitriu commented on issue #1074:
URL: https://github.com/apache/cordova-ios/issues/1074#issuecomment-784854638


   No worries at all and sorry for being a little pushy, just that it wasn't clear how things are since you requested a reproduction environment and I tried to be intrusive little as possible (not very successful though).
   Good to know that you are using fetch, it helps a lot because I kept on assuming that you were using XHR as well and I thought it was working in our case, but is not the case so now at least I know I have to fix it on my own and contribute if I succeed.
   Thanks again for the great work!


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org


[GitHub] [cordova-ios] tudordumitriu commented on issue #1074: [cordova-ios@6.2.0] CDVURLSchemeHandler WKURLSchemeTask nil HTTPBody of a POST URLRequest

Posted by GitBox <gi...@apache.org>.
tudordumitriu commented on issue #1074:
URL: https://github.com/apache/cordova-ios/issues/1074#issuecomment-777639807


   Still working on it, but what we did was to force the usage of fetch (instead of xhr), which did work until we had to upload a file.
   File upload, since we needed upload progress is done via xhr, and it crashes, but what is even more strange is that it crashes in webproxy with "Thread 1: EXC_BAD_ACCESS (code=1, address=0x20)" when accessing the urlSchemeTask.request.URL;
   So I suspect is the same issue, just can't tell what it is yet.
   Will try to create a minimal reproduction environment, even though is quite complicated.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org


[GitHub] [cordova-ios] NiklasMerz commented on issue #1074: [cordova-ios@6.2.0] CDVURLSchemeHandler WKURLSchemeTask nil HTTPBody of a POST URLRequest

Posted by GitBox <gi...@apache.org>.
NiklasMerz commented on issue #1074:
URL: https://github.com/apache/cordova-ios/issues/1074#issuecomment-776652362


   Not sure if this is something we can do about that. Maybe it's something special in your setup.
   
   Did you try using fetch instead of XMLHttpRequest? I am using it successfully for POST requests and never had  any issues with the body.
   
   Could you create a minimal reproduction app?
   
   I think you should investigate this further on your side and may need to patch it yourself. PRs, comments welcome.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org