jenkinsci / jenkinsci/java-client-api

Job.build(Map<String, String> params) results in HTTP 414 (URI too long)

未关闭
#352 4 条评论 1 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
Java
星标
913
派生
466
PR 合并指标
30 天内没有已合并 PR

描述

I've had problems with requests for a parameterized job build:

```
org.apache.http.client.HttpResponseException: Request-URI Too Long
at com.offbytwo.jenkins.client.validator.HttpResponseValidator.validateResponse(HttpResponseValidator.java:11)
at com.offbytwo.jenkins.client.JenkinsHttpClient.post(JenkinsHttpClient.java:232)
at com.offbytwo.jenkins.model.Job.build(Job.java:125)
at com.offbytwo.jenkins.model.Job.build(Job.java:112)
```

Looking at the code, I noticed that `Job.build` encodes the job parameter/values in the URL.
This can result in a very long URL that exceeds the server's max URL size.

I worked around this problem outside of the library by submitting a POST request where the job parameter/values are passed as form data instead of encoded in the url.

贡献指南

打开贡献指南

调研方向

从 Job.java 中参数化的 Job.build 重载开始,跟踪请求直到 JenkinsHttpClient.post。检查当前如何编码参数名称和值,然后将其与报告中的 form-data workaround 进行比较。完成的标准是:参数化构建使用一种请求表示形式,在保留参数的同时避免长值导致的 HTTP 414。

由索引模型根据 Issue 内容生成。

评估

技术栈
java
领域
api
Issue 类型
缺陷
难度
3/5
预计耗时
1-2 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
45/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。