Setting for Curl's PATH_AS_IS flag (Closes #823)

This commit is contained in:
Gregory Schier 2018-03-26 10:43:42 -07:00
parent cbd873febc
commit 87ccc34bad
5 changed files with 21 additions and 2 deletions

View File

@ -291,6 +291,7 @@ export async function getRenderedRequestAndContext (
settingEncodeUrl: renderedRequest.settingEncodeUrl, settingEncodeUrl: renderedRequest.settingEncodeUrl,
settingSendCookies: renderedRequest.settingSendCookies, settingSendCookies: renderedRequest.settingSendCookies,
settingStoreCookies: renderedRequest.settingStoreCookies, settingStoreCookies: renderedRequest.settingStoreCookies,
settingRebuildPath: renderedRequest.settingRebuildPath,
type: renderedRequest.type, type: renderedRequest.type,
url: renderedRequest.url url: renderedRequest.url
} }

View File

@ -61,7 +61,8 @@ type BaseRequest = {
settingStoreCookies: boolean, settingStoreCookies: boolean,
settingSendCookies: boolean, settingSendCookies: boolean,
settingDisableRenderRequestBody: boolean, settingDisableRenderRequestBody: boolean,
settingEncodeUrl: boolean settingEncodeUrl: boolean,
settingRebuildPath: boolean
}; };
export type Request = BaseModel & BaseRequest; export type Request = BaseModel & BaseRequest;
@ -83,7 +84,8 @@ export function init (): BaseRequest {
settingStoreCookies: true, settingStoreCookies: true,
settingSendCookies: true, settingSendCookies: true,
settingDisableRenderRequestBody: false, settingDisableRenderRequestBody: false,
settingEncodeUrl: true settingEncodeUrl: true,
settingRebuildPath: true
}; };
} }

View File

@ -157,6 +157,11 @@ export async function _actuallySend (
setOpt(Curl.option.MAXREDIRS, settings.maxRedirects); setOpt(Curl.option.MAXREDIRS, settings.maxRedirects);
} }
// Don't rebuild dot sequences in path
if (!renderedRequest.settingRebuildPath) {
setOpt(Curl.option.PATH_AS_IS, true);
}
// Only set CURLOPT_CUSTOMREQUEST if not HEAD or GET. This is because Curl // Only set CURLOPT_CUSTOMREQUEST if not HEAD or GET. This is because Curl
// See https://curl.haxx.se/libcurl/c/CURLOPT_CUSTOMREQUEST.html // See https://curl.haxx.se/libcurl/c/CURLOPT_CUSTOMREQUEST.html
switch (renderedRequest.method.toUpperCase()) { switch (renderedRequest.method.toUpperCase()) {

View File

@ -162,6 +162,16 @@ class RequestSettingsModal extends PureComponent {
</HelpTooltip> </HelpTooltip>
</label> </label>
</div> </div>
<div className="form-control form-control--thin">
<label>Rebuild path dot sequences
<HelpTooltip position="top" className="space-left">
This instructs libcurl to squash sequences of "/../" or "/./" that may exist in
the URL's path part and that is supposed to be removed according to RFC 3986
section 5.2.4
</HelpTooltip>
{this.renderCheckboxInput('settingRebuildPath')}
</label>
</div>
</div> </div>
</div> </div>
); );

View File

@ -25,6 +25,7 @@ declare class Curl {
NOPROGRESS: number, NOPROGRESS: number,
NOPROXY: number, NOPROXY: number,
PASSWORD: number, PASSWORD: number,
PATH_AS_IS: number,
POST: number, POST: number,
POSTFIELDS: number, POSTFIELDS: number,
PROXY: number, PROXY: number,