Skip to content

User Agent expect#93

Merged
anmolanmol1234 merged 9 commits intoABFS_3.3.2_devfrom
userAgentFix
Aug 14, 2023
Merged

User Agent expect#93
anmolanmol1234 merged 9 commits intoABFS_3.3.2_devfrom
userAgentFix

Conversation

@anmolanmol1234
Copy link
Copy Markdown
Collaborator

@anmolanmol1234 anmolanmol1234 commented Aug 11, 2023

Adding 100 continue in userAgent String if enabled in AbfsConfiguration and dynamically removing it if retry is without the header enabled.

Copy link
Copy Markdown
Collaborator

@saxenapranav saxenapranav left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good with code change. One question:
When at https://github.com/ABFSDriver/AbfsHadoop/blob/ABFS_3.3.2_dev/hadoop-tools/hadoop-azure/src/main/java/org/apache/hadoop/fs/azurebfs/services/AbfsClient.java#L899, when we retry without 100-continue header, agent will still show as 100-continue header. Should we change agent dynamically for that?

Copy link
Copy Markdown
Collaborator

@saxenapranav saxenapranav left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for taking suggestions. Great code!

*/
public class AbfsClient implements Closeable {
public static final Logger LOG = LoggerFactory.getLogger(AbfsClient.class);
public static final String HUNDRED_CONTINUE_USER_AGENT = " 100-continue;";
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we replace it with something like this: HUNDRED_CONTINUE_USER_AGENT = SINGLE_WHITE_SPACE + "100-continue" + SEMI_COLON;

This way it would assert that these characters are intentionally added.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

May be we can define a constant for "100-continue" as well, I can see its being used at multiple places

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We already have a constant for 100-continue, will take this up


if (abfsConfiguration.isExpectHeaderEnabled()) {
sb.append(SINGLE_WHITE_SPACE);
sb.append("100-continue");
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here also we can use the constant

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@anmolanmol1234 anmolanmol1234 merged commit 4e22860 into ABFS_3.3.2_dev Aug 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants