1 Star 0 Fork 32

靳智敏/cups

forked from src-openEuler/cups 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
cups-ipptool-mdns-uri.patch 1.48 KB
一键复制 编辑 原始数据 按行查看 历史
weiwei_150212 提交于 2020-07-27 18:06 . version update
diff --git a/cups/ipp-vars.c b/cups/ipp-vars.c
index 395b0eb..60aa991 100644
--- a/cups/ipp-vars.c
+++ b/cups/ipp-vars.c
@@ -13,6 +13,7 @@
*/
#include <cups/cups.h>
+#include <cups/cups-private.h>
#include "ipp-private.h"
#include "string-private.h"
#include "debug-internal.h"
@@ -221,9 +222,29 @@ _ippVarsSet(_ipp_vars_t *v, /* I - IPP variables */
if (!strcmp(name, "uri"))
{
char uri[1024]; /* New printer URI */
+ char resolved[1024]; /* Resolved mDNS URI */
+ char value_uri[1024]; /* URI from value */
http_uri_status_t uri_status; /* URI status */
- if ((uri_status = httpSeparateURI(HTTP_URI_CODING_ALL, value, v->scheme, sizeof(v->scheme), v->username, sizeof(v->username), v->host, sizeof(v->host), &(v->port), v->resource, sizeof(v->resource))) < HTTP_URI_STATUS_OK)
+ snprintf(value_uri, sizeof(value_uri), "%s", value);
+ value_uri[1023] = '\0';
+
+ if (strstr(value_uri, "._tcp"))
+ {
+ /*
+ * Resolve URI...
+ */
+
+ if (!_httpResolveURI(value_uri, resolved, sizeof(resolved), _HTTP_RESOLVE_DEFAULT, NULL, NULL))
+ {
+ return (0);
+ }
+
+ snprintf(value_uri, sizeof(value_uri), "%s", resolved);
+ value_uri[1023] = '\0';
+ }
+
+ if ((uri_status = httpSeparateURI(HTTP_URI_CODING_ALL, value_uri, v->scheme, sizeof(v->scheme), v->username, sizeof(v->username), v->host, sizeof(v->host), &(v->port), v->resource, sizeof(v->resource))) < HTTP_URI_STATUS_OK)
return (0);
if (v->username[0])
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/jinzhimin369/cups.git
git@gitee.com:jinzhimin369/cups.git
jinzhimin369
cups
cups
master

搜索帮助

D67c1975 1850385 1daf7b77 1850385