AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / server / 问题

问题[curl](server)

Martin Hope
matead
Asked: 2023-06-14 12:23:54 +0800 CST

Jira - REST API 在一个 VPS 上返回 HTML 但在另一个 VPS 上返回 JSON

  • 5

我面临一个非常奇怪的问题,我无法解决。基本上,我有 2 台 VPS 机器,我通过 RDP 连接它们,因为它们都是 Windows Server 机器。我对它们都有卷曲。一个运行的是 Windows Server 2016,我们称之为服务器 A。另一个运行的是 Windows Server 2022,我们称之为服务器 B。

如果我curl https://jira.mysite.com:2053/rest/api/2/serverInfo在服务器 A 上运行,我会得到一个有效的 JSON 响应,它是

{"baseUrl":"https://jira.mysite.com:2053","version":"8.22.2","versionNumbers":[8,22,2],"deploymentType":"Server","buildNumber":822002,"buil
dDate":"2022-04-20T00:00:00.000+1000","databaseBuildNumber":822002,"scmInfo":"266c8f51e3b1a891285d611f42f1d6c4389222af","serverTitle":"MY SERVER"
}

但是,如果我curl https://jira.mysite.com:2053/rest/api/2/serverInfo在服务器 B 上运行,我会得到 HTML

<!DOCTYPE html>
<html lang="en-US">
<head>
    <title>Just a moment...</title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=Edge">
    <meta name="robots" content="noindex,nofollow">
    <meta name="viewport" content="width=device-width,initial-scale=1">
    <link href="/cdn-cgi/styles/challenges.css" rel="stylesheet">


</head>
<body class="no-js">
...etc

到底是怎么回事。为什么我没有在服务器 B 上取回 JSON?这完全没有意义。

我唯一的猜测是 DNS 可能仍在传播并且 SERVER B 正在从一个旧 IP 地址中提取,但是我更新 DNS 已经 4 个小时了,所以我怀疑这就是问题所在。

任何建议,将不胜感激。谢谢。

curl
  • 1 个回答
  • 17 Views
Martin Hope
A L
Asked: 2021-12-10 11:47:56 +0800 CST

curl --insecure 不工作

  • 0

我需要在代理后面运行以下内容:

curl -L "https://packages.gitlab.com/install/repositories/runner/gitlab-runner/script.deb.sh" | sudo bash

哪个返回了与 SSL 相关的错误(因为代理将其证书放在两者之间)。我使用了“--insecure”并重新运行,这在一定程度上可以工作,但是-稍后在该安装脚本中,再次调用 curl,并返回相同的 SSL 错误。

我在 ~/.curlrc 中添加了“不安全”,以便调用脚本会忽略 SSL 错误..但是它们仍然会被抛出..如果我从一开始就放弃 --insecure 它仍然有效(验证 .curlrc 工作)..所以我认为这一定是权限问题..

Ran 'chmod 666 .curlrc' 并使用 'ls -l' 验证了所有的 rw - 结果相同。如何忽略这些 SSL 错误?

curl
  • 0 个回答
  • 504 Views
Martin Hope
tio oit
Asked: 2021-11-16 03:41:21 +0800 CST

curl 表示有效证书已过期

  • 1

我有一个托管在服务器上的 gitlab 社区版,当在此服务器上使用 curl 获取此本地 gitlab 网站时,即使日期有效,我也会收到过期证书错误:

curl --insecure -vvI https://gitlab.mysite.com 2>&1 | awk 'BEGIN { cert=0 } /^\* Server certificate:/ { cert=1 } /^\*/ { if (cert) print }'
* Server certificate:
*  subject: CN=gitlab.mysite.com
*  start date: Nov 12 14:36:12 2021 GMT
*  expire date: Feb 10 14:36:11 2022 GMT
*  issuer: C=US; O=Let's Encrypt; CN=R3
*  SSL certificate verify result: certificate has expired (10), continuing anyway.

但是从浏览器加载站点或在另一台服务器上使用 curl 时,我没有收到此过期证书错误。该错误仅在托管 gitlab ce 实例的服务器上本地使用 curl 时出现。

这是在另一台服务器上使用 curl 时的结果:

* Server certificate:
*  subject: CN=gitlab.mysite.com
*  start date: Nov 12 14:36:12 2021 GMT
*  expire date: Feb 10 14:36:11 2022 GMT
*  issuer: C=US; O=Let's Encrypt; CN=R3
*  SSL certificate verify ok.

由于 curl 正在解析到本地网站(已解析 ip = 127.0.1.1),是否可能存在问题?

certificate curl gitlab
  • 1 个回答
  • 3183 Views
Martin Hope
northport
Asked: 2021-09-16 22:39:00 +0800 CST

cURL POST bash 脚本将单引号添加到带空格的变量中

  • 0

前 3 个变量将始终没有空格。第四个“ slacksitename”有空格

ip=“x.x.x.x"
record_name=“demo.xyz"
slackuri:”WEBHOOK"
slacksitename:”123 Main St"

使用 cURL 调用时

curl -X POST -H 'Content-type: application/json' --data '{"text":"’$slacksitename': '$ip' '$record_name' DDNS updated.”}’ $slackuri

输出如下:

curl -X POST -H 'Content-type: application/json' --data '{"text":"123' Main 'St: x.x.x.x demo.xyz DDNS updated."}' https://hooks.slack.com/services/……..
curl: (6) Could not resolve host: Main
curl: (3) unmatched close brace/bracket in URL position 59:
St: x.x.x.x demo.xyz DDNS updated."

有谁知道它为什么要添加单引号123' Main 'St?以及我如何将整个变量视为一个字符串而不是拆分它(这就是我认为它正在做的事情)?

谢谢

更新:已解决^^

跟进:

这可能与原始问题的思路相同:

我有一个变量,它是我想通过 cURL 发送的 JSON 输出。我假设问题再次是引号,但 JSON 输出可能会改变(引号数)。有没有办法在消息中用新行发送带有 cURL 的原始数据?谢谢

DUMPING RESULTS:\n{"result":{"id":"ppbkbz2ezmxen11vvpi65chsro1vki5y","zone_id":"unuM0sR1gSrQ37r9fGC1sYKFZOP0DzJM","zone_name":"demo.xyz","name":"1.demo.xyz","type":"A","content":"x.x.x.x","proxiable":true,"proxied":false,"ttl":1,"locked":false,"meta":{"auto_added":false,"managed_by_apps":false,"managed_by_argo_tunnel":false,"source":"primary"},"created_on":"2020-06-14T19:13:57.096688Z","modified_on":"2021-10-16T16:57:49.269274Z"},"success":true,"errors":[],"messages":[]}."
linux bash curl shell-scripting
  • 2 个回答
  • 3472 Views
Martin Hope
Ken Tsoi
Asked: 2021-07-29 06:18:03 +0800 CST

cURL 可以连接到 localhost 但浏览器不能

  • 2

我的系统是带有 WSL2 的 Win10,我运行了一个 dockergogs容器(来自 WSL 中的 ubuntu):

    83b2a8833235   gogs/gogs                    "/app/gogs/docker/st…"   17 minutes ago   Up 17 minutes   0.0.0.0:10022->22/tcp, :::10022->22/tcp, 0.0.0.0:10080->3000/tcp, :::10080->3000/tcp       gogs

我发现我可以cURL它,但不能使用浏览器访问它:

    >curl -vvv http://localhost:10080
    * Rebuilt URL to: http://localhost:10080/
    *   Trying ::1...
    * TCP_NODELAY set
    * Connected to localhost (::1) port 10080 (#0)
    > GET / HTTP/1.1
    > Host: localhost:10080
    > User-Agent: curl/7.55.1
    > Accept: */*
    >
    < HTTP/1.1 302 Found
    < Content-Type: text/html; charset=utf-8
    < Location: /install
    < Set-Cookie: lang=en-US; Path=/; Max-Age=2147483647
    < Set-Cookie: i_like_gogs=64602dcbf733a9e0; Path=/; HttpOnly
    < Set-Cookie: _csrf=CEoPJD9KItxBKOThbeQExNAjnDo6MTYyNzQ4MDI3Njg1MDY2NTEwMA; Path=/; Domain=localhost; Expires=Thu, 29 Jul 2021 13:51:16 GMT; HttpOnly
    < X-Content-Type-Options: nosniff
    < X-Frame-Options: DENY
    < Date: Wed, 28 Jul 2021 13:51:16 GMT
    < Content-Length: 31
    <
    <a href="/install">Found</a>.
    
    * Connection #0 to host localhost left intact

使用netstat -a -o我可以在 Active Connections 中看到地址:

TCP    0.0.0.0:10080          xxxxxxx:0          LISTENING       13152

但我无法使用浏览器访问: 无法使用浏览器访问

有人有任何提示吗?

netstat curl windows-10 windows-subsystem-for-linux
  • 1 个回答
  • 2432 Views
Martin Hope
Ajit Soman
Asked: 2021-04-11 02:21:53 +0800 CST

使用 & 不带单引号点击 curl 命令时的不同响应

  • 0

我正在使用 curl 命令点击admissionAD API 。

如果我低于 URL

curl -L -H 'Authorization: Bearer MY_TOKEN' -X GET https://api.admitad.com/payments/?limit=2&has_statement=0

我得到回应

 {
    "_meta": {
        "count": 21,
        "limit": 2,
        "offset": 0
    },
    "results": [{},{}]
 }

但是如果我点击这个 URL,请注意 URL 用双引号括起来

curl -L -H '授权:承载 MY_TOKEN' -X GET "https://api.admitad.com/payments/?limit=2&has_statement=0"

我无法得到有效的回应

{
    "_meta": {
        "count": 0,
        "limit": 2,
        "offset": 0
    },
    "results": []
}

我什至在邮递员中试过这个,但它也给出了无效的响应

请帮忙

ubuntu http curl
  • 1 个回答
  • 1057 Views
Martin Hope
Грузчик
Asked: 2021-04-06 10:03:40 +0800 CST

如何使用 curl 和 telnet 而不是 cgi-fcgi?

  • 0

我正在使用这个 script.c:

#include <fcgi_stdio.h>
#include <stdlib.h>
int main (void) {
while (FCGI_Accept() >= 0) {
    printf("Status: 200 OK\r\n");
    printf("Content-type: text/html\r\n\r\n");
    printf("<!doctype><html><body>Welcome!</body></html>\n");
}
return EXIT_SUCCESS;
}

我编译它使用

gcc script.c -o script.fcgi -lfcgi -O3 -Wall -Wextra -pedantic -std=c11

然后,我输入终端:

 cgi-fcgi -start -connect localhost:9000 script.fcgi
 cgi-fcgi -connect localhost:9000 script.fcgi

并获得输出

Status: 200 OK
Content-type: text/html

<!doctype><html><body>Welcome!</body></html>

之后,我使用了 curl

 curl localhost:9000
 curl: (52) Empty reply from server

和远程登录

 telnet localhost 9000
 Connected to localhost.
 GET / HTTP/1.1
 Connection closed by foreign host.

为什么我只使用 cgi-fcgi 获得成功结果?如何使用 curl 和 telnet 从脚本中获取相同的数据?

fastcgi telnet curl linux-networking
  • 1 个回答
  • 1142 Views
Martin Hope
Sheile
Asked: 2021-03-08 23:49:34 +0800 CST

zsh 在安装新二进制文件后使用旧二进制文件

  • 0

我已经从源代码升级curlconfigure和. 但是,我的 zsh 使用旧版本的二进制文件。这种行为的原因是什么?makesudo make install

环境

  • CentOS Linux 版本 7.8.2003
  • zsh 5.3.1
  • 抗原

流程

  1. 安装 curl 7.75
  2. curl --version运行旧版本(7.29)
  3. /usr/local/bin/curl --version运行新版本(7.75)
$ curl --version
curl 7.29.0 (x86_64-redhat-linux-gnu)  (snip)

$ which curl
/usr/local/bin/curl

$ /usr/local/bin/curl --version
curl 7.75.0 (x86_64-pc-linux-gnu)  (snip)

如果我PATH不更改就编写环境变量,zsh 运行没有绝对路径的新版本。

$ curl --version
curl 7.29.0 (x86_64-redhat-linux-gnu)  (snip)

$ export PATH=$PATH

$ curl --version
curl 7.75.0 (x86_64-pc-linux-gnu)  (snip)
linux centos zsh curl
  • 1 个回答
  • 52 Views
Martin Hope
ad2711
Asked: 2021-02-26 09:15:59 +0800 CST

使用 Gitbash 与 windows 命令提示符时的不同 curl 响应

  • 0

我有一个 https RESTful 端点,我使用如下命令使用 curl 进行查询:

curl -k --cert client-cert.pem:password https://[email protected]/api/vi/getinfo

在Gitbash 中,这可以工作并返回数据。

从windows 命令提示符完全相同的命令返回错误:

curl: (35) schannel: next InitiaizeSecurityContent failed: SEC_E_CERT_UNKNOWN (0x80090327) - 处理证书时发生未知错误

我的问题是:Windows 命令提示符对 Gitbash 有什么不同以使其失败?,有没有我可以改变的设置?

windows https curl
  • 1 个回答
  • 948 Views
Martin Hope
jergan95
Asked: 2021-02-01 12:35:50 +0800 CST

Kubernetes 集群中的 curling 服务被公司代理阻止

  • 0

我有一个在公司代理后面运行的 Kubernetes 集群。我没有使用 Minikube。我有http_proxy,https_proxy并no_proxy设置在 //etc/environment. no_proxy 有 127.0.0.0 和每个 node-ip 定义。

如果我尝试从我的主节点使用 ClusterIP 卷曲服务,我会陷入公司代理。我需要做什么才能访问该服务?将服务更改为 NodePort 并从集群外部访问它是可行的。

我希望有人可以向我解释我所缺少的。提前致谢。

部署和服务的 Yaml 文件

apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    run: app
  name: app-blue
spec:
  replicas: 1
  selector:
    matchLabels:
      run: app
      version: 0.0.1
  template:
    metadata:
      labels:
        run: app
        version: 0.0.1
    spec:
      containers:
      - name: app
        image: errm/versions:0.0.1
        ports:
        - containerPort: 3000
----



apiVersion: v1
kind: Service
metadata:
  name: app-service
spec:
  selector:
    run: app
    version: 0.0.1
  ports:
  - name: http
    port: 80
    protocol: TCP
    targetPort: 3000

Kubectl 描述服务

Name:              app-service
Namespace:         default
Labels:            <none>
Annotations:       <none>
Selector:          run=app,version=0.0.1
Type:              ClusterIP
IP Families:       <none>
IP:                10.107.64.107
IPs:               10.107.64.107
Port:              http  80/TCP
TargetPort:        3000/TCP
Endpoints:         10.244.2.4:3000
Session Affinity:  None
Events:            <none>

从主节点卷曲

curl 10.107.64.107:80
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3c.org/TR/1999/REC-html401-19991224/loose.dtd">
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html lang="de" lang="de" xml:lang="de" xmlns="http://www.w3.org/1999/xhtml">

<!--Head-->
<head>
  <meta content="IE=11.0000" http-equiv="X-UA-Compatible">
  <meta http-equiv="content-type" content="text/html; charset=utf-8">
  <title>McAfee Web Gateway - Notification</title>
  <script src="/mwg-internal/de5fs23hu73ds/files/javascript/sw.js" type="text/javascript" ></script>
  <link rel="stylesheet" href="/mwg-internal/de5fs23hu73ds/files/default/web.css" />
</head>
<!--/Head-->
<!--Body-->
<body  onload="swOnLoad();" class="background">
<div class="inner_frame">
<div class="head_right_text">
<img alt="Logo" class="emblem" src='/mwg-internal/de5fs23hu73ds/files/default/img/wappen.png'>
</div>

<img alt="Logo" class="lion_left" src='/mwg-internal/de5fs23hu73ds/files/default/img/bg_loewe_links.png'>
<img alt="Logo" class="lion_right" src='/mwg-internal/de5fs23hu73ds/files/default/img/bg_loewe_rechts.png'>

<!--Contents-->
<div class="msg_border">
<div class="msg_head">
Keine Verbindung m&ouml;glich.
</div>
<div class="msg_text">

<p>
Der Proxy hat eine ung&uuml;ltige Antwort erhalten.
</p>
</div>
</div>

<!--/Contents-->
</div>
</body>
<!--/Body-->
</html>
service proxy kubernetes curl
  • 1 个回答
  • 92 Views

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    新安装后 postgres 的默认超级用户用户名/密码是什么?

    • 5 个回答
  • Marko Smith

    SFTP 使用什么端口?

    • 6 个回答
  • Marko Smith

    命令行列出 Windows Active Directory 组中的用户?

    • 9 个回答
  • Marko Smith

    什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同?

    • 3 个回答
  • Marko Smith

    如何确定bash变量是否为空?

    • 15 个回答
  • Martin Hope
    Tom Feiner 如何按大小对 du -h 输出进行排序 2009-02-26 05:42:42 +0800 CST
  • Martin Hope
    Noah Goodrich 什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同? 2009-05-19 18:24:42 +0800 CST
  • Martin Hope
    Brent 如何确定bash变量是否为空? 2009-05-13 09:54:48 +0800 CST
  • Martin Hope
    cletus 您如何找到在 Windows 中打开文件的进程? 2009-05-01 16:47:16 +0800 CST

热门标签

linux nginx windows networking ubuntu domain-name-system amazon-web-services active-directory apache-2.4 ssh

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve