URL Parsing Full Guide: scheme, host, query and abnormal links
When you place a link three times a line, and you turn the gateway 400, saying the parameters are wrong, or the front-end route and back-end API is saying "who should decode" to each other, the most convenient thing is to put URLs in the wrong place. Split into scheme / host / path / Qury / Hash Look at each item. This Guide covers normal dismantling, missing protocol completion, abnormal input and coding tools against the true behaviour of the KiloCell of cells.
The core sentence.
The answer is "What does this string read in the standard URL syntax?" Encoding answers "How Special Characters Safely Put In Components". First, you can see which section of the location is bad, then you can decide whether to go to the coding tool.
Main tools:URL Parsing and Builder。 Encoding/Decoding Single Characters URL encoding。
1. Standard parts contrast
An example (the example of a URL in the tool) is given:
https://www.example.com:8080/path/to/resource?id=123&category=web&utm_source=google#details
| Component | Value in Example | Common uses |
|---|---|---|
| protocol | https: |
Transmission and security expectations |
| hostname | www.example.com |
Virtual Host, Cookie Field |
| port | 8080(non-default) |
Local connection, multi-service |
| pathname | /path/to/resource |
Routes, static resources |
| search / query | ?id=123&... |
Filter, UTM, API parameters |
| hash | #details |
Front end route, foothold (usually no service) |
| origin | https://www.example.com:8080 |
CORS, Post-Sir |
| username/password | (if there is a userinfo) | (b) Essential certification; Should avoid including shared links |
The tool is analyzed and displayed:
- Visualization of StructuresColour Session
- Foundation componentCards (href, protocol, hostname, port, pathname, origin, Hash), copyable
- Query Parameter TableKey pairing (passing)
URLSearchParams) and can copy a single value
Achieve a browser-based approach URL Construct functions; None :// It automatically presets http:// Re-deconcile.
2. Analysis of the vs code: When and by whom
| Tasks | With who? | Reason |
|---|---|---|
| See if the long links, the UTMs are all in place. | URL Parsing | Structured Presentation + Parameter Table |
Chinese, spaces,& What should I do? |
URL encoding | Focus on code change |
| Determines whether the Hash is received by the backend | Parsing Look, Hash; See if the request is only path+query | Hash default not to request a line for HTTP |
| Fix Double Encoding | First, read the current value and then decomposing it at the level of the encoding tool. | Avoid blind loops |
| Link field of json | (a) Parsing check; Beautiful JSON with JSON tool | Divisions |
PUT:(b) The use of a solver for structural problems; character escapes the encoder.
3. Unusual and "can read but not be correct"
| Enter Form | Tool behaviour orientation | Operational risk |
|---|---|---|
Missing protocol example.com/a?b=1 |
Patch http:// Post parsing |
Production should be https not misled by completion |
| Empty Input | Hide Result Area | — |
Illegally not. new URL |
Silent display (no big word misdeed) | Don't think "no response is success." |
Repeat Keys ?a=1&a=2 |
searchParams List multiple |
Service-end take first/ last to agree |
| Frontend route for Hash only | Depending on the full URL | Query, very common. |
| Full-angle symbol, error spaces | Maybe it's a mistake or a host freak. | Clean up from chat software when copying |
| user:pass@host | Visualization may show userinfo | BanPut the real password in the URL share |
| It's a long time. | Parsable but intermediate may be cut | The gateway limits are to be measured separately. |
| Mixed Encoded/Unencoded | Parameter table shows the logical values after decoded | Originalwire format to see network panel |
Example of intentional unlawful (do not expect stable resolution):
https://exa mple.com/path http://[断掉It's...IPv6 not a url at all%%%
Should be completed as a valid absolute URL or clearly as a relative path (relative path pairs) URL There is a constant need for a base, which is mainly oriented towards complete absolute form).
4. Phased operation
- Open /tools/dev/url-parser。
- Paste complete URLs into text boxes; Support
oninputInstant Parsing- I can do it. Parsing Now。 - See if the structure is consistent with expectations (agreement/ host/ port/ path/ query/ Hash).
- Confirm hostname, port (default display) and pathname in widget cards.
- Check UTM, id, etc. on the parameter table line by line; Points Copy Take the single value.
- Points Example URL (b) The possibility of including examples of learning;Empty End debugging.
- If a parameter value is still
%E4%B8%AD...Or you need to recode it to URL encoding。
Capacity boundaries
- Support: Parsing displays, adding http, argument tables, copying, examples, themes when protocols are missing.
- The title contains "Construction": The project is based on a process of analysis and presentation. Complex interactive re-entry is based on the actual control of the page (the current main path is the resolution).
- No substitute: Full text of catch-up tools, service-end truth, open-directed security audits.
Common intercommation error tables
| phenomena | Common causes | Processing |
|---|---|---|
| Backend cannot receive token from lash | Hash no request | Move to query or header and evaluate leaks |
Parameter interrupted in first & |
Uncoded value & |
Encode the logarithmics and then spell it. |
| Chinese Chaos | Number of code layers not consistent | (b) Parsing the logical value; Contrast Content-Type and Library |
Too many. http://http:// |
There's a deal and it's manual. | - Get rid of the repetition. |
| Cookie, no. | Field/ Path/Secure does not match URL | See whether hostname and https |
| CORS Failed | Origin is not on the white list. | Copy origin card compared to gateway configuration |
| Short-chain jumps and drops. | 302 Unencumbered Quary | Parsing jumps before and after 2 URLs |
| No, no, no, no, no, no, no, no, no, no. | Illegal URL caught | Check spaces, quotes, missing hosts |
| Port '(Default) 'but also error-making | 80/443 actual, but omitted | Visible writing port parsing contrast |
| Put the utrinfo password on the worksheet. | History | Rotate the vouchers and change them to Header. |
6. Real work scene
Scenario A: Market Department UTM Long Chain
Check in argument table after pasting utm_source / utm_campaign Whether to be cut by the mail client. The chain is regenerated with a 2-D code.
Scenario B: Open Redirection Suspect
Parsing redirect Parameter values are absolute URLs in the outer field. The security strategy should verify the list of permitted items; The tools only help you.Yeah.Target, do not make a list of permissions for you.
C: Controversy over path
Front Path /app/users/1 With API https://api.example.com/v1/users/1 Mix in the log. Read hostname and pathname separately after parsing, avoiding spelling the front base into API host.
scene D: Gateway 400
Copy "failed request URL" from browser, parse Query; It's often found multiple encoded %2520 or the required key is missing. Use the encoding tool to decode the suspicious value.
scene E: MoveendDeep Link
myapp://product/5?ref=xx Class custom scheme: Modern URL Probably solves protocol with path, but the end of WebView acts differently. is the document on the end, and the tool is structured.
Scenario F: Documentation and teaching
(a) Generate structured presentations using example buttons; Replaces it with a false domain name and avoids writing real sessions query (including token) into open documents.
7. Security attention
- Query
access_token、code、emailYou can play Header without URLs. - The results of the analysis are copied to the pre-worksheet dissensitisation.
- The userrinfo password is considered leaked and rotated.
- The blogger says that the "URL" is not a "unsettled" security issue. Encoding is not encrypted.
9. Collaboration agreement proposal
- API documents state whether array parameters are linked by a repeat key or a comma.
- (b) Prohibit the transmission of long-term keys to query; - Ow, oh, oh, oh, oh, oh, oh, oh, oh, oh, oh, oh, oh, oh, oh, oh, oh, oh, oh, oh, oh, oh, oh, oh, oh, oh, oh, oh, oh, oh, oh, oh, oh, oh, oh, oh, oh, oh, oh, oh.
- Logs are used to unplug out known sensitive keys when printing URLs.
- Short-chain service maintains the original test example for query.
- A copy of the "standard model URL" is stored back and forth and is being taught in a parser.
FAQ
Why can I solve it by entering www.foo.com?
Tools are missing :// Auto-add http://。 It's easy to paste, but...NotSite support or should be using http. See if the card's protocol meets expectations.
Hash and query who first?
The standard pattern is... path?query#hash。 If the sequence is reversed, the results of the analysis may not be intuitive or fail. Determines whether a Hash route or a heady + query is required when sharing the front end route.
Why is the value in the argument list already readable Chinese?
URLSearchParams You will give a logical string after decoded. If you want to see the original percent form on the line, combine the original text or encoder tool of the address bar.
Why is there no red word for the failure?
The current catch is silent after it is achieved. If the result area does not appear, check the URL validity, rather than repeat the click.
Will it be longer to cut back and forth with the encoder?
Yes. The following is a list of the characters that are used in the project: Do not recodify the entire paragraph coded URL brainless.
IPv6, internationalized domain names?
Dependency Browser URL Achieved. Problem is contrasted with the text in explicit brackets in IPv6.
Relative path `/a?b=1 '
No relative URLs for hosts new URL Always need a case. This tool path is more suitable for an absolute or refillable host paste; Relative path is to be parsed in application.
Is that my link at the rectification meeting?
Locally in browser URL Parsing. The link with token is still not allowed to remain on the screen with untrustworthy computers.
How the results are resolved into business code
Each part of the solver displays should be mapped to a clear field: protocol determines the transfer policy, host and port determines the connection target, path determines the resource, query parameters determines the screening conditions, and the clips are usually used only at the browser end. Do not type the whole URL directly into SQL, command line or HTML; Checks the permitted characters and lengths by field, and then hands them to the corresponding encoder. When you redirect, Webbook or return your address, you also need to verify the protocol white list, host white list and port range, avoiding using a " desolved " string as the " securely accessible " address.
If input may be a relative path, the business code must provide a credible base URL and check the final origin again after the resolution. Internationalized domain names, IPv6 addresses and duplicate parameters should also be included in the test sample, whether the full value is to be retained, the first value is to be taken or the request is to be refused. The tool is used for rapid dismantling and review, and the final rules should be deposited in the service-end validation and automation tests.
Cache and Audit After Dissolved
If the resolution results are to be entered into a cache, log or database, it is recommended that the original input, the standardized URL and the split fields be retained together and that the time and source of the resolution be recorded. No unauthorized deletion of repeat parameters, tail slash or case-writing information is allowed in the regularization unless the business has identified these differences as equivalent. Proxy, re-direction and signature processes may all rely on original bytes, and early regularization may make it difficult to repeat problems.
An authorized list of protocols, hosts and ports is also set for external jump addresses, and a user name, password or segment is de-referral or dissensitization is to be determined in accordance with the security strategy. Logs can record the host and the path for the barrier, but do not complete the search string for Token. This will preserve the structure needed to place errors and reduce the leakage of URLs after they enter the search index, monitor the platform or worksheet system.
Continue reading
Point "For example" URL moves through visualization and parameter tables, and then removes a link to a location that is dissensitized from the job; Opens the URL encoding tool when you need to change the encoding.