我正在尝试访问Shopware的REST API.我正在使用Shopware的5.1.3版本.我正在使用文档的代码.
我总是得到一个http代码400(无效或缺少身份验证).
当我尝试通过谷歌浏览器访问API时,它使用http身份验证登录后工作,因此凭据应该没问题.
我想Chrome发送的身份验证标头与我使用PHP curl发送的标头不同.
使用Chrome:
Accept:text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
Accept-Encoding:gzip, deflate, sdch
Accept-Language:nl-NL,nl;q=0.8,en-US;q=0.6,en;q=0.4
Authorization:Digest username="demo", realm="Shopware REST-API", nonce="7aa6aa7e8089c60e5930cb45ead39197", uri="/api/articles", algorithm=MD5, response="cee77e425508605dfbcf2deda8f83938", opaque="d75db7b160fe72d1346d2bd1f67bfd10", qop=auth, nc=0000001e, cnonce="8b5121e862c4fce1"
Cache-Control:max-age=0
Connection:keep-alive
Cookie:session-1=2d0cb2941684d2767e76ffeb48c7337706cba39c
Host:shopware.example.com
Upgrade-Insecure-Requests:1
User-Agent:Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/48.0.2564.116 Safari/537.36
Run Code Online (Sandbox Code Playgroud)
使用PHP Curl
GET /api/articles? HTTP/1.1\r\n
Host: shopware.example.com\r\n
Authorization: Digest username="demo",realm="",nonce="806c9770a53bf2f82b87734a9d8eb98c",uri="/api/articles?",cnonce="60e6c8db046db8f4e63fece37e38f92e",nc=00000001,algorithm=MD5,response="299069d4659af386a4ec7058796267c2",qop="auth",opaque="d75db7b160fe72d1346d2bd1f67bfd10"\r\n
User-Agent: Shopware shopwareApiClient\r\n
Accept: */*\r\n
Content-Type: application/json; charset=utf-8\r\n
Content-Length: 2\r\n
Run Code Online (Sandbox Code Playgroud)
额外的PHP curl指令来获取头信息:
curl_setopt($this->cURL, CURLINFO_HEADER_OUT, true);
print_r(curl_getinfo($this->cURL, CURLINFO_HEADER_OUT ));
Run Code Online (Sandbox Code Playgroud)
我使用的代码:
<?php
namespace App;
class shopwareApiClient
{
const METHOD_GET = …Run Code Online (Sandbox Code Playgroud) 我有很多文件只有文件权限不同.但实际上有些文件被修改了.
我想将只有文件权限更改的所有文件添加到自己的提交中.
git --versiongit version 1.8.3.1
Run Code Online (Sandbox Code Playgroud)
git diff 输出:diff --git a/.htaccess b/.htaccess
old mode 100755
new mode 100644
diff --git a/.htaccess.sample b/.htaccess.sample
old mode 100755
new mode 100644
etc...
Run Code Online (Sandbox Code Playgroud)
git diff --name-statusM .htaccess
M .htaccess.sample
M robots.txt
M index.php
etc...
Run Code Online (Sandbox Code Playgroud)
git diff -G. --name-status
Run Code Online (Sandbox Code Playgroud)
输出:
M robots.txt
M index.php
Run Code Online (Sandbox Code Playgroud)
但是如何只添加具有更改权限的文件,这些可以提交?
编辑:
git diff-files100755 100644 fd0fa6002522f4f4bc46e4339671a6ea99969371 0000000000000000000000000000000000000000 M .htaccess
:100755 100644 383313a383445374f63364cd1985753e86418d04 0000000000000000000000000000000000000000 M .htaccess.sample
:100644 100644 e09ab6b6b0cf13a895d00ec97dae12d8ba2c364b 0000000000000000000000000000000000000000 M robots.txt
:100755 100644 56bdb6c86654bdba26b750d36db17b5e15279c86 0000000000000000000000000000000000000000 M …Run Code Online (Sandbox Code Playgroud) 我有一个 Kubernetes 集群(外部 ips:1.2.3.4、2.3.4.5、3.4.5.6)我想在这个集群上的 5000 端口上托管一个 docker 注册表。现在为了启用这个,我用 externalips 做了一个测试,它可以工作。这使得 nginx 在端口 85 上可用。
apiVersion: v1
kind: Service
metadata:
name: nginx-extip
spec:
type: ClusterIP
ports:
- name: http
protocol: TCP
port: 85
targetPort: 80
selector:
app: nginx-extip
externalIPs:
- 1.2.3.4
- 2.3.4.5
- 3.4.5.6
---
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: nginx-extip
spec:
replicas: 1
template:
metadata:
labels:
app: nginx-extip
spec:
containers:
- name: nginx-extip-server
image: nginx
ports:
- containerPort: 80
Run Code Online (Sandbox Code Playgroud)
现在要重用 externalip 配置,我想把它放到一个 configmap 中。所以所有的 yaml 都可以只引用 configmap 并且我们不必在它们更改时手动更新 …