问题的一部分是浏览器的期望。我在Firefox和Chrome中看到了这一点,结果适用于两个浏览器。这个复制过程从ESK2的一个新引导开始。没有DHCP服务器。我已经连接到Web服务器并点击了NETCONFIG页面。在NETCONFIG页面上没有更改任何东西,我点击了“重新启动界面”ButoNi已经附加了一个WiReSARK的屏幕截图,通过第一个三个参数F的通知。在所有操作系统上,所有的浏览器都是相同的行为,但在这个案例中是这样的。HTTPSPONFIG将找到三个参数并在HtpNETDATA中填充字符串,并设置引导标志,但其他参数(IP,子网掩码、DNS等)永远不会被写入。StncPy永远不会发生在下面:当函数TcPIpH.HTPpPrimtReBug被调用时,它会将字符串(未被更新)复制到TCPIpJETNETWorksCONFIG结构HtpNETDATA.NETFrase:从原始帖子显示的屏幕截图显示IP、子网和其他参数为零,并将调用堆栈。这些字符串在启动后从未用网络配置初始化,例如可以用TCPIPpNetWorksCONFIG数据结构和这些函数:EBOOT函数只能更改在最后一个POST函数中更改的参数。或者网页可以被改变,所以所有参数都在“重启界面”按钮的每一个按下。(不幸的是,我不是一个浏览器行为或Java脚本的专家)---------------响应于你的上一篇文章,DHCP标志实际上是在HTTPSPONCOFIG函数调用中设置的:因为复选框在未选中时不发送“0”,所以简单地省略了从邮包、钻机中的名称/值对。三元运算符的HT手将永远不会分配给StaskFLAG。还要注意的是,当POST值得到“1”时,这不是一个“=”,所以其他的标志被关闭。像我这样的客户会尊重你在演示中改变这段代码的选择。你可以在第一次启动后禁用DHCP的原因是因为这个帖子的前半部分描述了错误。尝试关闭DHCP,然后“重置接口”,然后再次打开它,那么您将无法关闭它,因为从邮包中省略了名称/值“DCHP”。它第一次关闭的唯一原因是因为在一个新的引导程序中StaskFLAG在零上。我可以看到它是如何被忽视的,但是我必须在我的申请中解决这个问题。也许有组合框之类的东西。可能有几种方法来解决这些问题。新的嵌入式Web服务器的用户希望在实践中看到这些功能的一个示例:TCPIpHyStaskMultFigFigGETTCPIPHSTACKNETCONSITSET在邮政处理程序的条目或ReBOOT函数中对HTTP拥有的拷贝进行get集,然后只更改在打印功能。
以上来自于百度翻译
以下为原文
Part of the problem is what to expect from the browser.
I have looked at this in firefox and chrome and the results apply for both browsers.
This process to reproduce starts from a fresh boot of the ESK2. There is no DHCP server present.
I've connected to the web server and clicked on the netconfig page.
Without changing anything on the netconfig page I've clicked the "Restart Interface" button
I have attached a screen shot of wireshark for what comes through via POST
Notice the first three parameters from the form appear, but everything else is omitted.
I am not sure this is the same behavior for all browsers on all operating systems, but it is true in this case.
HTTPPostConfig will find the three parameters and fill the strings in httpNetData, and set the boot flag, but the other parameters (ip, subnet mask, dns, etc...) are never written.
the strncpy never takes place below:
if(!strcmp((char *)httpDataBuff, (const char *)"ip"))
{ // Save new static IP Address
if(!TCPIP_Helper_StringToIPAddress((char *)(httpDataBuff + 6), &newIPAddress))
{
bConfigFailure = true;
break;
}
strncpy(httpNetData.ipAddr, (char *)httpDataBuff + 6, sizeof(httpNetData.ipAddr));
}
when the function TCPIP_HTTP_Print_reboot gets called it will copy the strings (which have not been updated) into the TCPIP_NETWORK_CONFIG structure httpNetData.netConfig
The screen shots from the original post shows the ip, subnet and other parameters as zeroes, and about to call stack up.
Those strings were never initialized with the network config after boot such as could be done with the TCPIP_NETWORK_CONFIG data structure and these functions:
TCPIP_STACK_ModuleConfigGet
TCPIP_STACK_NetConfigSet
Additionally the reboot function could only change parameters that were changed in the last POST function. Or the web page could be changed so all the parameters are submitted on every press of the "Restart Interface" button. (Sadly I am not an expert on browser behavior or java script)
-----------------
In response to your last post, the DHCP flag is actually set in the HTTPPostConfig function call:
else if(!strcmp((char *)httpDataBuff, (const char *)"dhcp"))
{ // Read new DHCP Enabled flag
httpNetData.netConfig.startFlags = httpDataBuff[6] == '1' ? TCPIP_NETWORK_CONFIG_DHCP_CLIENT_ON : 0;
}
because the checkbox does not send a '0' when unchecked, the name/value pair is simply omitted from the POST packet, the right hand side of the ternary operator will never assign to startFlags. Also note when the POST value gets a '1' this is not an |= so other flags that were on get turned off. Customers like me will respect your choice to change this line of code in the demo.
The reason you can disable DHCP after your first boot, is due to the bug described in the first half of this post. Try to turn DHCP off, then "Reset Interface" then turn it on again, then you won't be able to turn it off as the name/value 'dchp' is omitted from the POST packet. The only reason it turned off the first time is because startFlags inits to zero on a fresh boot. I can see how it got overlooked, but I'm going to have to fix this in my application. Perhaps with a combo box or something.
There are probably a few ways to fix these issues. Users new to embedded web servers would like to see an example use of these functions in practice:
TCPIP_STACK_ModuleConfigGet
TCPIP_STACK_NetConfigSet
maybe do a get set on the http owned copy at the entry of the post handler, or reboot function, then only change the parameters that are POSTED in the print function.
Attached Image(s)

问题的一部分是浏览器的期望。我在Firefox和Chrome中看到了这一点,结果适用于两个浏览器。这个复制过程从ESK2的一个新引导开始。没有DHCP服务器。我已经连接到Web服务器并点击了NETCONFIG页面。在NETCONFIG页面上没有更改任何东西,我点击了“重新启动界面”ButoNi已经附加了一个WiReSARK的屏幕截图,通过第一个三个参数F的通知。在所有操作系统上,所有的浏览器都是相同的行为,但在这个案例中是这样的。HTTPSPONFIG将找到三个参数并在HtpNETDATA中填充字符串,并设置引导标志,但其他参数(IP,子网掩码、DNS等)永远不会被写入。StncPy永远不会发生在下面:当函数TcPIpH.HTPpPrimtReBug被调用时,它会将字符串(未被更新)复制到TCPIpJETNETWorksCONFIG结构HtpNETDATA.NETFrase:从原始帖子显示的屏幕截图显示IP、子网和其他参数为零,并将调用堆栈。这些字符串在启动后从未用网络配置初始化,例如可以用TCPIPpNetWorksCONFIG数据结构和这些函数:EBOOT函数只能更改在最后一个POST函数中更改的参数。或者网页可以被改变,所以所有参数都在“重启界面”按钮的每一个按下。(不幸的是,我不是一个浏览器行为或Java脚本的专家)---------------响应于你的上一篇文章,DHCP标志实际上是在HTTPSPONCOFIG函数调用中设置的:因为复选框在未选中时不发送“0”,所以简单地省略了从邮包、钻机中的名称/值对。三元运算符的HT手将永远不会分配给StaskFLAG。还要注意的是,当POST值得到“1”时,这不是一个“=”,所以其他的标志被关闭。像我这样的客户会尊重你在演示中改变这段代码的选择。你可以在第一次启动后禁用DHCP的原因是因为这个帖子的前半部分描述了错误。尝试关闭DHCP,然后“重置接口”,然后再次打开它,那么您将无法关闭它,因为从邮包中省略了名称/值“DCHP”。它第一次关闭的唯一原因是因为在一个新的引导程序中StaskFLAG在零上。我可以看到它是如何被忽视的,但是我必须在我的申请中解决这个问题。也许有组合框之类的东西。可能有几种方法来解决这些问题。新的嵌入式Web服务器的用户希望在实践中看到这些功能的一个示例:TCPIpHyStaskMultFigFigGETTCPIPHSTACKNETCONSITSET在邮政处理程序的条目或ReBOOT函数中对HTTP拥有的拷贝进行get集,然后只更改在打印功能。
以上来自于百度翻译
以下为原文
Part of the problem is what to expect from the browser.
I have looked at this in firefox and chrome and the results apply for both browsers.
This process to reproduce starts from a fresh boot of the ESK2. There is no DHCP server present.
I've connected to the web server and clicked on the netconfig page.
Without changing anything on the netconfig page I've clicked the "Restart Interface" button
I have attached a screen shot of wireshark for what comes through via POST
Notice the first three parameters from the form appear, but everything else is omitted.
I am not sure this is the same behavior for all browsers on all operating systems, but it is true in this case.
HTTPPostConfig will find the three parameters and fill the strings in httpNetData, and set the boot flag, but the other parameters (ip, subnet mask, dns, etc...) are never written.
the strncpy never takes place below:
if(!strcmp((char *)httpDataBuff, (const char *)"ip"))
{ // Save new static IP Address
if(!TCPIP_Helper_StringToIPAddress((char *)(httpDataBuff + 6), &newIPAddress))
{
bConfigFailure = true;
break;
}
strncpy(httpNetData.ipAddr, (char *)httpDataBuff + 6, sizeof(httpNetData.ipAddr));
}
when the function TCPIP_HTTP_Print_reboot gets called it will copy the strings (which have not been updated) into the TCPIP_NETWORK_CONFIG structure httpNetData.netConfig
The screen shots from the original post shows the ip, subnet and other parameters as zeroes, and about to call stack up.
Those strings were never initialized with the network config after boot such as could be done with the TCPIP_NETWORK_CONFIG data structure and these functions:
TCPIP_STACK_ModuleConfigGet
TCPIP_STACK_NetConfigSet
Additionally the reboot function could only change parameters that were changed in the last POST function. Or the web page could be changed so all the parameters are submitted on every press of the "Restart Interface" button. (Sadly I am not an expert on browser behavior or java script)
-----------------
In response to your last post, the DHCP flag is actually set in the HTTPPostConfig function call:
else if(!strcmp((char *)httpDataBuff, (const char *)"dhcp"))
{ // Read new DHCP Enabled flag
httpNetData.netConfig.startFlags = httpDataBuff[6] == '1' ? TCPIP_NETWORK_CONFIG_DHCP_CLIENT_ON : 0;
}
because the checkbox does not send a '0' when unchecked, the name/value pair is simply omitted from the POST packet, the right hand side of the ternary operator will never assign to startFlags. Also note when the POST value gets a '1' this is not an |= so other flags that were on get turned off. Customers like me will respect your choice to change this line of code in the demo.
The reason you can disable DHCP after your first boot, is due to the bug described in the first half of this post. Try to turn DHCP off, then "Reset Interface" then turn it on again, then you won't be able to turn it off as the name/value 'dchp' is omitted from the POST packet. The only reason it turned off the first time is because startFlags inits to zero on a fresh boot. I can see how it got overlooked, but I'm going to have to fix this in my application. Perhaps with a combo box or something.
There are probably a few ways to fix these issues. Users new to embedded web servers would like to see an example use of these functions in practice:
TCPIP_STACK_ModuleConfigGet
TCPIP_STACK_NetConfigSet
maybe do a get set on the http owned copy at the entry of the post handler, or reboot function, then only change the parameters that are POSTED in the print function.
Attached Image(s)

举报