Hi All,
I am developing HTTP server with EK-TM4C1294XL board.
There is one question.
Is it possbile to show different HTML page for mobile browser and normal PC browser ?
If possible, please let me know how to do.
Best Regards,
Hea Ryong
This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Hi All,
I am developing HTTP server with EK-TM4C1294XL board.
There is one question.
Is it possbile to show different HTML page for mobile browser and normal PC browser ?
If possible, please let me know how to do.
Best Regards,
Hea Ryong
Hello Murat,
Thanks for your response.
It could be helpful for normal solution.
please let me describe my problem more detail.
I think HTTP message is delivered to HTTP server in RTOS, so I cannot identify what HTTP parameters are in the HTTP message, since message is parsed inside of HTTP server.
Is there a way to know the parsed parameters outside of HTTP server ?
How to add my code in the HTTP server ?
Expecting your feedback.
Thanks a lot.
Best Regards,
Hae Ryong
Hi Murat,
Sorry for late responding.
please refer to following simple test project.
it requires login info to connect HTTP server, id:user, password:0000 <- number zero, not character 'O', you can see at net_utils.c
if you need anything, please let me know.
Thanks in advance,
Best Regards,
Hae Ryong
Hi Hae,
I am not sure what stage your current project that you shipped is in, but I couldn't import the project file into CCS and instead looked at the sources in the zip file, I don't see any http server related code or API calls. I suspect relavant parts are omitted, and I don't have anything to go by.
It is not clear what http server code you are running, you said you use TI-RTOS, but I need more specific and useful information in order to be able to help,
Best regards,
Murat
Hi Murat,
I don't understand that situation.
As I have tried, it worked fine. although it is simplfied snippet from actual project.
My test environment, PC - personal router - EK-TM4C1294XL
You can see HTTP server is enabled by looking at base.cfg
var Tcp = xdc.useModule('ti.ndk.config.Tcp'); var Ip = xdc.module('ti.ndk.config.Ip'); Ip.hostName = "ACU1"; Ip.autoIp = false; Ip.address = "192.168.0.14"; Ip.mask = "255.255.255.0"; Ip.gatewayIpAddr = "192.168.0.1"; Ip.domainName = "ACU1.net"; var Http = xdc.useModule('ti.ndk.config.Http'); var http0Params = new Http.Params(); http0Params.CallByIP = true; http0Params.mode = 4; var http0 = Http.create(http0Params);
and authentication info is in netOpenHook() of net_utils.c
when I run the code, console log showed as follows
Using MAC address in flash
Network Added: If-1:192.168.0.14
Service Status: HTTP : Enabled : : 000
I have attached zip with build files including execution file.
please check again. I'm sure it works.
Best Regards,
Hae Ryong
Hi Hae,
Ok, I see you are using the NDK http. I looked at the documentation in:
and I don't see any APIs exposing you to the http payload received by the server directly.
Looking at the example in section E.4.2. the closest thing I can see is if you could experiment with supplying a similar cgi function for HTTP GET requests and see what you can access in the htmlSock connection. This example is using a provided cgiParse() function to parse contents of the socket, but you might want to just inspect and see if any HTTP header content is available. If so, then you can use the "User-Agent" info as I mentioned above. If not, I don't see any published API that lets you process the HTTP header data, but I will consult with the developers to see if we can get more insights.
Best regards,
Murat
The development team came back with an aswer confirming my earlier comment, stating that there is no public API for parsing HTTP headers in NDK.
You can add the required abiliy to parse these headers on your own until a public feature is released, you would have to modify httpClientProcess() in ti\ndk\nettools\http\httpclie.c. This is where the parsing of the header occurs.
I will file an enhancement request for that, and in the meanwhile we can close this thread.
Best regards,
Murat